このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。
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 オブジェクトを生成します。
In this article
構文
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> |