Skip to content

jwalgran/backbacon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backbacon

Get bacon.js event streams from Backbone models

Build Status

browser support

methods

backbacon exports a version of Backbone with a method added to Backbone.Model If you are loading it up through an import you will call it like so:

var Backbone = require('backbacon');
var Person = Backbone.Model.extend({});
var p = new Person({name: 'Justin'});

If you are loading backbacon using a <script> tag it must come after Underscore and Backbone:

<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="backbone.js"></script>
<script type="text/javascript" src="backbacon.js"></script>

p.asEventStream(eventName, [transformFn])

Returns an EventStream of events matching the specified eventName. The eventName argument can be any name you would normally pass to a modelInstance.on function like "change" or "change:name change:age"

If a function is passed as the transformFn argument it will be called with the original event arguments. The value returned from transformFn will be the value that appears in the EventStream.

install

With npm

npm install backbacon

license

MIT

About

Get bacon.js event streams from Backbone models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published