-
-
Notifications
You must be signed in to change notification settings - Fork 0
View
Lauri Rooden edited this page May 25, 2021
·
1 revision
Methods
Define views hierarchy in form:
route file-needed.js,another-file.css
users/{user} users.view,%.css
Path Expansion can be used to define files.
Find a matching view, assign parameters from url to params and return View object
Find a matching view and call show on it
Add callback to resolve url parameters. Name can be a string or array of strings.
View.param(["user", "post"], function(value, name, params) {
api(name).get(value, function(err, item) {
if (err) return View("404").show()
El.data.model = item
})
.then(this.wait())
})
// Optional path for views, default = ""
View.base = "/js/views/"
// Define starting point in DOM
View("body", document.body)
// Default view
View.main = "home"
Copyright (c) 2006-2024 Lauri Rooden <[email protected]>
MIT License |
GitHub repo |
npm package |
Buy Me A Tea