A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef/WeakRef below:

WeakRef() constructor - JavaScript | MDN

WeakRef() constructor

Baseline Widely available *

The WeakRef() constructor creates WeakRef objects.

Syntax

Note: WeakRef() can only be constructed with new. Attempting to call it without new throws a TypeError.

Parameters
target

The target value the WeakRef should refer to (also called the referent). Must be an object or a non-registered symbol.

Return value

A new WeakRef object referring to the given target value.

Exceptions
TypeError

Thrown if target is not an object or a non-registered symbol.

Examples Creating a new WeakRef object

See the main WeakRef page for a complete example.

class Counter {
  constructor(element) {
    // Remember a weak reference to a DOM element
    this.ref = new WeakRef(element);
    this.start();
  }
}
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4