Symbol

js.lib.Symbol (extern class)

Static Members

iterator: Symbol

A method returning the default iterator for an object.


asyncIterator: Symbol

A method that returns the default AsyncIterator for an object.


for_(key: String): Symbol

Searches for existing symbols with the given key and returns it if found. Otherwise a new symbol gets created in the global symbol registry with this key.

Name Type
key String
Returns
Symbol

keyFor(sym: Symbol): Null<String>

Retrieves a shared symbol key from the global symbol registry for the given symbol.

Name Type
sym Symbol
Returns
Null<String>

Instance Members

toString(): String

Returns a string containing the description of the Symbol.

Returns
String

ofObject(object: AnonStruct): Null<ofObject.T>

Retrieve symbol from a given object.

NOTE: This is a Haxe-specific method that generates an object[symbol] expression.

Name Type
object AnonStruct
Returns
Null<ofObject.T>

new(?description: String): Void

To create a new primitive symbol, use new Symbol() with an optional string as its description.

NOTE: Unlike in plain JavaScript, new Symbol() syntax is used in Haxe. This generates a Symbol(...) expression as required by the JavaScript specification.

Name Type Default
description String (optional)