Skip to content

Instantly share code, notes, and snippets.

@michaelsbradleyjr
Created October 2, 2011 04:02
Show Gist options
  • Save michaelsbradleyjr/1257025 to your computer and use it in GitHub Desktop.
Save michaelsbradleyjr/1257025 to your computer and use it in GitHub Desktop.
A very small (and trivial) sample of Jolt in action
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
@michaelsbradleyjr
Copy link
Author

Will gist-comments appear in my posterous blog? (testing...)

@michaelsbradleyjr
Copy link
Author

Nope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment