# backbone-events-standalone

> Standalone version of Backbone.Events

Latest version **0.2.7** (published 2015-05-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install backbone-events-standalone
pnpm add backbone-events-standalone
yarn add backbone-events-standalone
bun add backbone-events-standalone
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2015-05-18 |
| First published | 2013-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 62 |
| Author | Nicolas Perriault |
| Maintainers | n1k0 |
| Keywords | backbone, events |

## Links

- npm: https://www.npmjs.com/package/backbone-events-standalone
- Repository: https://github.com/n1k0/backbone-events-standalone
- Issues: https://github.com/n1k0/backbone-events-standalone/issues
- npm.io page: https://npm.io/package/backbone-events-standalone

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.2.7 (latest) — 2015-05-18
- 0.2.6 — 2015-03-14
- 0.2.5 — 2015-03-14
- 0.2.4 — 2014-09-03
- 0.2.3 — 2014-09-03
- 0.2.2 — 2014-06-30
- 0.2.1 — 2013-10-14
- 0.2.0 — 2013-10-14
- 0.1.5 — 2013-09-05
- 0.1.4 — 2013-09-05
- 0.1.3 — 2013-09-05
- 0.1.2 — 2013-09-05
- 0.1.0 — 2013-09-05

## README

backbone-events-standalone
==========================

[![Build Status](https://travis-ci.org/n1k0/backbone-events-standalone.png)](https://travis-ci.org/n1k0/backbone-events-standalone)

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

```html
<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

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

### In nodejs/browserify

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

### API

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

```js
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](http://ashkenas.com/), Backbone author

[Events]: http://backbonejs.org/#Events
[Backbone.Events]: http://backbonejs.org/#Events
[Backbone]: http://backbonejs.org/
[mocha]: (http://visionmedia.github.io/mocha/)
[chai]: http://chaijs.com/
[nodejs]: nodejs.org/
[original Backbone.Events tests]: https://github.com/jashkenas/backbone/blob/699fe3271262043bb137bae97bd0003d6d193f27/test/events.js
[Social API Web Worker]: https://developer.mozilla.org/en-US/docs/Social_API/Service_worker_API_reference

---
_Source: https://npm.io/package/backbone-events-standalone · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
