result-core
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -6,3 +6,4 @@ | ||
module.exports = Result | ||
module.exports = exports = Result | ||
exports.addListener = listen | ||
@@ -133,3 +134,3 @@ /** | ||
* @param {Function} fn | ||
* @api private | ||
* @api public | ||
*/ | ||
@@ -136,0 +137,0 @@ |
{ | ||
"name": "result-core", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "minimal result reification", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -6,4 +6,6 @@ | ||
Results are an attempt to re-build the call stack conceptual model back on top of the callback model. The approach they take is to ask you to reify your asynchronous function calls with a Result instance. These instances model a stack frame in that it will eventually be either a successfully computed value or an error. Once you have reified your async function calls with runtime objects you can compose them together and recreate the computation tree that is normally implicit and maintained underneath the runtime. This implementation does nothing to improve the stack traces of your errors but that feature could be added. | ||
Results are an attempt to re-build the call stack conceptual model back on top of the "event loop" model. The approach they take is to ask you to reify your asynchronous function calls with a Result instance. The intention of these is to model stack frames, in that they will eventually be either a successfully computed value or an error. Because these Result instances are runtime objects you can compose them together to recreate the computation tree that is normally implicit and maintained underneath the runtime. | ||
This implementation does nothing to improve the stack traces of your errors but that feature could be added. | ||
## Installation | ||
@@ -29,9 +31,9 @@ | ||
function add(a, b){ | ||
var result = new Result | ||
result.write(a + b) | ||
return result | ||
var result = new Result | ||
result.write(a + b) | ||
return result | ||
} | ||
add(1, 2).read(function(n){ | ||
console.log('1 + 2 = %d', n) | ||
console.log('1 + 2 = %d', n) | ||
}) | ||
@@ -38,0 +40,0 @@ ``` |
8334
198
55