Comparing version 0.2.1 to 0.2.2
@@ -47,2 +47,13 @@ /** | ||
var nextTick; | ||
if (typeof setImmediate === "function") { | ||
// In IE10, or use https://github.com/NobleJS/setImmediate | ||
nextTick = setImmediate; | ||
} else { | ||
nextTick = function (cb) { | ||
process.nextTick(cb); | ||
}; | ||
} | ||
function _loopResults(cb, scope, results, index, offset, limit) { | ||
@@ -52,5 +63,9 @@ return function () { | ||
var ret = new Promise(); | ||
process.nextTick(function () { | ||
nextTick(function () { | ||
try { | ||
when(cb.apply(scope || results, [r, i + offset, results])).then(ret); | ||
when(cb.apply(scope || results, [r, i + offset, results])).then(function () { | ||
ret.callback.apply(ret, arguments); | ||
}, function () { | ||
ret.errback.apply(ret, arguments); | ||
}); | ||
} catch (e) { | ||
@@ -60,2 +75,5 @@ ret.errback(e); | ||
}); | ||
ret.both(function () { | ||
cb = scope = results = index = offset = limit = null; | ||
}) | ||
return ret; | ||
@@ -82,5 +100,9 @@ })); | ||
ret.callback({loopResults: flatten(loopResults) || [], arr: results}); | ||
// loopResults = null; | ||
// results = null; | ||
}, function (error) { | ||
error = compact(error); | ||
ret.errback(error.length === 1 ? error[0] : error); | ||
// loopResults = null; | ||
// results = null; | ||
}); | ||
@@ -1210,3 +1232,3 @@ return ret; | ||
var args = argsToArray(arguments), mRet = new Promise(); | ||
process.nextTick(function () { | ||
nextTick(function () { | ||
func.apply(null, [ret].concat(args)).then(mRet); | ||
@@ -1221,2 +1243,3 @@ }); | ||
} | ||
p = null; | ||
return ret; | ||
@@ -1223,0 +1246,0 @@ } |
@@ -63,3 +63,2 @@ /** | ||
} | ||
; | ||
@@ -79,3 +78,2 @@ | ||
} | ||
; | ||
@@ -114,3 +112,2 @@ | ||
} | ||
; | ||
@@ -139,3 +136,2 @@ | ||
} | ||
; | ||
@@ -162,3 +158,2 @@ /** | ||
} | ||
; | ||
@@ -165,0 +160,0 @@ |
@@ -5,20 +5,2 @@ var define = require("../define.js").define, base = require("../base"), fs = require('fs'), Appender = require("./appenders/appender.js"); | ||
var checkProcessUncaughtException = (function () { | ||
var isProcessUnCaaughtEception = false; | ||
return function _checkProcessUncaughtException() { | ||
//if (!isProcessUnCaaughtEception) { | ||
var rootLogger = Logger.getRootLogger(); | ||
if (!isProcessUnCaaughtEception) { | ||
process.on("uncaughtException", function (err) { | ||
if (rootLogger.appenders.length) { | ||
rootLogger.error(err); | ||
} else { | ||
console.error(err.stack); | ||
} | ||
}); | ||
isProcessUnCaaughtEception = true; | ||
} | ||
//} | ||
}; | ||
})(); | ||
@@ -45,3 +27,2 @@ var parseProperties = function (properties) { | ||
} | ||
checkProcessUncaughtException(); | ||
}; | ||
@@ -59,6 +40,6 @@ | ||
var BasicConfigurator = (exports.BasicConfigurator = define(null, { | ||
instance:{ | ||
instance: { | ||
/**@lends comb.logging.BasicConfigurator.prototype*/ | ||
constructor:function () { | ||
constructor: function () { | ||
if (!Logger) { | ||
@@ -77,3 +58,3 @@ logging = require("./index").logging; | ||
*/ | ||
configure:function (appender) { | ||
configure: function (appender) { | ||
var rootLogger = Logger.getRootLogger(); | ||
@@ -86,3 +67,2 @@ rootLogger.removeAllAppenders(); | ||
} | ||
checkProcessUncaughtException(); | ||
} | ||
@@ -151,3 +131,3 @@ } | ||
exports.PropertyConfigurator = define(BasicConfigurator, { | ||
instance:{ | ||
instance: { | ||
/**@lends comb.logging.PropertyConfigurator.prototype*/ | ||
@@ -199,3 +179,3 @@ /** | ||
*/ | ||
configure:function (properties) { | ||
configure: function (properties) { | ||
var rootLogger = Logger.getRootLogger(); | ||
@@ -202,0 +182,0 @@ rootLogger.removeAllAppenders(); |
@@ -6,9 +6,18 @@ var func = require("../base/functions"), | ||
var nextTick; | ||
if (typeof setImmediate === "function") { | ||
// In IE10, or use https://github.com/NobleJS/setImmediate | ||
nextTick = setImmediate; | ||
} else { | ||
nextTick = function (cb) { | ||
process.nextTick(cb); | ||
}; | ||
} | ||
var Middleware = define(null, { | ||
instance:{ | ||
instance: { | ||
/** @lends comb.plugins.Middleware.prototype */ | ||
__hooks:{pre:{}, post:{}}, | ||
__hooks: {pre: {}, post: {}}, | ||
@@ -49,3 +58,3 @@ | ||
*/ | ||
constructor:function () { | ||
constructor: function () { | ||
this.__hooks = obj.merge({}, this.__hooks); | ||
@@ -72,3 +81,3 @@ this._super(arguments); | ||
*/ | ||
_hook:function (state, op, args) { | ||
_hook: function (state, op, args) { | ||
args = args || []; | ||
@@ -83,3 +92,3 @@ var promise = new Promise(); | ||
} else { | ||
process.nextTick(func.hitch(this, function () { | ||
nextTick(func.hitch(this, function () { | ||
//if Ive looped through all of them callback | ||
@@ -123,3 +132,3 @@ if (count == length) { | ||
* */ | ||
pre:function (fun, callback) { | ||
pre: function (fun, callback) { | ||
var hook = this.__hooks.pre[fun]; | ||
@@ -149,3 +158,3 @@ if (!hook) { | ||
* */ | ||
post:function (fun, callback) { | ||
post: function (fun, callback) { | ||
var hook = this.__hooks.post[fun]; | ||
@@ -160,3 +169,3 @@ //if I havent initialized it create it; | ||
static:{ | ||
static: { | ||
/** @lends comb.plugins.Middleware */ | ||
@@ -181,3 +190,3 @@ | ||
* */ | ||
pre:function (name, cb) { | ||
pre: function (name, cb) { | ||
var hooks = this.prototype.__hooks; | ||
@@ -208,3 +217,3 @@ var hook = hooks.pre[name]; | ||
* */ | ||
post:function (name, cb) { | ||
post: function (name, cb) { | ||
var hooks = this.prototype.__hooks; | ||
@@ -211,0 +220,0 @@ var hook = hooks.post[name]; |
@@ -15,3 +15,13 @@ var hitch = require("./base/functions").hitch, | ||
var nextTick; | ||
if (typeof setImmediate === "function") { | ||
// In IE10, or use https://github.com/NobleJS/setImmediate | ||
nextTick = setImmediate; | ||
} else { | ||
nextTick = function (cb) { | ||
process.nextTick(cb); | ||
}; | ||
} | ||
var Promise = define(null, { | ||
@@ -78,4 +88,5 @@ instance: { | ||
__callNextTick: function (cb, results) { | ||
process.nextTick(hitch(this, function () { | ||
nextTick(hitch(this, function () { | ||
cb.apply(this, results); | ||
results = null; | ||
})); | ||
@@ -313,3 +324,3 @@ }, | ||
if (errback) { | ||
process.nextTick(function () { | ||
nextTick(function () { | ||
try { | ||
@@ -320,5 +331,7 @@ when(isFunction(errback) ? errback.apply(this, args) : errback).then(promise); | ||
} | ||
promise = args = null; | ||
}); | ||
} else { | ||
promise.errback.apply(promise, args); | ||
promise = args = null; | ||
} | ||
@@ -329,7 +342,10 @@ } | ||
var args = arguments; | ||
process.nextTick(function () { | ||
nextTick(function () { | ||
try { | ||
when(isFunction(callback) ? callback.apply(this, args) : callback).then(promise.callback.bind(promise), errorHandler); | ||
when(isFunction(callback) ? callback.apply(this, args) : callback).then(function () { | ||
promise.callback.apply(promise, arguments); | ||
promise = args = null; | ||
}, errorHandler); | ||
} catch (e) { | ||
promise.errback(e); | ||
errorHandler(e); | ||
} | ||
@@ -513,3 +529,3 @@ }); | ||
__callNextTick: function (cb, results) { | ||
process.nextTick(hitch(this, function () { | ||
nextTick(hitch(this, function () { | ||
cb.apply(this, [results]); | ||
@@ -599,2 +615,3 @@ })); | ||
results.push(res); | ||
res = null; | ||
}); | ||
@@ -813,5 +830,6 @@ } | ||
if (!resolved) { | ||
args = arguments; | ||
return p.chain(function doneWaiting() { | ||
var args = arguments; | ||
return p.chain(function () { | ||
resolved = true; | ||
p = null; | ||
return fn.apply(this, args); | ||
@@ -818,0 +836,0 @@ }.bind(this)); |
{ | ||
"name": "comb", | ||
"description": "A framework for node", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"keywords": ["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"], | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"devDependencies": { | ||
"it": "0.0.5" | ||
"it": "~0.2.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2856127
82
11412