Comparing version 1.0.4-rc1 to 1.0.4-rc2
{ | ||
"name": "fluxible", | ||
"version": "1.0.4-rc1", | ||
"version": "1.0.4-rc2", | ||
"description": "A pluggable container for isomorphic flux applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,29 +9,2 @@ /** | ||
function callActionInternal(actionContext, action, payload, resolve, reject) { | ||
try { | ||
var syncResult = action(actionContext, payload, function (err, result) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(result); | ||
} | ||
}); | ||
if (isPromise(syncResult)) { | ||
syncResult.then(resolve, reject); | ||
} else if (action.length < 3) { | ||
resolve(syncResult); | ||
} | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function callActionNoImmediate(actionContext, action, payload, done) { | ||
var executeActionPromise = new Promise(function (resolve, reject) { | ||
callActionInternal(actionContext, action, payload, resolve, reject); | ||
}); | ||
return finalizeAction(executeActionPromise, done); | ||
} | ||
/** | ||
@@ -45,9 +18,22 @@ * Call an action supporting Promise expectations on invocation. | ||
var executeActionPromise = new Promise(function (resolve, reject) { | ||
setImmediate(callActionInternal.bind(null, actionContext, action, payload, resolve, reject)); | ||
setImmediate(function () { | ||
try { | ||
var syncResult = action(actionContext, payload, function (err, result) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(result); | ||
} | ||
}); | ||
if (isPromise(syncResult)) { | ||
syncResult.then(resolve, reject); | ||
} else if (action.length < 3) { | ||
resolve(syncResult); | ||
} | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
}); | ||
return finalizeAction(executeActionPromise, done); | ||
} | ||
function finalizeAction(executeActionPromise, done) { | ||
if (done) { | ||
@@ -68,2 +54,1 @@ executeActionPromise | ||
module.exports = callAction; | ||
module.exports.callActionNoImmediate = callActionNoImmediate; |
@@ -33,5 +33,5 @@ /** | ||
}); | ||
return callAction.callActionNoImmediate(this, action, payload, callback); | ||
return callAction(this, action, payload, callback); | ||
}; | ||
module.exports = MockActionContext; |
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
43590
725