Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d59d442

Browse files
committedFeb 3, 2024
Improve Closure::into_js_value() docs
1 parent c1166ab commit d59d442

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed
 

‎src/closure.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,12 @@ where
356356
/// lifetime dynamically managed by the JS GC. This function can be used
357357
/// to drop this `Closure` while keeping the associated JS function still
358358
/// valid.
359-
///
360-
/// By default this function will leak memory. This can be dangerous if this
361-
/// function is called many times in an application because the memory leak
362-
/// will overwhelm the page quickly and crash the wasm.
363-
///
364-
/// If the browser, however, supports weak references, then this function
365-
/// will not leak memory. Instead the Rust memory will be reclaimed when the
366-
/// JS closure is GC'd.
359+
///
360+
/// If the platform supports weak references, the Rust memory will be
361+
/// reclaimed when the JS closure is GC'd. If weak references is not
362+
/// supported, this can be dangerous if this function is called many times
363+
/// in an application because the memory leak will overwhelm the page
364+
/// quickly and crash the wasm.
367365
pub fn into_js_value(self) -> JsValue {
368366
let idx = self.js.idx;
369367
mem::forget(self);

0 commit comments

Comments
 (0)
Please sign in to comment.