E
egarcia
Guest
The JSDO library can use named events and jQuery-style Promises to handle asynchronous operations. Documentation: https://documentation.progress.com/output/pdo/index.html#page/pdo%2Fasynchronous-and-synchronous-execution.html The attached sample program shows how to use the JSDO library with native JavaScript Promises. The progress.jsdo.js library is used. Related link: https://github.com/CloudDataObject/JSDO/tree/master/lib http://caniuse.com/#search=Promises The zip file includes two version of the program: index.html : Sample program to use in a web browser. 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 Open index.html in a web browser that supports native JavaScript Promises. Using app.js Install the node-XMLHttpRequest package by running "npm install xmlhttprequest" Run app.js using a recent version of Node.js: node app.js Links: https://github.com/driverdan/node-XMLHttpRequest https://www.npmjs.com/package/xmlhttprequest
Continue reading...
Continue reading...