Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-events-standalone

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-events-standalone

Standalone version of Backbone.Events

  • 0.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-10.92%
Maintainers
1
Weekly downloads
 
Created
Source

backbone-events-standalone

Build Status

This is an extraction of the Events module of Backbone which can be used standalone (no external dependency), in the browser or in a nodejs environment.

Oh dear. Why another EventEmitter?

This project started because I appreciate the Backbone.Events interface & features while I wanted to keep using it within non-DOM environments (think a Social API Web Worker for example).

I've ported the original Backbone.Events tests to mocha & chai so I can run them within a nodejs environment and ensure the extracted API actually works as expected without the burden of setting up continuous integration of browser tests.

Installation

Bower (for browser use)

$ bower install backbone-events-standalone

NPM (node)

$ npm install backbone-events-standalone

Usage

Standard browser use

<script src="backbone-events-standalone.js"></script>
<script>
  // use BackboneEvents
</script>

Notes:

  • You may want to use the minified version stored in backbone-events-standalone.min.js.
  • Using Bower, files are usually available within bower_components/backbone-events-standalone

AMD

require(["backbone-events-standalone"], function(BackboneEvents) {
  // ...
});

In nodejs/browserify

var BackboneEvents = require("backbone-events-standalone");

API

The BackboneEvents#mixin method helps extending any object or prototype to add eventing support to it:

var myEventEmitter = BackboneEvents.mixin({});
myEventEmitter.on("foo", console.log).trigger("foo", "hello emitter");

// alternatively
function Plop() {}
BackboneEvents.mixin(Plop.prototype);
(new Plop()).on("foo", console.log).trigger("foo", "hello emitter");

BackboneEvents API & usage is the same as Backbone.Events.

Test

$ npm test

License

MIT

Credits

Jeremy Ashkenas, Backbone author

Keywords

FAQs

Package last updated on 14 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc