WeakRef() コンストラクター
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2021年4月.
* Some parts of this feature may have varying levels of support.
WeakRef() コンストラクターは、 WeakRef オブジェクトを生成します。
構文
js
new WeakRef(target)
引数
返値
指定されたターゲット地を参照する WeakRef オブジェクトです。
例外
例
>新しい WeakRef オブジェクトの生成
完全な例は中心となる WeakRef ページを参照してください。
js
class Counter {
constructor(element) {
// DOM 要素への弱い参照を覚える
this.ref = new WeakRef(element);
this.start();
}
}
仕様書
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-weak-ref-constructor> |
ブラウザーの互換性
Loading…