Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to run button js code synchronously #422

Open
3 tasks done
ujikol opened this issue Sep 27, 2024 · 1 comment
Open
3 tasks done

Possibility to run button js code synchronously #422

ujikol opened this issue Sep 27, 2024 · 1 comment
Labels
feature request New feature or request

Comments

@ujikol
Copy link

ujikol commented Sep 27, 2024

Please fill out these Check-boxes

  • I checked for existing similar feature requests
  • I have read the docs and checked that the feature I am requesting is not already implemented
  • My feature request consists of only one feature

Is your Feature Request related to a Problem or Annoyance?

functions called in the inlineJS code of a button always run asynchronously even when called await. I guess that the whole code is called asynchronously.
I need to run a code which runs for quite a few seconds, which changes the content of the editor (among others the text of the button). So during execution the user needs to be prevented from changing the editor or its content.

Describe the Feature you'd like

Option 1: Always run the code synchronously. The user code can make detach anyway.
Option 2: Add flag to the button arguments
Option 3: Create different action types inlineJs vs. inlineJsSync

Alternatives

No response

Additional Context

No response

@ujikol ujikol added the feature request New feature or request label Sep 27, 2024
@mProjectsCode
Copy link
Owner

I guess that the whole code is called asynchronously.

Yes, since the entry point is an onclick hander, which is always queued as an async task.

If your code is sync, there should be no difference between running it in an async context or a sync one, as your code will be one big sync block and it will be executed by the JS Engine (not the plugin, but Chromium or Safari on iOS) as such.
If your code is async, there is no way to run it "sync".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants