Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 0.56 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Jolt = require 'Jolt'
  2. Jolt.globalize() # places the Jolt API, _, and EventEmitter in the global scope
  3.  
  4. # Jolt embeds the cross-platform EventEmitter2 library, aliased as EventEmitter
  5. myEmitter = new EventEmitter
  6.  
  7. myB = $B ($E myEmitter, 'event').mapE((x, y, z) ->
  8.   [z, y, x]).nary(true), 0, 0, 0 # initial Behavior value set beyond 1st argument position
  9.  
  10. liftB ((a, b, c) ->
  11.   console.log a, b, c), myB # produce some side effect
  12.  
  13. # '0 0 0' should have been reported in the console, and now...
  14. myEmitter.emit 'event', 1, 2, 3
  15. # '3 2 1' should be reported in the console