0.1.1 • Published 10 years ago
signaler v0.1.1
Signaler
Event signaler
Usage
Basic usage
Signaler = require 'signaler'
s = new Signaler
s.on 'hello', (name) ->
console.log "Hello #{name}"
s.trigger 'hello', 'John'
If you want to get event notification 'max'-times. Use
s.onmax 'hello', 5, (name) ->
console.log "Hello #{name}"
You can use signaler as a 'latch' with set
-method. For example:
s.on 'start', () -> console.log 'started 1'
s.set 'start'
s.on 'start', () -> console.log 'started notified here also'
0.1.1
10 years ago