Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/view
Create reactive views.
https://github.com/segment-boneyard/view
Last synced: about 5 hours ago
JSON representation
Create reactive views.
- Host: GitHub
- URL: https://github.com/segment-boneyard/view
- Owner: segment-boneyard
- Created: 2013-07-15T03:21:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-11T20:33:51.000Z (almost 11 years ago)
- Last Synced: 2024-04-09T16:31:16.283Z (7 months ago)
- Language: JavaScript
- Size: 206 KB
- Stars: 16
- Watchers: 38
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# View
Create reactive views easily.
## Installation
$ component install segmentio/view
## Example
```js
var createView = require('view');
var template = require('./template.html');var View = createView(template);
var view = new View(model);view.el; // Element
view.reactive; // Reactive
view.model; // Model
view.find('.button'); // Element
view.findAll('.button'); // NodeList
view.emit; // component/emitter
view.on; // component/emitter
view.once; // component/emitter
view.off; // component/emitter
```## API
### view(template[, fn])
Returns a new View constructor that uses the given `template`.
Optional `fn` will be bound to the `construct` event.### View(model, el, options)
The signature of the `View` created. All optional.### View#template
The template of the view, useful for inheritance if you need to override it.### View#el
The view's element once it's `domify`'d.## License
MIT