Highlighted

JSX not running synchronously in CEP 9

Participant ,
Jul 29, 2020

Copy link to clipboard

Copied

From what I've read on a mac JSX should be executed syncrhonously.  Meaning that each function should run and the next should wait for the first to finish before it runs.

I have the following methods:

placementClick = 0;
setIndividualTemplate(xi, placementClick, 2);
placementClick++;
setIndividualTemplate(xi, placementClick, 3);

setIndividualTemplate opens a file and then it places it into another document.  It does a few things.

I need for the first setIndividualTemplate to complete and then for the next one to fire up after.  However this does not seem to be the case.

To test this I put an alert in setIndividualTemplate

alert('which: ' + placementClick);

the alert fires up 'which 0'

then 'which 1'

then it actually executes the commands in each method.  How can I make this wait for one to finish before the other one starts?  From my understanding I can't use promises.

Topics

Scripting

Views

63

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

JSX not running synchronously in CEP 9

Participant ,
Jul 29, 2020

Copy link to clipboard

Copied

From what I've read on a mac JSX should be executed syncrhonously.  Meaning that each function should run and the next should wait for the first to finish before it runs.

I have the following methods:

placementClick = 0;
setIndividualTemplate(xi, placementClick, 2);
placementClick++;
setIndividualTemplate(xi, placementClick, 3);

setIndividualTemplate opens a file and then it places it into another document.  It does a few things.

I need for the first setIndividualTemplate to complete and then for the next one to fire up after.  However this does not seem to be the case.

To test this I put an alert in setIndividualTemplate

alert('which: ' + placementClick);

the alert fires up 'which 0'

then 'which 1'

then it actually executes the commands in each method.  How can I make this wait for one to finish before the other one starts?  From my understanding I can't use promises.

Topics

Scripting

Views

64

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 29, 2020

Copy link to clipboard

Copied

Hi,

Could you please share the code the function named 

setIndividualTemplate

By seeing the code, it will be easy to figure it out which command is taking the time to execute.

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Jul 29, 2020

Copy link to clipboard

Copied

Hi thanks for responding. Does it matter what it does?
It opens and copies some info from the file. The point isn't how long it
takes since it's synchronous? Shouldn't it wait for the entire method to
finish before the other one fires up?
That's what I mean by does it matter. Whether it takes one second or two
minutes it should wait no?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jul 30, 2020

Copy link to clipboard

Copied

Yes that's correct what you are saying. It should work syncrhonously, But getting a code will help to debug and help you out and also we can confirm whethere we are also running into same problem or not. 

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
OhmsG LATEST
Participant ,
Aug 03, 2020

Copy link to clipboard

Copied

After digging into this some more.  It appears as if it doesn't run synchronously like the alerts come up back to back before the file opens but I think it does run synchronously.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...