Angular ES6 Native vs Bluebird Notes

Handsontable JavaScript Spreadsheet Most popular component for web apps

ES6 Native vs Bluebird

Testing ES6 Native

“ES6 native promises testing pending state”
How to test the pending state of a promise? ie – it’s not fulfilled.
es-promise-inspect uses const Debug = vm.runInDebugContext(‘Debug’);
which has the following caveat:
Note: The debug context and object are intrinsically tied to V8’s debugger implementation and may change (or even be removed) without prior warning.

You need to include the return to tell mocha the test is done.

mocha testing with promises notes

traditional way?

“the Mocha JavaScript testing framework has direct support for promises”

“mocha-as-promised was rolled into Mocha in Mocha version 1.18.0,”

$q vs ES6 Promises – notes

Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.
From the perspective of dealing with error handling, deferred and promise APIs are to asynchronous programming what try, catch and throw keywords are to synchronous programming.
 A new instance of deferred is constructed by calling $q.defer().
The purpose of the deferred object is to expose the associated Promise instance as well as APIs that can be used for signaling the successful or unsuccessful completion, as well as the status of the task.
notify(value) – provides updates on the status of the promise’s execution. This may be called multiple times before the promise is either resolved or rejected.
$q promise notify example:
Sam Deering

Sam Deering

Sam is a web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and sharing what he learns with others.

Leave a Reply

Your email address will not be published. Required fields are marked *