From e3011d629e2f2f03cfed5d0da27bd8a37b1490c4 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 9 Aug 2018 13:08:30 -0700 Subject: [PATCH] js-sys: Promise methods should take JS things by shared reference --- crates/futures/src/lib.rs | 2 +- crates/js-sys/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index 992bc4e1..41bdd4e3 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -54,7 +54,7 @@ //! pub fn new() -> NextTick { //! // Create a resolved promise that will run its callbacks on the next //! // tick of the micro task queue. -//! let promise = js_sys::Promise::resolve(JsValue::NULL); +//! let promise = js_sys::Promise::resolve(&JsValue::NULL); //! // Convert the promise into a `JsFuture`. //! let inner = JsFuture::from(promise); //! NextTick { inner } diff --git a/crates/js-sys/src/lib.rs b/crates/js-sys/src/lib.rs index 9452d0a8..25320c24 100644 --- a/crates/js-sys/src/lib.rs +++ b/crates/js-sys/src/lib.rs @@ -3109,7 +3109,7 @@ extern { /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all #[wasm_bindgen(static_method_of = Promise)] - pub fn all(obj: JsValue) -> Promise; + pub fn all(obj: &JsValue) -> Promise; /// The `Promise.race(iterable)` method returns a promise that resolves or /// rejects as soon as one of the promises in the iterable resolves or @@ -3117,14 +3117,14 @@ extern { /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race #[wasm_bindgen(static_method_of = Promise)] - pub fn race(obj: JsValue) -> Promise; + pub fn race(obj: &JsValue) -> Promise; /// The `Promise.reject(reason)` method returns a `Promise` object that is /// rejected with the given reason. /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject #[wasm_bindgen(static_method_of = Promise)] - pub fn reject(obj: JsValue) -> Promise; + pub fn reject(obj: &JsValue) -> Promise; /// The `Promise.resolve(value)` method returns a `Promise` object that is /// resolved with the given value. If the value is a promise, that promise @@ -3134,7 +3134,7 @@ extern { /// /// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve #[wasm_bindgen(static_method_of = Promise)] - pub fn resolve(obj: JsValue) -> Promise; + pub fn resolve(obj: &JsValue) -> Promise; /// The `catch()` method returns a `Promise` and deals with rejected cases /// only. It behaves the same as calling `Promise.prototype.then(undefined,