1.0.7 • Published 6 years ago

eventdispacher v1.0.7

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

EventDispacher

This is a package for event emitting.

how to use

var eventEmitter = require('eventdispacher')
var test = new eventEmitter.EventDispacher()
var con = function(event) {
        console.log(event.name)
    }
    /**只添加一次回调 */
test.once(this, 'once', con)
test.dispach('once', { name: 'once' })
test.dispach('once', { name: 'once' })

var add1 = function(event) {
    console.log(event.name)
}
test.addListener(this, 'add', add1)
var add2 = function(event) {
        console.log(event.name)
    }
    /**只添加一次回调 */
test.addListener(this, 'add', add2)
test.dispach('add', { name: 'add' })

test.removeListener('add', add1)
test.dispach('add', { name: 'add' })
test.clear()
test.dispach('add', { name: 'add' })
1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

9 years ago

0.1.0

9 years ago