/* * Copyright (C)2005-2019 Haxe Foundation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ package js.lib; import haxe.Constraints.Function; import js.lib.Object; /** `Reflect` is a built-in object that provides methods for interceptable JavaScript operations. The methods are the same as those of [proxy handlers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler). Reflect is not a function object, so it's not constructible. Documentation [Reflect](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/). **/ @:native("Reflect") extern class Reflect { /** Calls a target function with arguments as specified by the args parameter. See also `Function.prototype.apply()`. */ static function apply(target:Function, thisArgument:{}, argumentsList:Array):T; /** The `new` operator as a function. Equivalent to calling `new target(...args)`. Provides also the optional possibility to specify a different prototype. */ static function construct(target:Class, argumentsList:Array, ?newTarget:Class):T; /** Similar to `Object.defineProperty()`. Returns a Bool. */ @:overload(function(target:{}, propertyKey:Symbol, attributes:ObjectPropertyDescriptor):Bool {}) static function defineProperty(target:{}, propertyKey:String, attributes:ObjectPropertyDescriptor):Bool; /** The `delete` operator as a function. Equivalent to calling `delete target[name]`. */ @:overload(function(target:Array, propertyKey:Int):Bool {}) @:overload(function(target:{}, propertyKey:Symbol):Bool {}) static function deleteProperty(target:{}, propertyKey:String):Bool; /** A function that returns the value of properties. */ @:overload(function(target:Array, propertyKey:Int, ?receiver:{}):Null {}) @:overload(function(target:{}, propertyKey:Symbol, ?receiver:{}):Null {}) @:pure static function get(target:{}, propertyKey:String, ?receiver:{}):Null; /** Similar to `Object.getOwnPropertyDescriptor()`. Returns a property descriptor of the given property if it exists on the object, `undefined` otherwise. */ @:overload(function(target:Array, propertyKey:Int):Null {}) @:overload(function(target:{}, propertyKey:Symbol):Null {}) @:pure static function getOwnPropertyDescriptor(target:{}, propertyKey:String):Null; /** Same as `Object.getPrototypeOf()`. */ @:pure static function getPrototypeOf(target:{}):Null; /** The `in` operator as function. Returns a boolean indicating whether an own or inherited property exists. */ @:overload(function(target:Array, propertyKey:Int):Bool {}) @:overload(function(target:{}, propertyKey:Symbol):Bool {}) @:pure static function has(target:{}, propertyKey:String):Bool; /** Same as `Object.isExtensible()`. */ @:pure static function isExtensible(target:{}):Bool; /** Returns an array of the target object's own (not inherited) property keys. */ @:pure static function ownKeys(target:{}):Array; /** Similar to `Object.preventExtensions()`. Returns a Bool. */ static function preventExtensions(obj:{}):Bool; /** A function that assigns values to properties. Returns a Bool that is true if the update was successful. */ @:overload(function(target:Array, propertyKey:Int, value:T, ?receiver:{}):Bool {}) @:overload(function(target:{}, propertyKey:Symbol, value:T, ?receiver:{}):Bool {}) static function set(target:{}, propertyKey:String, value:T, ?receiver:{}):Bool; /** A function that sets the prototype of an object. */ static function setPrototypeOf(target:{}, prototype:TProto):Bool; }