question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to implement delay function in V8 mode?

See original GitHub issue

delay is different from sleep , delay will not block js ui thread but only stop a while and prevent processing the next line of code. It is possible to execute js or get callback when delaying. Is there any api to hangup v8 to implement delay function in V8 mode?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
goldenduocommented, Nov 12, 2022

I’ve found sth.Thanks.

v8ValuePromiseResolver = getEventLoop().getV8Runtime().createV8ValuePromise();
if (recurrent) {
    timerId = getEventLoop().getVertx().setPeriodic(delay, id -> {
        if (!isClosed()) {
            if (resolve) {
                try {
                    v8ValuePromiseResolver.resolve(v8ValueResult);
                } catch (Throwable t) {
                    getLogger().logError(t, "Failed to resolve the promise.");
                }
            } else {
                try {
                    v8ValuePromiseResolver.reject(v8ValueResult);
                } catch (Throwable t) {
                    getLogger().logError(t, "Failed to reject the promise.");
                }
            }
        }
    });
1reaction
caoccaocommented, Nov 12, 2022

That question belongs to TC39, I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I wait In Node.js (JavaScript)? l need to pause for a ...
node --experimental-repl-await > const delay = ms => new Promise(resolve ... Best way to do this is to break your code into multiple...
Read more >
Interrupt Delay Using Callback Function in MCC
Using the callback function generated in the TMR4 driver code simplifies creating interrupt delays. It reduces the ISR in your main code to...
Read more >
Delay in Program Start PIC16F1847 Checked with MPLab IDE ...
I have check the program with MPLAB IDE v8.92 and Mikroc C v6.0 I am trying to make simple Counter using MAX7219 and...
Read more >
How to add time delay in Python? - GeeksforGeeks
Method 1: Using time.sleep() function. Approach: Import the time module; For adding time delay during execution we use the sleep() function ...
Read more >
Adding a Wait Step
If you configure Siebel CRM to use SetFieldValue to start a workflow process, then it is recommended that you set the Processing Mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found