Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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