Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
Doc: Adding guide on Timers#6825
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
doc/guides/timers-in-node.md Outdated
| setTimeout(myFunc, 1500); | ||
| ``` | ||
| The above function ```myFunc()``` will execute after approximately 1500 milliseconds (or 1.5 seconds) due to the call of ```setTimeout()```. |
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.
Inline code blocks should be surrounded single backticks
jasnell commented May 18, 2016
@nodejs/documentation |
ryanmurakami commented May 18, 2016
@Fishrock123 Thanks for the feedback! I've fixed it. |
doc/guides/timers-in-node.md Outdated
| `setImmediate()` allows you to execute code at the beginning of the next event loop cycle. This code will execute *before* any timers or IO operations. I like to think of this code execution as happening "right after this", meaning any code following the `setImmediate()` function call will execute before the `setImmediate()` function argument. Here's an example: | ||
| ```javascript |
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.
can be ```js
Fishrock123 commented May 18, 2016
I think we'd probably better with clearer heading names. I'll try to give this more review later this week. |
thefourtheye commented May 18, 2016
I see a lot of long lines. Can you wrap them at 80 chars please? |
ryanmurakami commented May 18, 2016
@thefourtheye done, thanks! |
doc/guides/timers-in-node.md Outdated
| The timeout interval that is set cannot be relied upon to execute after | ||
| that *exact* number of milliseconds. This is because executing code that | ||
| blocks or holds onto the event loop will push the execution of your timeout | ||
| back. You *can* guarantee that your timeout will not execute *sooner* than |
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.
timeout function will not execute?
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.
meaning, it won't execute sooner than the timeout, it will execute on or after the timeout.
thefourtheye commented May 18, 2016
I liked what I read. Thanks :-) |
doc/guides/timers-in-node.md Outdated
| Timers are a collection of global functions in node.js that allow you to | ||
| execute code after a set period of time. To fully understand when timer | ||
| functions will be executed, it's a good idea to read up on the the node |
jasnellMay 18, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
s/node/Node.js (here and everywhere else it's mentioned ;-) )
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.
ty
ryanmurakami commented Jun 29, 2016
@Fishrock123 Cool! So, I looked at revising that sentence, but I think the way Also, removed deja vu. Good point about it possibly being unfamiliar to readers. Thanks again for the feedback! |
| some major ways they differ. The first is that `process.nextTick()` will run | ||
| *before* any `Immediate`s that are set as well as before any scheduled I/O. | ||
| The second is that `process.nextTick()` is non-clearable, meaning once | ||
| code has been scheduled to execute with `process.nextTick()`, the execution |
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.
Perhaps...
Refer to [this guide][../topics/the-event-loop-timers-and-nexttick#processnexttick] to better understand the operation of `process.nextTick()`. 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.
sure, sounds good.
doc/guides/timers-in-node.md Outdated
| ## Controlling the Time Continuum with Node.js | ||
| The Node.js API provides several ways to of scheduling code to execute at |
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.
ways to schedule/ways of scheduling
thefourtheye commented Jun 30, 2016
LGTM - comments |
ryanmurakami commented Jun 30, 2016
@thefourtheye Thanks for your comments! Good catches! I've updated them and added a note on the differences with |
doc/guides/timers-in-node.md Outdated
| ### "When I say so" Execution ~ *`setTimeout()`* | ||
| `setTimeout()` can be used to schedule code execution after a designated | ||
| amount of milliseconds. This function is similar to `window.setTimeout()` |
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.
Link window.setTimeout() to https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout?
If you don't, I'll do it upon landing.
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.
Got it. Added.
Refs: nodejs/docs#76 PR-URL: #6825 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Fishrock123 commented Jul 1, 2016
Looks like there are some whitespace errors, could you please set Thanks though, squashed and landed in 1299c27 with some nits! |
Fishrock123 commented Jul 1, 2016
(Also, since I think this was your first PR to core, welcome! Hopefully the journey to get this in wasn't too much haha.) |
ryanmurakami commented Jul 1, 2016
@Fishrock123 Yay! Thanks for the welcome! Thanks for all your help, I really learned a ton. Looking forward to future contributions! |
Knighton910 commented Jul 1, 2016
Awesome work :) |
Refs: nodejs/docs#76 PR-URL: #6825 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
MylesBorins commented Jul 12, 2016
I've added the dont-land label for v4.x assuming that this is built on a more modern version of the timers api. Please let me know if this assumption is incorrect |
Checklist
Affected core subsystem(s)
doc
Description of change
Adding guide of using Timers in Node per nodejs/docs#76.