$Z is another useful utility method that is similar to $Y. Like $Y, it returns a wrapping function that conforms to the contract of an asynchronous function. (The wrapping function always returns an instance of jsx3.$AsyncRV.) Unlike $Y, $Z enforces no contract on the wrapped function. jsx3.$Z allows you to use automatic parameter resolution and return value chaining with normal, synchronous functions, as in the following example: function add(a, b) { return a + b; } var firstArg = jsx3.$Y(function(cb) { cb.done(cb.args()[0]); }); var one = firstArg(1), two = firstArg(2); jsx3.$Z(add)(one, two).when(function(rv) { jsx3.log("1 + 2 = " + rv); }); |
Contents
|
