Skip to content

Commit 179df68

Browse files
committed
Add bindings for queueMicrotask (rustwasm#3981)
1 parent 7a661bd commit 179df68

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
@@ -8,6 +8,9 @@
88
* Implement `From<NonNull<T>>` for `JsValue`.
99
[#3877](https://github.com/rustwasm/wasm-bindgen/pull/3877)
1010

11+
* Add bindings for `queueMicrotask`.
12+
[#3981](https://github.com/rustwasm/wasm-bindgen/pull/3981)
13+
1114
### Changed
1215

1316
* Generate JS bindings for WebIDL dictionary setters instead of using `Reflect`. This increases the size of the Web API bindings but should be more performant. Also, importing getters/setters from JS now supports specifying the JS attribute name as a string, e.g. `#[wasm_bindgen(method, setter = "x-cdm-codecs")]`.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,6 +2993,13 @@ extern "C" {
29932993
input: &str,
29942994
init: &RequestInit,
29952995
) -> ::js_sys::Promise;
2996+
# [wasm_bindgen (method , structural , js_class = "Window" , js_name = queueMicrotask)]
2997+
#[doc = "The `queueMicrotask()` method."]
2998+
#[doc = ""]
2999+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/queueMicrotask)"]
3000+
#[doc = ""]
3001+
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
3002+
pub fn queue_microtask(this: &Window, callback: &::js_sys::Function);
29963003
# [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = setInterval)]
29973004
#[doc = "The `setInterval()` method."]
29983005
#[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)