Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/bolasblack/backbone.event.one

add `one` method to Backbone.Events
https://github.com/bolasblack/backbone.event.one

Last synced: 11 days ago
JSON representation

add `one` method to Backbone.Events

Awesome Lists containing this project

README

        

# Backbone.event.one

**Add `one` method to `Backbone.Events`**

## Install

```html

```

## Usage

```coffeescript
eventSpy = sinon.spy()
filterSpy = sinon.spy()

obj = _.extend {}, Backbone.Events
obj.one "test", eventSpy, context, (returnValue) ->
filterSpy.apply this, arguments
returnValue

obj.trigger "test", false
filterSpy.called.should.be.true
eventSpy.called.should.be.false

obj.trigger "test", true
filterSpy.calledTwice.should.be.true
eventSpy.calledOnce.should.be.true
```