javascript - Does my Promise implementation agree with specifications? -
I'm trying to create a TypeScript promise implementation (actually a polyfil) which agrees with the current specifications (I I use these).
It should be done, the code is here, but I can not understand 2.2.7 subpoints of glasses.
Please someone can explain 2.2.7 sub-points and tell me that I have implemented them correctly?
Thanks for the attention and time, Matia.
Let's talk to the code say that we are called By device Then a promise will be returned Self explanatory: If either a completed or calculated value returns x, run the promise resolution process [[Resolution ]] (Promise 2, x). If we have Then you can do this Then you can do Spec If the fullfill is not a function and the promise 1 is complete, then the promise 2 must be completed with the same value. If we have Then we can do this Spec If there is no function given on it and Promise 1 has declined, then Promise 2 rejected for the same reason should go. If we have Then we can do this To verify that you have been shown to write the execution, I recommend using Chai with Mocha. promise 1 . According to the tip:
Promise 2 = Promise 1.then (Completed, Calculated); By device
promise 2 = promise 1 Then ((=) => 123, () => 123);
Promise 2 Then ((x) => <* * 123 * /, (x) = & gt; / * will not be called * /);
Promise 2 = Promise 1 Then ((=) = {new error ('message');}, () = & gt; {new error ('message');});
promise2.then ((x) => = * to * /, (x) = & gt ; / * X will be equal to "new error ('message')" * /);
promise 1 = new promise (work (solution, reject) {solution (123)}); Promise 2 = Promise 1 Then (tap, zero);
Promise 2.then ((x) => / * x 123 * /, (x) = & Gt; / * should not be called * /);
promise 1 = new promise (work (solution, reject) {reject (123)}); Promise 2 = Promise 1 Then (tap, zero);
Promise 2.then ((x) => = * to * /, (x) = & Gt; / * x 123 * /);
Comments
Post a Comment