Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CEP panels

New Here ,
Jun 13, 2019 Jun 13, 2019

Hello there,

I am trying to send some data from JSX to JS, but the async operations are unreliable.

Screenshot 2019-06-13 at 12.05.13.png

I return from JSX a folder path and then I try to commit a mutation to vuex, but it works like a lottery...

I tried using promises with no result. I increased the timeout to 1000 but it also kinda doesn' work all the time.

805
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 13, 2019 Jun 13, 2019
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 14, 2019 Jun 14, 2019
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2019 Jun 14, 2019

In this case, You can use PlugPlugInterface.

You can reference below sample.

CreativeSuiteSDK_Experimentals/net.sytes.chuwa.callbacktest at master · ten-A/CreativeSuiteSDK_Exper...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 08, 2019 Jul 08, 2019
LATEST

First off, it is important to note that the evalScript function has some consistency issues when it comes to its classification as "asynchronous".

Second, why are you using $nextTick outside of the callback? Why not simply commit to the Vuex store in the evalScript completion callback?

chooseExportPath() {

     const cs = new CSInterface();

     // Call JSX for folder path

     cs.evalScript("choosePath()", (result) => {

          const exportPath = document.getElementById('pathExport');

          exportPath.value = result;

          this.$store.commit('setExportPath', result);

     });

}

Notes:

  1. Using the arrow function allows you to capture the "this" Vue instance from the calling context. No need to create a reference to it (vm) to maintain the context.
  2. With this approach you cannot set the value incorrectly by guessing at the timing as you only attempt to set the value when you know you have it.
  3. You probably don't need to use $nextTick at all. Vuex is supposed to handle the asynchronous updates of your state modifications anyway. Unless there's a specific reason to do so (which you wouldn't have mentioned...) then setting it directly as above is simple, straightforward, and easier to understand.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines