[progress Communities] [progress Openedge Abl] Forum Post: Re: Jsdo With Nodejs

  • Thread starter Thread starter egarcia
  • Start date Start date
Status
Not open for further replies.
E

egarcia

Guest
Hello Kevin, The error that you are seeing is because an issue with the wrapper code and recent changes to the library. A call to promise.resolve() is performed before it is effectively assigned. We have researched this scenario and found that the jQuery Deferred package now available in NPM provides the implementation that we need. To use jquery-deferred, you can do the following: - Install package jquery-deferred: npm install jquery-deferred - Add code to allow usage of jquery-deferred as the Promise implementation. Your code in the app.js program in the sample would look like the following: /*global XMLHttpRequest: true, btoa: true, $: true, localStorage: true, sessionStorage: true */ XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest; btoa = require("base-64").encode; var jQuery = require("jquery-deferred"); $ = function() { }; $.Deferred = jQuery.Deferred; var module = require("node-localstorage"), LocalStorage = module.LocalStorage; localStorage = new LocalStorage('./scratch1'); sessionStorage = new LocalStorage('./scratch2'); require("./progress.jsdo.js"); require("./index.js"); We are looking into using ES6 Promises in a future release of the JSDO. Considering that you are doing BASIC authentication, it looks like you have already added the code for btoa(). Just in case, the code above shows how to use the base-64 package as the implementation for it. The sample above also shows the usage of node-localstorage as the implementation for localStorage and sessionStorage. You would need this with the latest version of the JSDO library 4.4.1: https://github.com/CloudDataObject/JSDO . Please let me know if you have comments or questions. Thank you and regards, Edsel P.S.: The sample code above uses global to indicate the global symbols when using ESLint to validate your JavaScript code. Here is a link to a sample configuration for ESLint: https://community.progress.com/community_groups/openedge_kendo_ui_builder/w/openedgekendouibuilder/2936.how-to-enable-validation-of-javascript-code-for-a-kendo-ui-builder-app-using-visual-studio-code For Node.js, you would just add "node": true to "env" in the .eslintrc.json.

Continue reading...
 
Status
Not open for further replies.
Back
Top