Click here to Skip to main content
15,884,388 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionre: Highlight all the fields Pin
Member 1466767925-Nov-19 5:27
Member 1466767925-Nov-19 5:27 
AnswerRe: re: Highlight all the fields Pin
jkirkerx25-Nov-19 8:11
professionaljkirkerx25-Nov-19 8:11 
GeneralRe: re: Highlight all the fields Pin
Member 1466767925-Nov-19 11:30
Member 1466767925-Nov-19 11:30 
GeneralRe: re: Highlight all the fields Pin
Member 1466767925-Nov-19 13:02
Member 1466767925-Nov-19 13:02 
QuestionJavaScript Question that doesn't make since. Pin
Member 1466141319-Nov-19 12:07
Member 1466141319-Nov-19 12:07 
AnswerRe: JavaScript Question that doesn't make since. Pin
Afzaal Ahmad Zeeshan19-Nov-19 16:58
professionalAfzaal Ahmad Zeeshan19-Nov-19 16:58 
QuestionHow can I avoid the phenomenon of asynchronous code using promises and async/await? Pin
Simos Sigma17-Nov-19 2:38
Simos Sigma17-Nov-19 2:38 
AnswerRe: How can I avoid the phenomenon of asynchronous code using promises and async/await? Pin
Nathan Minier18-Nov-19 1:35
professionalNathan Minier18-Nov-19 1:35 
Promises really are not that hard. They basically allow you to dynamically attach callbacks to an object, which are execute when you designate within the promise function.

In your case it would look something like this:
JavaScript
function init()
{
   themeManager.init();

   $(document).ready(function()
   {
      //create out promise object and embed functionality in it.
      //using an anonymous function; if a regular function go ahead and make a method instead 
      //note that we're naming arguments "resolve" and "reject". Important later.
      var promise = new Promise((resolve, reject) => {
         //your code(ish)
         try {
            var chosenFunction = 'checkDocumentsLength()';
        csInterface.evalScript(chosenFunction, function(result)
        {
               //this is the "return" function as defined above when the anon func was declared
           resolve(result < 1); 
        });
         } catch(ex) {
            //something went wrong, handle it here or inform the calling object with reject
            reject(ex); 
         } finally {
            csInterface.closeExtension();
         }
      }

      //below are our "callback" functions for when the promise completes 
      //handle "resolve" case
      promise.then(function(value){
         if(!value){
            alert('There is no opened document!!!');
         }
      });
      //handle "reject" case
      promise.catch(function(error){
         console.error('checkPSDocument error: ' + error);
      });
   });
}
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor

AnswerRe: How can I avoid the phenomenon of asynchronous code using promises and async/await? Pin
Richard Deeming18-Nov-19 7:47
mveRichard Deeming18-Nov-19 7:47 
Questionclient's windows login name Pin
kishor kumar S H16-Nov-19 23:47
kishor kumar S H16-Nov-19 23:47 
AnswerRe: client's windows login name Pin
Eddy Vluggen17-Nov-19 0:41
professionalEddy Vluggen17-Nov-19 0:41 
AnswerRe: client's windows login name Pin
Nathan Minier18-Nov-19 1:40
professionalNathan Minier18-Nov-19 1:40 
GeneralRe: client's windows login name Pin
kishor kumar S H18-Nov-19 21:49
kishor kumar S H18-Nov-19 21:49 
GeneralRe: client's windows login name Pin
Nathan Minier19-Nov-19 0:45
professionalNathan Minier19-Nov-19 0:45 
GeneralRe: client's windows login name Pin
kishor kumar S H23-Nov-19 17:54
kishor kumar S H23-Nov-19 17:54 
Question!!Please Help!! Student Needs Help It Shows me exercise 2 is correct but exercise 1 is not defined JS assign 3 and 13 Pin
Member 1465076510-Nov-19 11:20
Member 1465076510-Nov-19 11:20 
AnswerRe: !!Please Help!! Student Needs Help It Shows me exercise 2 is correct but exercise 1 is not defined JS assign 3 and 13 Pin
Richard MacCutchan10-Nov-19 22:23
mveRichard MacCutchan10-Nov-19 22:23 
QuestionGetting this following error: compare.js:1 Uncaught Error: Cannot find module 'ember' Pin
simpledeveloper5-Nov-19 9:26
simpledeveloper5-Nov-19 9:26 
SuggestionRe: Getting this following error: compare.js:1 Uncaught Error: Cannot find module 'ember' Pin
jkirkerx5-Nov-19 11:47
professionaljkirkerx5-Nov-19 11:47 
GeneralRe: Getting this following error: compare.js:1 Uncaught Error: Cannot find module 'ember' Pin
simpledeveloper5-Nov-19 12:14
simpledeveloper5-Nov-19 12:14 
QuestionLoading of a td value using another td value in Ember hbs file Pin
simpledeveloper4-Nov-19 11:32
simpledeveloper4-Nov-19 11:32 
GeneralRe: Loading of a td value using another td value in Ember hbs file Pin
jkirkerx5-Nov-19 12:06
professionaljkirkerx5-Nov-19 12:06 
GeneralRe: Loading of a td value using another td value in Ember hbs file Pin
simpledeveloper5-Nov-19 12:09
simpledeveloper5-Nov-19 12:09 
Questionweb development Pin
Member 142901874-Nov-19 2:14
Member 142901874-Nov-19 2:14 
AnswerRe: web development Pin
phil.o4-Nov-19 2:18
professionalphil.o4-Nov-19 2:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.