view-lite

Views for browser

npm install view-lite
26 downloads in the last week
54 downloads in the last month

View

View. Download compressed or uncompressed source.

  • Depends on elements-lite, router-lite and browser-history-lite.

Api

View(name, element, parent, contentSelector)
  • name String - A name for a view.
  • element String or Function or DOM Node - View representation as DOM tree. String and Function will be transformed to DOM Node on first call.
  • parent String - Parent view name.
  • contentSelector String, optional - A selector to where a child Node will be attached.

How to use

// Define starting point
View("body", document.body)
// Create first simple view
View("home", ".home", "body")
// Create another view
View("work", ".work", "body")

// Start
View.default = "home"
history.start(View.route)

// call manualy
View("home").show()

Licence

Copyright (c) 2013 Lauri Rooden <lauri@rooden.ee>
The MIT License

npm loves you