Click here to Skip to main content
15,499,723 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionre: Highlight all the fields Pin
Member 1466767925-Nov-19 6:27
MemberMember 1466767925-Nov-19 6:27 
AnswerRe: re: Highlight all the fields Pin
jkirkerx25-Nov-19 9:11
professionaljkirkerx25-Nov-19 9:11 
GeneralRe: re: Highlight all the fields Pin
Member 1466767925-Nov-19 12:30
MemberMember 1466767925-Nov-19 12:30 
GeneralRe: re: Highlight all the fields Pin
Member 1466767925-Nov-19 14:02
MemberMember 1466767925-Nov-19 14:02 
QuestionJavaScript Question that doesn't make since. Pin
Member 1466141319-Nov-19 13:07
MemberMember 1466141319-Nov-19 13:07 
AnswerRe: JavaScript Question that doesn't make since. Pin
Afzaal Ahmad Zeeshan19-Nov-19 17:58
mveAfzaal Ahmad Zeeshan19-Nov-19 17:58 
QuestionHow can I avoid the phenomenon of asynchronous code using promises and async/await? Pin
Simos Sigma17-Nov-19 3:38
MemberSimos Sigma17-Nov-19 3:38 
AnswerRe: How can I avoid the phenomenon of asynchronous code using promises and async/await? Pin
Nathan Minier18-Nov-19 2:35
professionalNathan Minier18-Nov-19 2: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 8:47
mveRichard Deeming18-Nov-19 8:47 
Questionclient's windows login name Pin
kishor kumar S H17-Nov-19 0:47
Memberkishor kumar S H17-Nov-19 0:47 
AnswerRe: client's windows login name Pin
Eddy Vluggen17-Nov-19 1:41
professionalEddy Vluggen17-Nov-19 1:41 
AnswerRe: client's windows login name Pin
Nathan Minier18-Nov-19 2:40
professionalNathan Minier18-Nov-19 2:40 
GeneralRe: client's windows login name Pin
kishor kumar S H18-Nov-19 22:49
Memberkishor kumar S H18-Nov-19 22:49 
GeneralRe: client's windows login name Pin
Nathan Minier19-Nov-19 1:45
professionalNathan Minier19-Nov-19 1:45 
GeneralRe: client's windows login name Pin
kishor kumar S H23-Nov-19 18:54
Memberkishor kumar S H23-Nov-19 18: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 12:20
MemberMember 1465076510-Nov-19 12: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 23:23
mveRichard MacCutchan10-Nov-19 23:23 
QuestionGetting this following error: compare.js:1 Uncaught Error: Cannot find module 'ember' Pin
simpledeveloper5-Nov-19 10:26
Membersimpledeveloper5-Nov-19 10:26 
SuggestionRe: Getting this following error: compare.js:1 Uncaught Error: Cannot find module 'ember' Pin
jkirkerx5-Nov-19 12:47
professionaljkirkerx5-Nov-19 12:47 
GeneralRe: Getting this following error: compare.js:1 Uncaught Error: Cannot find module 'ember' Pin
simpledeveloper5-Nov-19 13:14
Membersimpledeveloper5-Nov-19 13:14 
QuestionLoading of a td value using another td value in Ember hbs file Pin
simpledeveloper4-Nov-19 12:32
Membersimpledeveloper4-Nov-19 12:32 
GeneralRe: Loading of a td value using another td value in Ember hbs file Pin
jkirkerx5-Nov-19 13:06
professionaljkirkerx5-Nov-19 13:06 
GeneralRe: Loading of a td value using another td value in Ember hbs file Pin
simpledeveloper5-Nov-19 13:09
Membersimpledeveloper5-Nov-19 13:09 
Questionweb development Pin
Member 142901874-Nov-19 3:14
MemberMember 142901874-Nov-19 3:14 
AnswerRe: web development Pin
phil.o4-Nov-19 3:18
mvephil.o4-Nov-19 3: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.