You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
416 B
19 lines
416 B
var emitter = require('./index')()
|
|
|
|
emitter.on('*', function () {
|
|
console.log('all events emitted', this.event)
|
|
})
|
|
|
|
emitter.on('example', function () {
|
|
console.log('example event emitted')
|
|
})
|
|
|
|
emitter.emit('example')
|
|
|
|
emitter.on('demo', function () {
|
|
console.log('multiple events with `demo` namespace emitted', this.event)
|
|
})
|
|
|
|
emitter.emit('demo:cool')
|
|
emitter.emit('demo:awesome')
|
|
emitter.emit('demo:great')
|
|
|