Skip to content

Commit

Permalink
Add bindings for queueMicrotask (#3981)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Jun 12, 2024
1 parent c108c75 commit f1c840f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
* Add bindings for `VisualViewport`.
[#3931](https://github.com/rustwasm/wasm-bindgen/pull/3931)

* Add bindings for `queueMicrotask`.
[#3981](https://github.com/rustwasm/wasm-bindgen/pull/3981)

### Changed

* Stabilize Web Share API.
Expand Down
7 changes: 7 additions & 0 deletions crates/web-sys/src/features/gen_Window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3001,6 +3001,13 @@ extern "C" {
input: &str,
init: &RequestInit,
) -> ::js_sys::Promise;
# [wasm_bindgen (method , structural , js_class = "Window" , js_name = queueMicrotask)]
#[doc = "The `queueMicrotask()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/queueMicrotask)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
pub fn queue_microtask(this: &Window, callback: &::js_sys::Function);
# [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = setInterval)]
#[doc = "The `setInterval()` method."]
#[doc = ""]
Expand Down
7 changes: 7 additions & 0 deletions crates/web-sys/src/features/gen_WorkerGlobalScope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,13 @@ extern "C" {
input: &str,
init: &RequestInit,
) -> ::js_sys::Promise;
# [wasm_bindgen (method , structural , js_class = "WorkerGlobalScope" , js_name = queueMicrotask)]
#[doc = "The `queueMicrotask()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/queueMicrotask)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `WorkerGlobalScope`*"]
pub fn queue_microtask(this: &WorkerGlobalScope, callback: &::js_sys::Function);
# [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = setInterval)]
#[doc = "The `setInterval()` method."]
#[doc = ""]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ partial interface mixin WindowOrWorkerGlobalScope {
[Throws, Func="mozilla::dom::DOMPrefs::DOMCachesEnabled", SameObject]
readonly attribute CacheStorage caches;
};

// https://html.spec.whatwg.org/#microtask-queuing
partial interface mixin WindowOrWorkerGlobalScope {
undefined queueMicrotask(VoidFunction callback);
};

0 comments on commit f1c840f

Please sign in to comment.