-
-
Notifications
You must be signed in to change notification settings - Fork 514
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
feat(ScriptAPI): timeout & interval #5454
base: nextgen
Are you sure you want to change the base?
Conversation
src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptAsyncApi.kt
Fixed
Show fixed
Hide fixed
src/main/kotlin/net/ccbluex/liquidbounce/script/bindings/api/ScriptAsyncApi.kt
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
Vouch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion this is a very bad API feature to provide. We are using JS in a game environment, where we have functions run over and over, where unlike in a browser environment we would actually need timeout to e.g. wait X seconds after a button was pressed.
Because we have update functions here, people would accidentally use this function without remembering the consequences, which are that when they start a timeout, on the next tick another timeout will start, essentially stacking multiple timeouts and the only solution to this is to add another if check of a lock variable.
add a sequence api? (like a sequence event handler) |
Note: body of
callback
will be always executed on the main thread (render thread).example:
Note: the Kotlin auto-generated
FunctionN
interfaces don't have@FunctionalInterface
annotation, so it can't be cast by Polyglot.