Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm need polyfills for setTimeout (for non-block thread) and other, where I can find it? |
||||
|
Hi, setTimeout is technically not a part of JS specification. It's a part of window object, which is in its turn a part of browser. Or a part of node js api in case you're using node:) There is an action called "doLater" which you can download here. It's not exactly setTimeout, but it allows you to run the delayed action. https://www.ambiera.com/coppercube/download_extensions.html I believe, the exact implementation would be sort of specific, since you probably also would like to pass the node object as a part of delayed function context. Basically, I guess, the idea is to create a global object/array which will store all delayed function calls along with the time they should be executed. On calling setTimeout you add these to the array. Then you register onframe event which takes current time, goes through the array and checks which of the actions can be already executed, executes them, and removes from the array. For more polyfills you can check npm, which is a great source for any type of js code. For ex,: https://github.com/NeilFraser/JS-Polyfills I'll probably can check how this could be implemented tonight, in case you haven't find the answer by the time. |
||||
|
Ok, this seems to work: var timers = []; Setup example: https://drive.google.com/file/d/... Notice, that if you need to pass any data you should use args arguments for that - it should be an array. I also didn't test what will happen in case you're not providing it, so if it doesn't work just put empty array there. Usage example would be: var node = ccbGetCurrentNode(); |
||||
|
thank you for answer, i'm tried your code. |
|