Skip to content

Commit f1c840f

Browse files
authored
Add bindings for queueMicrotask (#3981)
1 parent c108c75 commit f1c840f

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
* Add bindings for `VisualViewport`.
3131
[#3931](https://github.com/rustwasm/wasm-bindgen/pull/3931)
3232

33+
* Add bindings for `queueMicrotask`.
34+
[#3981](https://github.com/rustwasm/wasm-bindgen/pull/3981)
35+
3336
### Changed
3437

3538
* Stabilize Web Share API.

crates/web-sys/src/features/gen_Window.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,6 +3001,13 @@ extern "C" {
30013001
input: &str,
30023002
init: &RequestInit,
30033003
) -> ::js_sys::Promise;
3004+
# [wasm_bindgen (method , structural , js_class = "Window" , js_name = queueMicrotask)]
3005+
#[doc = "The `queueMicrotask()` method."]
3006+
#[doc = ""]
3007+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/queueMicrotask)"]
3008+
#[doc = ""]
3009+
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
3010+
pub fn queue_microtask(this: &Window, callback: &::js_sys::Function);
30043011
# [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = setInterval)]
30053012
#[doc = "The `setInterval()` method."]
30063013
#[doc = ""]

crates/web-sys/src/features/gen_WorkerGlobalScope.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,13 @@ extern "C" {
820820
input: &str,
821821
init: &RequestInit,
822822
) -> ::js_sys::Promise;
823+
# [wasm_bindgen (method , structural , js_class = "WorkerGlobalScope" , js_name = queueMicrotask)]
824+
#[doc = "The `queueMicrotask()` method."]
825+
#[doc = ""]
826+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/queueMicrotask)"]
827+
#[doc = ""]
828+
#[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"]
829+
pub fn queue_microtask(this: &WorkerGlobalScope, callback: &::js_sys::Function);
823830
# [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = setInterval)]
824831
#[doc = "The `setInterval()` method."]
825832
#[doc = ""]

crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@ partial interface mixin WindowOrWorkerGlobalScope {
6868
[Throws, Func="mozilla::dom::DOMPrefs::DOMCachesEnabled", SameObject]
6969
readonly attribute CacheStorage caches;
7070
};
71+
72+
// https://html.spec.whatwg.org/#microtask-queuing
73+
partial interface mixin WindowOrWorkerGlobalScope {
74+
undefined queueMicrotask(VoidFunction callback);
75+
};

0 commit comments

Comments
 (0)