
Untitled
By: a guest on
May 21st, 2012 | syntax:
None | size: 0.56 KB | hits: 17 | expires: Never
Jolt = require 'Jolt'
Jolt.globalize() # places the Jolt API, _, and EventEmitter in the global scope
# Jolt embeds the cross-platform EventEmitter2 library, aliased as EventEmitter
myEmitter = new EventEmitter
myB = $B ($E myEmitter, 'event').mapE((x, y, z) ->
[z, y, x]).nary(true), 0, 0, 0 # initial Behavior value set beyond 1st argument position
liftB ((a, b, c) ->
console.log a, b, c), myB # produce some side effect
# '0 0 0' should have been reported in the console, and now...
myEmitter.emit 'event', 1, 2, 3
# '3 2 1' should be reported in the console