Reflect
is a built-in object that provides methods for interceptable JavaScript operations.
The methods are the same as those of proxy handlers.
Reflect is not a function object, so it's not constructible.
Documentation Reflect by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Static methods
staticapply<T>(target:Function, thisArgument:{}, argumentsList:Array<Any>):T
Calls a target function with arguments as specified by the args parameter.
See also Function.prototype.apply()
.
staticconstruct<T, S>(target:Class<T>, argumentsList:Array<Any>, ?newTarget:Class<S>):T
The new
operator as a function. Equivalent to calling new target(...args)
.
Provides also the optional possibility to specify a different prototype.
staticdefineProperty(target:{}, propertyKey:String, attributes:ObjectPropertyDescriptor):Bool
Similar to Object.defineProperty()
. Returns a Bool.
staticdeleteProperty(target:{}, propertyKey:String):Bool
staticdeleteProperty<T>(target:Array<T>, propertyKey:Int):Bool
The delete
operator as a function. Equivalent to calling delete target[name]
.
staticget<T>(target:{}, propertyKey:String, ?receiver:{}):Null<T>
staticget<T>(target:Array<T>, propertyKey:Int, ?receiver:{}):Null<T>
A function that returns the value of properties.
staticgetOwnPropertyDescriptor(target:{}, propertyKey:String):Null<ObjectPropertyDescriptor>
Similar to Object.getOwnPropertyDescriptor()
.
Returns a property descriptor of the given property if it exists on the object,
undefined
otherwise.
statichas(target:{}, propertyKey:String):Bool
The in
operator as function. Returns a boolean indicating whether an own
or inherited property exists.
staticownKeys(target:{}):Array<String>
Returns an array of the target object's own (not inherited) property keys.
staticset<T>(target:{}, propertyKey:String, value:T, ?receiver:{}):Bool
staticset<T>(target:Array<T>, propertyKey:Int, value:T, ?receiver:{}):Bool
A function that assigns values to properties. Returns a Bool that is true if the update was successful.
staticsetPrototypeOf<TProto>(target:{}, prototype:TProto):Bool
A function that sets the prototype of an object.