From: Elias Fleckenstein Date: Fri, 6 Aug 2021 18:36:08 +0000 (+0200) Subject: Fix mistake in setImmediate documentation X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=fc5751ef0f25d408cd5c785a7b0d56bfd563e97a;p=lua_async.git Fix mistake in setImmediate documentation --- diff --git a/README.md b/README.md index 6c1218a..75a7d28 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ This function takes an ID of an existing interval and removes it, meaning it wil Immediates are processed every step after timeouts and intervals have been processed. An immediated is executed only once. #### `id = setImmediate(callback, [...])` -Registers a new interval that will execute once in the current or the next step, depending on when it is registered. If an immediate is registered while immediates are processing, it will be executed in the next step. However, if an interval is registered by a timeout or interval callback, the immediate _will_ process in the same step in which it was registered. `...` are the arguments passed to the `callback` function that is called when the immediate executes. `setImmediate` returns an unique numeric immediate ID that can be passed to `clearImmediate`. If `callback` is not a function, an error is raised when the immediate is executed. +Registers a new immediate that will execute once in the current or the next step, depending on when it is registered. If an immediate is registered while immediates are processing, it will be executed in the next step. However, if an immediate is registered by a timeout or interval callback, the immediate _will_ process in the same step in which it was registered. `...` are the arguments passed to the `callback` function that is called when the immediate executes. `setImmediate` returns an unique numeric immediate ID that can be passed to `clearImmediate`. If `callback` is not a function, an error is raised when the immediate is executed. #### `clearImmediate(id)` This function takes an ID of an existing immediate and cancels it, meaning it will not execute. If `id` is not numeric, not a valid immediate id or the associated immediate has already executed or been cleared, `clearImmediate` does nothing. `id` may however not be `nil`. `clearImmediate` may be called on any immediate at any time, if immediates are currently processing the cleared immediate is removed from the list of immediates to process.