hyper-chain
Advanced tools
Comparing version
// Generated by CoffeeScript 1.12.7 | ||
var Boxlet, Semaphore, _, _proto, debug, exports, hc, | ||
var Boxlet, Semaphore, _, _ASAP, _proto, debug, exports, hc, | ||
hasProp = {}.hasOwnProperty, | ||
@@ -17,6 +17,6 @@ slice = [].slice; | ||
* Manual: 쭉기다리다가 명령이 오면 나감. | ||
* ASAP 들어오는 즉시 나감 | ||
* Debounce: 지연된 시간내의 것을 모아서. | ||
* Interval: 지정된 간격으로 나감 | ||
* Emittable : 특정 조건을 만족하여 나갈수 있을때 | ||
* consecution: 들어오는 즉시 나감. 처리함수의 연속. | ||
* asap : 가능한 빨리 큐에서 꺼냄. 비동기 | ||
* debounce: 지연된 시간내의 것을 모아서. | ||
* interval: 지정된 간격으로 나감 | ||
@@ -26,3 +26,2 @@ Puller 계열 | ||
* reduce 리듀싱 처리 | ||
* PullAll | ||
@@ -35,2 +34,12 @@ Outer 계열 | ||
_ASAP = function(fn) { | ||
return setTimeout(fn, 0); | ||
}; | ||
if ((typeof process !== "undefined" && process !== null ? process.nextTick : void 0) != null) { | ||
_ASAP = function(fn) { | ||
return process.nextTick(fn); | ||
}; | ||
} | ||
_proto = function(klass, dict) { | ||
@@ -64,5 +73,12 @@ var key, results, v; | ||
Boxlet.prototype._push = function() { | ||
var items, ref; | ||
items = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
(ref = this.data).push.apply(ref, items); | ||
debug('_push'); | ||
return this.afterPut(); | ||
}; | ||
Boxlet.prototype.put = function(item) { | ||
this.data.push(item); | ||
this.afterPut(); | ||
this._push(item); | ||
return this; | ||
@@ -72,6 +88,5 @@ }; | ||
Boxlet.prototype.putAll = function() { | ||
var items, ref; | ||
var items; | ||
items = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
(ref = this.data).push.apply(ref, items); | ||
this.afterPut(); | ||
this._push.apply(this, items); | ||
return this; | ||
@@ -81,5 +96,3 @@ }; | ||
Boxlet.prototype.puts = function(array) { | ||
var ref; | ||
(ref = this.data).push.apply(ref, array); | ||
this.afterPut(); | ||
this._push.apply(this, array); | ||
return this; | ||
@@ -92,8 +105,12 @@ }; | ||
_fn = hc().await("data", function(done) { | ||
debug('call puller'); | ||
return box.puller(box, done); | ||
}).load("data").await(function(data, done) { | ||
debug('call outter'); | ||
return box.outer(data, done); | ||
}); | ||
_fn(function(err) { | ||
return callback(err, box); | ||
if (callback) { | ||
return callback(err, box); | ||
} | ||
}); | ||
@@ -129,6 +146,7 @@ return this; | ||
}, | ||
ASAP: function() { | ||
consecution: function() { | ||
var box; | ||
box = this; | ||
box.afterPut.clear()["do"](function() { | ||
debug('consecution call pullOut'); | ||
return box.pullOut(); | ||
@@ -138,2 +156,14 @@ }); | ||
}, | ||
asap: function() { | ||
var box; | ||
box = this; | ||
box.afterPut.clear()["do"](function() { | ||
var _dfn; | ||
_dfn = function() { | ||
return box.pullOut(); | ||
}; | ||
return _ASAP(_dfn); | ||
}); | ||
return box; | ||
}, | ||
interval: function(msec) { | ||
@@ -140,0 +170,0 @@ var _tick, box; |
// Generated by CoffeeScript 1.12.7 | ||
var ASAP, Args, _, applyChainBuilder, applyInvokeFn, createExecuteContext, debug, exports, hyper_chain, | ||
var Args, _, _ASAP, applyChainBuilder, applyInvokeFn, createExecuteContext, debug, exports, hyper_chain, | ||
slice = [].slice; | ||
@@ -9,6 +9,12 @@ | ||
ASAP = function(fn) { | ||
return process.nextTick(fn); | ||
_ASAP = function(fn) { | ||
return setTimeout(fn, 0); | ||
}; | ||
if ((typeof process !== "undefined" && process !== null ? process.nextTick : void 0) != null) { | ||
_ASAP = function(fn) { | ||
return process.nextTick(fn); | ||
}; | ||
} | ||
Args = (function() { | ||
@@ -51,3 +57,3 @@ function Args() { | ||
exe_ctx.error = error; | ||
return ASAP(function() { | ||
return _ASAP(function() { | ||
var cb, ref; | ||
@@ -385,3 +391,3 @@ if (!_callback) { | ||
}; | ||
chain.delayIf = function(ms, if_fn) { | ||
return chain.delayIf = function(ms, if_fn) { | ||
chain._internal_fns.push(function(exe_ctx) { | ||
@@ -401,8 +407,2 @@ var _dfn, yn; | ||
}; | ||
return chain.reduce = function(fn) { | ||
chain._internal_fns.push(function(exe_ctx) { | ||
return fn.call.apply(fn, [exe_ctx].concat(slice.call(exe_ctx.curArgs.args), [exe_ctx])); | ||
}); | ||
return chain; | ||
}; | ||
}; | ||
@@ -419,10 +419,8 @@ | ||
exe_ctx = createExecuteContext(chain._internal_fns, _callback); | ||
ASAP(function() { | ||
exe_ctx.inputs = inputs; | ||
return exe_ctx.next((function(func, args, ctor) { | ||
ctor.prototype = func.prototype; | ||
var child = new ctor, result = func.apply(child, args); | ||
return Object(result) === result ? result : child; | ||
})(Args, inputs, function(){})); | ||
}); | ||
exe_ctx.inputs = inputs; | ||
exe_ctx.next((function(func, args, ctor) { | ||
ctor.prototype = func.prototype; | ||
var child = new ctor, result = func.apply(child, args); | ||
return Object(result) === result ? result : child; | ||
})(Args, inputs, function(){})); | ||
return exe_ctx; | ||
@@ -434,5 +432,3 @@ }; | ||
exe_ctx.error = err; | ||
ASAP(function() { | ||
return exe_ctx.resume(); | ||
}); | ||
exe_ctx.resume(); | ||
return exe_ctx; | ||
@@ -439,0 +435,0 @@ }; |
{ | ||
"name": "hyper-chain", | ||
"version": "0.1.4", | ||
"version": "0.1.5-1", | ||
"description": "function builder for reactive programing. support promise, node-callback and designed for robust error handling. ", | ||
@@ -5,0 +5,0 @@ "main": "lib", |
49197
-5.3%9
-10%763
-11.38%