Skip to content

Backbone.Events extracted and turned into an AMD module

Notifications You must be signed in to change notification settings

spencewood/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Backbone.Events => Events

This is the Backbone Events system without any other Backbone extras. It is taken from version 1.0 of Backbone, and it is currently dependent on the underscore (or lodash) library. Extra support has been added for AMD compatibility.

Use with RequireJS:

define(['events'], function (Events) {
	Events.on('user:update', function () {
        //updated
    });
});

...

define(['events'], function (Events) {
    Events.trigger('user:update');
});

When using with RequireJS, make sure to define underscore in your config:

require.config({
    ...
    paths: {
        underscore: 'lib/lodash'
    }
    ...
});

Or just use it in the global context:

$(function (){
    Events.trigger('ready');
});

All credit goes to the original Backbone developers.

About

Backbone.Events extracted and turned into an AMD module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published