The JSDO library can use named events and jQuery-style Promises to handle asynchronous operations.

Documentation:

The attached sample program shows how to use the JSDO library with native JavaScript Promises. The progress.jsdo.js library is used.
Related links:

The zip file includes two version of the program:

  1. index.html: Sample program to use in a web browser.
  2. app.js: Sample program to use in Node.js

The actual code resides in index.js which is included in both versions.

The JSDO library uses jQuery-style Promises, however, it does not technically depend on jQuery. It can use other implementation of promises if they are provided in the form of a "$.Deferred" object.

The attached sample includes an object, pwrapper.js, that provides a wrapper object for native JavaScript promises.
This object also provides a done() and a fail() method that use the same signature as jQuery-style Promises, where the callback can use multiple parameters. The callback for the then() method in native JavaScript Promises only expects one parameter.

Using index.html

  1. Open index.html in a web browser that supports native JavaScript Promises.

Using app.js

  1. Install the node-XMLHttpRequest package by running "npm install xmlhttprequest"
  2. Run app.js using a recent version of Node.js: node app.js

Links: