I hereby claim:
- I am strandel on github.
- I am strandel (https://keybase.io/strandel) on keybase.
- I have a public key whose fingerprint is A808 ACB1 B548 70AD B5E4 28C2 E5D2 78F6 21EA 5035
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| var pubsub = (function () { | |
| var pubsubs = {} | |
| function publish(name, data) {var listeners = pubsubs[name] || []; listeners.forEach(function (func) {func(data)})} | |
| function subscribe(name, func) {if (!pubsubs[name]) pubsubs[name] = []; pubsubs[name].push(func)} | |
| return {publish: publish, subscribe: subscribe} | |
| })(); | |
| // Example | |
| pubsub.subscribe('HIT_ME', function (x) {console.log('Hit me ' + x)}) | |
| pubsub.publish('HIT_ME', 'with your rhythm stick') |
| function chain() { | |
| var queue = [] | |
| , withoutContext = null | |
| function chainer(func) { | |
| queue.push(func) | |
| return chainer | |
| } | |
| chainer.run = function () {return run(queue)} |
| function chain() { | |
| var queue = [] | |
| , withoutContext = null | |
| function chainer(func) { | |
| queue.push(func) | |
| return chainer | |
| } | |
| chainer.run = function () {return run(queue)} |
| function chain() { | |
| var queue = [] | |
| function chainer(func) { | |
| queue.push(function (x) {return func(x)}) | |
| return chainer | |
| } | |
| chainer.run = function () { | |
| queue.reduce(function (previous, func) {return func(previous)}, undefined) | |
| } | |
| return chainer |