28.1 The Reflect Object
The Reflect object:
- is%Reflect%.
- is the initial value of the"Reflect" property of theglobal object.
- is anordinary object.
- has a[[Prototype]] internal slot whose value is%Object.prototype%.
- is not afunction object.
- does not have a[[Construct]] internal method; it cannot be used as aconstructor with the
new
operator. - does not have a[[Call]] internal method; it cannot be invoked as a function.
28.1.1 Reflect.apply (target,thisArgument,argumentsList )
This function performs the following steps when called:
- IfIsCallable(target) isfalse, throw aTypeError exception.
- Letargs be ? CreateListFromArrayLike(argumentsList).
- PerformPrepareForTailCall().
- Return ? Call(target,thisArgument,args).
28.1.2 Reflect.construct (target,argumentsList [ ,newTarget ] )
This function performs the following steps when called:
- IfIsConstructor(target) isfalse, throw aTypeError exception.
- IfnewTarget is not present, setnewTarget totarget.
- Else ifIsConstructor(newTarget) isfalse, throw aTypeError exception.
- Letargs be ? CreateListFromArrayLike(argumentsList).
- Return ? Construct(target,args,newTarget).
28.1.3 Reflect.defineProperty (target,propertyKey,attributes )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkey be ? ToPropertyKey(propertyKey).
- Letdesc be ? ToPropertyDescriptor(attributes).
- Return ? target.[[DefineOwnProperty]](key,desc).
28.1.4 Reflect.deleteProperty (target,propertyKey )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkey be ? ToPropertyKey(propertyKey).
- Return ? target.[[Delete]](key).
28.1.5 Reflect.get (target,propertyKey [ ,receiver ] )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkey be ? ToPropertyKey(propertyKey).
- Ifreceiver is not present, then
- Setreceiver totarget.
- Return ? target.[[Get]](key,receiver).
28.1.6 Reflect.getOwnPropertyDescriptor (target,propertyKey )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkey be ? ToPropertyKey(propertyKey).
- Letdesc be ? target.[[GetOwnProperty]](key).
- ReturnFromPropertyDescriptor(desc).
28.1.7 Reflect.getPrototypeOf (target )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Return ? target.[[GetPrototypeOf]]().
28.1.8 Reflect.has (target,propertyKey )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkey be ? ToPropertyKey(propertyKey).
- Return ? target.[[HasProperty]](key).
28.1.9 Reflect.isExtensible (target )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Return ? target.[[IsExtensible]]().
28.1.10 Reflect.ownKeys (target )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkeys be ? target.[[OwnPropertyKeys]]().
- ReturnCreateArrayFromList(keys).
28.1.11 Reflect.preventExtensions (target )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Return ? target.[[PreventExtensions]]().
28.1.12 Reflect.set (target,propertyKey,V [ ,receiver ] )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Letkey be ? ToPropertyKey(propertyKey).
- Ifreceiver is not present, then
- Setreceiver totarget.
- Return ? target.[[Set]](key,V,receiver).
28.1.13 Reflect.setPrototypeOf (target,proto )
This function performs the following steps when called:
- Iftargetis not an Object, throw aTypeError exception.
- Ifprotois not an Object andproto is notnull, throw aTypeError exception.
- Return ? target.[[SetPrototypeOf]](proto).
28.1.14 Reflect [ %Symbol.toStringTag% ]
The initial value of the%Symbol.toStringTag% property is the String value"Reflect".
This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:true }.
28.3 Module Namespace Objects
A Module Namespace Object is amodule namespace exotic object that provides runtime property-based access to a module's exported bindings. There is noconstructor function for Module Namespace Objects. Instead, such an object is created for each module that is imported by anImportDeclaration that contains aNameSpaceImport.
In addition to the properties specified in10.4.6 each Module Namespace Object has the following own property:
28.3.1 %Symbol.toStringTag%
The initial value of the%Symbol.toStringTag% property is the String value"Module".
This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:false }.