Add Microtasks (#19860)

* Add Microtasks

* Add Microtasks
This commit is contained in:
Juan Carlos 2022-06-04 02:03:25 -03:00 • committed by GitHub
commit d0232f0e5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -50,7 +50,7 @@ becomes an alias for `addr`.
- Removed deprecated `std/dom_extensions`. - Removed deprecated `std/dom_extensions`.
- Removed deprecated `std/posix.CMSG_SPACE` and `std/posix.CMSG_LEN` that takes wrong argument types. - Removed deprecated `std/posix.CMSG_SPACE` and `std/posix.CMSG_LEN` that takes wrong argument types.
- Remove deprecated `osproc.poDemon`, symbol with typo. - Remove deprecated `osproc.poDemon`, symbol with typo.
- Added [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) for JavaScript targets.
- Deprecated `selfExe` for Nimscript. - Deprecated `selfExe` for Nimscript.

View file

@ -132,3 +132,8 @@ since (1, 7):
var arrai = @[1, 2, 3] var arrai = @[1, 2, 3]
assert arrai.shift() == 1 assert arrai.shift() == 1
assert arrai == @[2, 3] assert arrai == @[2, 3]
func queueMicrotask*(function: proc) {.importjs: "$1(#)".} =
## * https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
## * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide
runnableExamples: queueMicrotask(proc() = echo "Microtask")