Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,54 @@
/*
* 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;
@:native("ArrayBuffer")
extern class ArrayBuffer {
static function isView(value:Dynamic):Bool;
final byteLength:Int;
/** @throws DOMError */
function new(length:Int):Void;
function slice(begin:Int, ?end:Int):ArrayBuffer;
}
#if (js_es <= 5)
@:ifFeature('js.lib.ArrayBuffer.slice')
private class ArrayBufferCompat {
static function sliceImpl(begin, ?end) {
var u = new js.lib.Uint8Array(js.Lib.nativeThis, begin, end == null ? null : (end - begin));
var resultArray = new js.lib.Uint8Array(u.byteLength);
resultArray.set(u);
return resultArray.buffer;
}
static function __init__():Void
untyped {
// IE10 ArrayBuffer.slice polyfill
if (js.Syntax.code("ArrayBuffer").prototype.slice == null)
js.Syntax.code("ArrayBuffer").prototype.slice = sliceImpl;
}
}
#end

View File

@ -0,0 +1,36 @@
/*
* 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;
/**
`ArrayBufferView` is a helper type representing any of the following JavaScript `TypedArray` types:
Documentation [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
@see <https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView>
**/
extern interface ArrayBufferView {
final buffer:ArrayBuffer;
final byteOffset:Int;
final byteLength:Int;
}

View File

@ -0,0 +1,42 @@
/*
* 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.extern.EitherType;
/**
`BufferSource` is a typedef used to represent objects that are either themselves an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer),
or which are a [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) providing an [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView).
This is a helper type to simplify the specification. It isn't an interface and there are no objects implementing it.
Documentation [BufferSource](https://developer.mozilla.org/en-US/docs/Web/API/BufferSource) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/BufferSource$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
@see <https://developer.mozilla.org/en-US/docs/Web/API/BufferSource>
*/
@:forward
abstract BufferSource(ArrayBuffer) to ArrayBuffer from ArrayBuffer {
@:from public static inline function fromBufferView(view:ArrayBufferView) {
return cast view.buffer;
}
}

View File

@ -0,0 +1,58 @@
/*
* 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;
@:native("DataView")
extern class DataView implements ArrayBufferView {
final buffer:ArrayBuffer;
final byteOffset:Int;
final byteLength:Int;
/** @throws DOMError */
function new(buffer:ArrayBuffer, ?byteOffset:Int, ?byteLength:Int):Void;
@:pure
function getInt8(byteOffset:Int):Int;
@:pure
function getUint8(byteOffset:Int):Int;
@:pure
function getInt16(byteOffset:Int, ?littleEndian:Bool):Int;
@:pure
function getUint16(byteOffset:Int, ?littleEndian:Bool):Int;
@:pure
function getInt32(byteOffset:Int, ?littleEndian:Bool):Int;
@:pure
function getUint32(byteOffset:Int, ?littleEndian:Bool):Int;
@:pure
function getFloat32(byteOffset:Int, ?littleEndian:Bool):Float;
@:pure
function getFloat64(byteOffset:Int, ?littleEndian:Bool):Float;
function setInt8(byteOffset:Int, value:Int):Void;
function setUint8(byteOffset:Int, value:Int):Void;
function setInt16(byteOffset:Int, value:Int, ?littleEndian:Bool):Void;
function setUint16(byteOffset:Int, value:Int, ?littleEndian:Bool):Void;
function setInt32(byteOffset:Int, value:Int, ?littleEndian:Bool):Void;
function setUint32(byteOffset:Int, value:Int, ?littleEndian:Bool):Void;
function setFloat32(byteOffset:Int, value:Float, ?littleEndian:Bool):Void;
function setFloat64(byteOffset:Int, value:Float, ?littleEndian:Bool):Void;
}

View File

@ -0,0 +1,288 @@
/*
* 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 Date in HaxeDate;
/**
Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January 1970 UTC.
**/
@:native("Date")
extern class Date {
@:overload(function(value:Float):Void {})
@:overload(function(dateString:String):Void {})
@:overload(function(year:Int, month:Int, ?day:Int, ?hours:Int, ?minutes:Int, ?seconds:Int, ?milliseconds:Int):Void {})
function new():Void;
/**
Cast Haxe's Date to js.lib.Date.
**/
static public inline function fromHaxeDate(date:HaxeDate):js.lib.Date {
return cast date;
}
/**
Cast js.lib.Date to Haxe's Date.
**/
static public inline function toHaxeDate(date:Date):HaxeDate {
return cast date;
}
/**
Returns the numeric value corresponding to the current time - the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC, with leap seconds ignored
**/
static function now():Float;
/**
Parses a string representation of a date and returns the number of milliseconds since 1 January, 1970, 00:00:00, UTC, with leap seconds ignored.
**/
static function parse(str:String):Float;
/**
Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC, with leap seconds ignored.
**/
static function UTC(year:Int, month:Int, ?day:Int, ?hours:Int, ?minutes:Int, ?seconds:Int, ?milliseconds:Int):Float;
/**
Returns the day of the month (1-31) for the specified date according to local time.
**/
function getDate():Int;
/**
Returns the day of the week (0-6) for the specified date according to local time.
**/
function getDay():Int;
/**
Returns the year (4 digits for 4-digit years) of the specified date according to local time.
**/
function getFullYear():Int;
/**
Returns the hour (0-23) in the specified date according to local time.
**/
function getHours():Int;
/**
Returns the milliseconds (0-999) in the specified date according to local time.
**/
function getMilliseconds():Int;
/**
Returns the minutes (0-59) in the specified date according to local time.
**/
function getMinutes():Int;
/**
Returns the month (0-11) in the specified date according to local time.
**/
function getMonth():Int;
/**
Returns the seconds (0-59) in the specified date according to local time.
**/
function getSeconds():Int;
/**
Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC (negative for prior times).
**/
function getTime():Float;
/**
Returns the time-zone offset in minutes for the current locale.
**/
function getTimezoneOffset():Int;
/**
Returns the day (date) of the month (1-31) in the specified date according to universal time.
**/
function getUTCDate():Int;
/**
Returns the day of the week (0-6) in the specified date according to universal time.
**/
function getUTCDay():Int;
/**
Returns the year (4 digits for 4-digit years) in the specified date according to universal time.
**/
function getUTCFullYear():Int;
/**
Returns the hours (0-23) in the specified date according to universal time.
**/
function getUTCHours():Int;
/**
Returns the milliseconds (0-999) in the specified date according to universal time.
**/
function getUTCMilliseconds():Int;
/**
Returns the minutes (0-59) in the specified date according to universal time.
**/
function getUTCMinutes():Int;
/**
Returns the month (0-11) in the specified date according to universal time.
**/
function getUTCMonth():Int;
/**
Returns the seconds (0-59) in the specified date according to universal time.
**/
function getUTCSeconds():Int;
/**
Sets the day of the month for a specified date according to local time.
**/
function setDate(value:Int):Void;
/**
Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to local time.
**/
function setFullYear(value:Int):Void;
/**
Sets the hours for a specified date according to local time.
**/
function setHours(value:Int):Void;
/**
Sets the milliseconds for a specified date according to local time.
**/
function setMilliseconds(value:Int):Void;
/**
Sets the minutes for a specified date according to local time.
**/
function setMinutes(value:Int):Void;
/**
Sets the month for a specified date according to local time.
**/
function setMonth(value:Int):Void;
/**
Sets the seconds for a specified date according to local time.
**/
function setSeconds(value:Int):Void;
/**
Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC, allowing for negative numbers for times prior.
**/
function setTime(value:Float):Void;
/**
Sets the day of the month for a specified date according to universal time.
**/
function setUTCDate(value:Int):Void;
/**
Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to universal time.
**/
function setUTCFullYear(value:Int):Void;
/**
Sets the hour for a specified date according to universal time.
**/
function setUTCHours(value:Int):Void;
/**
Sets the milliseconds for a specified date according to universal time.
**/
function setUTCMilliseconds(value:Int):Void;
/**
Sets the minutes for a specified date according to universal time.
**/
function setUTCMinutes(value:Int):Void;
/**
Sets the month for a specified date according to universal time.
**/
function setUTCMonth(value:Int):Void;
/**
Sets the seconds for a specified date according to universal time.
**/
function setUTCSeconds(value:Int):Void;
/**
Returns the "date" portion of the Date as a human-readable string.
**/
function toDateString():String;
/**
Converts a date to a string following the ISO 8601 Extended Format.
**/
function toISOString():String;
/**
Returns a string representing the Date using toISOString(). Intended for use by JSON.stringify().
**/
function toJSON():String;
/**
Returns a string with a locality sensitive representation of the date portion of this date based on system settings.
**/
@:overload(function(?locales:Array<String>, ?options:Dynamic<Dynamic>):String {})
function toLocaleDateString(?locales:String, ?options:Dynamic<Dynamic>):String;
/**
Converts a date to a string, using a format string.
**/
function toLocaleFormat(format:String):String;
/**
Returns a string with a locality sensitive representation of this date. Overrides the Object.prototype.toLocaleString() method.
**/
@:overload(function(?locales:Array<String>, ?options:Dynamic<Dynamic>):String {})
function toLocaleString(?locales:String, ?options:Dynamic<Dynamic>):String;
/**
Returns a string with a locality sensitive representation of the time portion of this date based on system settings.
**/
@:overload(function(?locales:Array<String>, ?options:Dynamic<Dynamic>):String {})
function toLocaleTimeString(?locales:String, ?options:Dynamic<Dynamic>):String;
/**
Returns a string representing the source for an equivalent Date object; you can use this value to create a new object. Overrides the Object.prototype.toSource() method.
**/
function toSource():String;
/**
Returns a string representing the specified Date object. Overrides the Object.prototype.toString() method.
**/
function toString():String;
/**
Returns the "time" portion of the Date as a human-readable string.
**/
function toTimeString():String;
/**
Converts a date to a string using the UTC timezone.
**/
function toUTCString():String;
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (C)2005-2018 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;
@:native("Error")
extern class Error {
var message:String;
var name:String;
var stack(default, null):String;
function new(?message:String):Void;
}
@:native("EvalError")
extern class EvalError extends Error {
function new(?message:String):Void;
}
@:native("RangeError")
extern class RangeError extends Error {
function new(?message:String):Void;
}
@:native("ReferenceError")
extern class ReferenceError extends Error {
function new(?message:String):Void;
}
@:native("SyntaxError")
extern class SyntaxError extends Error {
function new(?message:String):Void;
}
@:native("TypeError")
extern class TypeError extends Error {
function new(?message:String):Void;
}
@:native("URIError")
extern class URIError extends Error {
function new(?message:String):Void;
}

View File

@ -0,0 +1,266 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Float32Array` typed array represents an array of 32-bit floating point numbers
(corresponding to the C float data type) in the platform byte order. If control over byte order is
needed, use `DataView` instead. The contents are initialized to `0`. Once established, you can
reference elements in the array using the object's methods, or using standard array index
syntax (that is, using bracket notation)
Documentation [Float32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Float32Array")
extern class Float32Array implements ArrayBufferView implements ArrayAccess<Float> {
/**
Returns a number value of the element size. 4 in the case of an `Float32Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Float32Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Float) -> Int, ?thisArg:Any):Float32Array {})
@:pure static function from(source:{}, ?mapFn:(value:Float, index:Int) -> Int, ?thisArg:Any):Float32Array;
/**
Creates a new `Float32Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Float32Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Float32Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Float32Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Float32Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Float32Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Float32Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Float>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Float) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Float, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Float, index:Int, array:Float32Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Float, ?start:Int, ?end:Int):Float32Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Float32Array {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Float32Array {})
function filter(callback:(element:Float, index:Int, array:Float32Array) -> Bool, ?thisArg:Any):Float32Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Float, index:Int, array:Float32Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Float, index:Int, array:Float32Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Float) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Float, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Float, index:Int, array:Float32Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Float, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Float, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Float, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Float) -> Float, ?thisArg:Any):Float32Array {})
@:overload(function(callback:(element:Float, index:Int) -> Float, ?thisArg:Any):Float32Array {})
function map(callback:(element:Float, index:Int, array:Float32Array) -> Float, ?thisArg:Any):Float32Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Float) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Float, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int, array:Float32Array) -> Int):Float {})
function reduce<T>(callback:(previousValue:T, currentValue:Float, index:Int, array:Float32Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Float) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Float, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int, array:Float32Array) -> Int):Float {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Float, index:Int, array:Float32Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Float32Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
@:overload(function(array:Array<Int>, ?offset:Int):Void {})
function set(array:Array<Float>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Float32Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Float, index:Int, array:Float32Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Float, y:Float) -> Int):Float32Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Float32Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Float>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,266 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Float64Array` typed array represents an array of 64-bit floating point numbers
(corresponding to the C double data type) in the platform byte order. If control over byte order
is needed, use `DataView` instead. The contents are initialized to `0`. Once established, you can
reference elements in the array using the object's methods, or using standard array index
syntax (that is, using bracket notation).
Documentation [Float64Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Float64Array")
extern class Float64Array implements ArrayBufferView implements ArrayAccess<Float> {
/**
Returns a number value of the element size. 8 in the case of an `Float64Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Float64Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Float) -> Int, ?thisArg:Any):Float64Array {})
@:pure static function from(source:{}, ?mapFn:(value:Float, index:Int) -> Int, ?thisArg:Any):Float64Array;
/**
Creates a new `Float64Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Float64Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Float64Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Float64Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Float64Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Float64Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Float64Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Float>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Float) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Float, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Float, index:Int, array:Float64Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Float, ?start:Int, ?end:Int):Float64Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Float64Array {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Float64Array {})
function filter(callback:(element:Float, index:Int, array:Float64Array) -> Bool, ?thisArg:Any):Float64Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Float, index:Int, array:Float64Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Float, index:Int, array:Float64Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Float) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Float, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Float, index:Int, array:Float64Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Float, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Float, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Float, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Float) -> Float, ?thisArg:Any):Float64Array {})
@:overload(function(callback:(element:Float, index:Int) -> Float, ?thisArg:Any):Float64Array {})
function map(callback:(element:Float, index:Int, array:Float64Array) -> Float, ?thisArg:Any):Float64Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Float) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Float, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int, array:Float64Array) -> Int):Float {})
function reduce<T>(callback:(previousValue:T, currentValue:Float, index:Int, array:Float64Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Float) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Float, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int) -> Int):Float {})
@:overload(function(callbackfn:(previousValue:Float, currentValue:Float, index:Int, array:Float64Array) -> Int):Float {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Float, index:Int, array:Float64Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Float64Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
@:overload(function(array:Array<Int>, ?offset:Int):Void {})
function set(array:Array<Float>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Float64Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Float) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Float, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Float, index:Int, array:Float64Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Float, y:Float) -> Int):Float64Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Float64Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Float>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,52 @@
/*
* 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.extern.Rest;
@:native("Function")
extern class Function {
/** Specifies the number of arguments expected by the function. **/
var length(default, never):Int;
/** The name of the function. **/
var name:String;
/** Creates a new Function object. **/
function new(arg:String, rest:Rest<String>);
/** Calls a function and sets its this to the provided value, arguments can be passed as an Array object. **/
function apply(thisArg:Dynamic, argsArray:Array<Dynamic>):Dynamic;
/** Calls (executes) a function and sets its this to the provided value, arguments can be passed as they are. **/
function call(thisArg:Dynamic, args:Rest<Dynamic>):Dynamic;
/**
Creates a new function which, when called, has its this set to the provided value,
with a given sequence of arguments preceding any provided when the new function was called.
**/
@:pure function bind(thisArg:Dynamic, args:Rest<Dynamic>):Function;
/** Returns a string representing the source code of the function. **/
@:pure function toString():String;
}

View File

@ -0,0 +1,53 @@
/*
* 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;
/**
`HaxeIterator` wraps a JavaScript native iterator object to enable for-in iteration in haxe.
It can be used directly: `new HaxeIterator(jsIterator)` or via using: `using HaxeIterator`.
**/
class HaxeIterator<T> {
final jsIterator: js.lib.Iterator<T>;
var lastStep: js.lib.Iterator.IteratorStep<T>;
public inline function new(jsIterator: js.lib.Iterator<T>) {
this.jsIterator = jsIterator;
lastStep = jsIterator.next();
}
public inline function hasNext(): Bool {
return !lastStep.done;
}
public inline function next(): T {
var v = lastStep.value;
lastStep = jsIterator.next();
return v;
}
public static inline function iterator<T>(jsIterator: js.lib.Iterator<T>) {
return new HaxeIterator(jsIterator);
}
}

View File

@ -0,0 +1,264 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Int16Array` typed array represents an array of twos-complement 16-bit signed integers in
the platform byte order. If control over byte order is needed, use `DataView` instead. The
contents are initialized to 0. Once established, you can reference elements in the array using
the object's methods, or using standard array index syntax (that is, using bracket notation).
Documentation [Int16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Int16Array")
extern class Int16Array implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 2 in the case of an `Int16Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Int16Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Int16Array {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Int16Array;
/**
Creates a new `Int16Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Int16Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Int16Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Int16Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Int16Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Int16Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Int16Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Int16Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Int16Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int16Array {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int16Array {})
function filter(callback:(element:Int, index:Int, array:Int16Array) -> Bool, ?thisArg:Any):Int16Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Int16Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Int16Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Int16Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Int16Array {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Int16Array {})
function map(callback:(element:Int, index:Int, array:Int16Array) -> Int, ?thisArg:Any):Int16Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Int16Array) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Int16Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Int16Array) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Int16Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Int16Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Int16Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Int16Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Int16Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Int16Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,264 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Int32Array` typed array represents an array of twos-complement 32-bit signed integers in
the platform byte order. If control over byte order is needed, use `DataView` instead. The
contents are initialized to `0`. Once established, you can reference elements in the array using
the object's methods, or using standard array index syntax (that is, using bracket notation).
Documentation [Int32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Int32Array")
extern class Int32Array implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 4 in the case of an `Int32Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Int32Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Int32Array {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Int32Array;
/**
Creates a new `Int32Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Int32Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Int32Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Int32Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Int32Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Int32Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Int32Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Int32Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Int32Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int32Array {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int32Array {})
function filter(callback:(element:Int, index:Int, array:Int32Array) -> Bool, ?thisArg:Any):Int32Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Int32Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Int32Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Int32Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Int32Array {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Int32Array {})
function map(callback:(element:Int, index:Int, array:Int32Array) -> Int, ?thisArg:Any):Int32Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Int32Array) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Int32Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Int32Array) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Int32Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Int32Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Int32Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Int32Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Int32Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Int32Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,263 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Int8Array` typed array represents an array of twos-complement 8-bit signed integers. The
contents are initialized to 0. Once established, you can reference elements in the array using
the object's methods, or using standard array index syntax (that is, using bracket notation).
Documentation [Int8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Int8Array")
extern class Int8Array implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 1 in the case of an `Int8Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Int8Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Int8Array {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Int8Array;
/**
Creates a new `Int8Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Int8Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Int8Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Int8Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Int8Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Int8Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Int8Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Int8Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Int8Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int8Array {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int8Array {})
function filter(callback:(element:Int, index:Int, array:Int8Array) -> Bool, ?thisArg:Any):Int8Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Int8Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Int8Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Int8Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Int8Array {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Int8Array {})
function map(callback:(element:Int, index:Int, array:Int8Array) -> Int, ?thisArg:Any):Int8Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Int8Array) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Int8Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Int8Array) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Int8Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Int8Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Int8Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Int8Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Int8Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Int8Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,40 @@
/*
* 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;
/**
The `Intl` object is the namespace for the ECMAScript Internationalization API,
which provides language sensitive string comparison, number formatting,and date and time formatting.
The INTL object provides access to several constructors as well as functionality common to
the internationalization constructors and other language sensitive functions.
Documentation [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl")
extern class Intl {
/**
Returns canonical locale names.
**/
@:overload(function(locales:Array<String>):Array<String> {})
@:pure static function getCanonicalLocales(locales:String):Array<String>;
}

View File

@ -0,0 +1,46 @@
/*
* 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;
/**
Native JavaScript iterator structure. To enable haxe for-in iteration, use `js.lib.HaxeIterator`, for example `for (v in new js.lib.HaxeIterator(jsIterator))` or add `using js.lib.HaxeIterator;` to your module
See [Iteration Protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)
**/
typedef Iterator<T> = {
function next():IteratorStep<T>;
}
/**
Native JavaScript async iterator structure.
See [for await...of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of)
**/
typedef AsyncIterator<T> = {
function next():Promise<IteratorStep<T>>;
}
typedef IteratorStep<T> = {
done:Bool,
?value:T
}

View File

@ -0,0 +1,39 @@
/*
* 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;
/**
Key/value access helper.
**/
abstract KeyValue<K, V>(Array<Any>) {
public var key(get, never):K;
public var value(get, never):V;
inline function get_key():K {
return this[0];
}
inline function get_value():V {
return this[1];
}
}

View File

@ -0,0 +1,112 @@
/*
* 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;
/**
The (native) JavaScript Map object holds key-value pairs.
Any value (both objects and primitive values) may be used as either a key
or a value.
Documentation [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Map")
extern class Map<K, V> {
/**
The number of key/value pairs in the `js.Map` object.
**/
var size(default, null):Int;
/**
An Array or other iterable object whose elements are key-value pairs
(arrays with two elements, e.g. `[[ 1, 'one' ],[ 2, 'two' ]]`).
Each key-value pair is added to the new `js.Map`;
null values are treated as undefined.
**/
@:pure function new(?iterable:Any);
/**
A boolean asserting whether a value has been associated to the key in
the `js.Map` object or not.
**/
@:pure function has(key:K):Bool;
/**
The value associated to the key, or `null` if there is none.
**/
@:pure function get(key:K):Null<V>;
/**
Sets the value for the key in the Map object.
Returns the `js.Map` object.
**/
function set(key:K, value:V):Map<K, V>;
/**
Returns `true` if an element in the `js.Map` object existed and has been
removed, or `false` if the element does not exist.
`has(key)` will return `false` afterwards.
**/
function delete(key:K):Bool;
/**
Removes all key/value pairs from the Map object.
**/
function clear():Void;
/**
Calls `callback` once for each key-value pair present in the `js.Map`
object, in insertion order.
If a `thisArg` parameter is provided to forEach, it will be used as the
`this` value for each callback.
**/
function forEach(callback:(value:V, key:K, map:Map<K, V>) -> Void, ?thisArg:Any):Void;
/**
Returns a new `Iterator` object that contains the keys for each element
in the `js.Map` object in insertion order.
**/
function keys():js.lib.Iterator<K>;
/**
Returns a new `Iterator` object that contains the values for each
element in the `js.Map` object in insertion order.
**/
function values():js.lib.Iterator<V>;
/**
Returns a new `Iterator` object that contains an array of `KeyValue`
for each element in the `js.Map` object in insertion order.
**/
function entries():js.lib.Iterator<KeyValue<K, V>>;
inline function iterator():js.lib.HaxeIterator<V> {
return new HaxeIterator(this.values());
}
inline function keyValueIterator():HaxeIterator<KeyValue<K, V>> {
return new HaxeIterator(this.entries());
}
}
@:deprecated typedef MapEntry<K, V> = KeyValue<K, V>;

View File

@ -0,0 +1,251 @@
/*
* 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.extern.Rest;
/**
Math is a built-in object that has properties and methods for mathematical constants and functions.
Not a function object.
Documentation [Math](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Math")
extern class Math {
/**
Euler's constant and the base of natural logarithms, approximately 2.718.
**/
static var E(default,never):Float;
/**
Natural logarithm of 2, approximately 0.693.
**/
static var LN2(default,never):Float;
/**
Natural logarithm of 10, approximately 2.303.
**/
static var LN10(default,never):Float;
/**
Base 2 logarithm of E, approximately 1.443.
**/
static var LOG2E(default,never):Float;
/**
Base 10 logarithm of E, approximately 0.434.
**/
static var LOG10E(default,never):Float;
/**
Ratio of the circumference of a circle to its diameter, approximately 3.14159.
**/
static var PI(default,never):Float;
/**
Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.
**/
static var SQRT1_2(default,never):Float;
/**
Square root of 2, approximately 1.414.
**/
static var SQRT2(default,never):Float;
/**
Returns the absolute value of a number.
**/
@:overload(function(x:Float):Float {})
@:pure static function abs(x:Int):Int;
/**
Returns the arccosine of a number.
**/
@:pure static function acos(x:Float):Float;
/**
Returns the hyperbolic arccosine of a number.
**/
@:pure static function acosh(x:Float):Float;
/**
Returns the arcsine of a number.
**/
@:pure static function asin(x:Float):Float;
/**
Returns the hyperbolic arcsine of a number.
**/
@:pure static function asinh(x:Float):Float;
/**
Returns the arctangent of a number.
**/
@:pure static function atan(x:Float):Float;
/**
Returns the hyperbolic arctangent of a number.
**/
@:pure static function atanh(x:Float):Float;
/**
Returns the arctangent of the quotient of its arguments.
**/
@:pure static function atan2(y:Float, x:Float):Float;
/**
Returns the cube root of a number.
**/
@:pure static function cbrt(x:Float):Float;
/**
Returns the smallest integer greater than or equal to a number.
**/
@:pure static function ceil(x:Float):Int;
/**
Returns the number of leading zeroes of a 32-bit integer.
**/
@:pure static function clz32(x:Int):Int;
/**
Returns the cosine of a number.
**/
@:pure static function cos(x:Float):Float;
/**
Returns the hyperbolic cosine of a number.
**/
@:pure static function cosh(x:Float):Float;
/**
Returns Ex, where x is the argument, and E is Euler's constant (2.718…), the base of the natural logarithm.
**/
@:pure static function exp(x:Float):Float;
/**
Returns subtracting 1 from exp(x).
**/
@:pure static function expm1(x:Float):Float;
/**
Returns the largest integer less than or equal to a number.
**/
@:pure static function floor(x:Float):Int;
/**
Returns the nearest single precision float representation of a number.
**/
@:pure static function fround(x:Float):Float;
/**
Returns the square root of the sum of squares of its arguments.
**/
@:pure static function hypot(args:Rest<Float>):Float;
/**
Returns the result of a 32-bit integer multiplication.
**/
@:pure static function imul(x:Int, y:Int):Int;
/**
Returns the natural logarithm (loge, also ln) of a number.
**/
@:pure static function log(x:Float):Float;
/**
Returns the natural logarithm (loge, also ln) of 1 + x for a number x.
**/
@:pure static function log1p(x:Float):Float;
/**
Returns the base 10 logarithm of a number.
**/
@:pure static function log10(x:Float):Float;
/**
Returns the base 2 logarithm of a number.
**/
@:pure static function log2(x:Float):Float;
/**
Returns the largest of zero or more numbers.
**/
@:overload(function(args:Rest<Float>):Float {})
@:pure static function max(args:Rest<Int>):Int;
/**
Returns the smallest of zero or more numbers.
**/
@:overload(function(args:Rest<Float>):Float {})
@:pure static function min(args:Rest<Int>):Int;
/**
Returns base to the exponent power, that is, baseexponent.
**/
@:pure static function pow(x:Float, y:Float):Float;
/**
Returns a pseudo-random number between 0 and 1.
**/
@:pure static function random():Float;
/**
Returns the value of a number rounded to the nearest integer.
**/
@:pure static function round(x:Float):Int;
/**
Returns the sign of the x, indicating whether x is positive, negative or zero.
**/
@:pure static function sign(x:Float):Int;
/**
Returns the sine of a number.
**/
@:pure static function sin(x:Float):Float;
/**
Returns the hyperbolic sine of a number.
**/
@:pure static function sinh(x:Float):Float;
/**
Returns the positive square root of a number.
**/
@:pure static function sqrt(x:Float):Float;
/**
Returns the tangent of a number.
**/
@:pure static function tan(x:Float):Float;
/**
Returns the hyperbolic tangent of a number.
**/
@:pure static function tanh(x:Float):Float;
/**
Returns the integer part of the number x, removing any fractional digits.
**/
@:pure static function trunc(x:Float):Int;
}

View File

@ -0,0 +1,261 @@
/*
* 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.extern.Rest;
import haxe.DynamicAccess;
/**
The `js.lib.Object` constructor creates an object wrapper.
Documentation [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Object")
extern class Object {
/**
Copies the values of all enumerable own properties from one or more
source objects to a target object.
**/
static function assign<T:{}>(target:T, sources:Rest<{}>):T;
/**
Creates a new object with the specified prototype object and properties.
**/
@:pure static function create<T>(proto:{}, ?propertiesObject:DynamicAccess<ObjectPropertyDescriptor>):T;
/**
Adds the named properties described by the given descriptors to an object.
**/
static function defineProperties<T:{}>(obj:T, props:DynamicAccess<ObjectPropertyDescriptor>):T;
/**
Adds the named property described by a given descriptor to an object.
**/
@:overload(function<T:{}>(obj:T, prop:Symbol, descriptor:ObjectPropertyDescriptor):T {})
static function defineProperty<T:{}>(obj:T, prop:String, descriptor:ObjectPropertyDescriptor):T;
/**
Returns an array containing all of the [key, value] pairs of a given
object's own enumerable string properties.
**/
@:pure static function entries(obj:{}):Array<ObjectEntry>;
/**
Freezes an object: other code can't delete or change any properties.
**/
static function freeze<T:{}>(obj:T):T;
/**
Returns a new object from an iterable of key-value pairs
(reverses Object.entries).
**/
@:pure static function fromEntries<T:{}>(iterable:Any):T;
/**
Returns a property descriptor for a named property on an object.
**/
@:overload(function<T>(target:Array<T>, propertyKey:Int):Null<ObjectPropertyDescriptor> {})
@:overload(function(obj:{}, prop:Symbol):Null<ObjectPropertyDescriptor> {})
@:pure static function getOwnPropertyDescriptor(obj:{}, prop:String):Null<ObjectPropertyDescriptor>;
/**
Returns an array containing the names of all of the given object's own
enumerable and non-enumerable properties.
**/
@:pure static function getOwnPropertyNames(obj:{}):Array<String>;
/**
Returns an array of all symbol properties found directly upon a given object.
**/
@:pure static function getOwnPropertySymbols(obj:{}):Array<Symbol>;
/**
Returns the prototype of the specified object.
**/
@:pure static function getPrototypeOf<TProto:{}>(obj:{}):Null<TProto>;
/**
Compares if two values are the same value. Equates all NaN values
(which differs from both Abstract Equality Comparison and
Strict Equality Comparison).
**/
@:pure static function is<T>(value1:T, value2:T):Bool;
/**
Determines if extending of an object is allowed.
**/
@:pure static function isExtensible(obj:{}):Bool;
/**
Determines if an object was frozen.
**/
@:pure static function isFrozen(obj:{}):Bool;
/**
Determines if an object is sealed.
**/
@:pure static function isSealed(obj:{}):Bool;
/**
Returns an array containing the names of all of the given object's own
enumerable string properties.
**/
@:pure static function keys(obj:{}):Array<String>;
/**
Prevents any extensions of an object.
**/
static function preventExtensions<T:{}>(obj:T):T;
/**
Prevents other code from deleting properties of an object.
**/
static function seal<T:{}>(obj:T):T;
/**
Sets the prototype (i.e., the internal Prototype property).
**/
static function setPrototypeOf<T:{}>(obj:T, prototype:Null<{}>):T;
/**
Returns an array containing the values that correspond to all of
a given object's own enumerable string properties.
**/
@:pure static function values(obj:{}):Array<Any>;
/**
Allows the addition of properties to all objects of type Object.
**/
static var prototype(default, never):ObjectPrototype;
/**
The Object constructor creates an object wrapper.
**/
@:pure function new(?value:Any);
}
/**
Type for
@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object>
**/
typedef ObjectPrototype = {
/**
Returns a boolean indicating whether an object contains the specified
property as a direct property of that object and not inherited through
the prototype chain.
**/
var hasOwnProperty(default, never):Function;
/**
Returns a boolean indicating whether the object this method is called
upon is in the prototype chain of the specified object.
**/
var isPrototypeOf(default, never):Function;
/**
Returns a boolean indicating if the internal enumerable attribute is set.
**/
var propertyIsEnumerable(default, never):Function;
/**
Calls `toString()`.
**/
var toLocaleString(default, never):Function;
/**
Returns a string representation of the object.
**/
var toString(default, never):Function;
/**
Returns the primitive value of the specified object.
**/
var valueOf(default, never):Function;
}
/**
@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty>
**/
typedef ObjectPropertyDescriptor = {
/**
`true` if and only if the type of this property descriptor may be
changed and if the property may be deleted from the corresponding object.
Defaults to `false`.
**/
var ?configurable:Bool;
/**
`true` if and only if this property shows up during enumeration of the
properties on the corresponding object.
Defaults to `false`.
**/
var ?enumerable:Bool;
/**
The value associated with the property.
Can be any valid JavaScript value (number, object, function, etc).
**/
var ?value:Any;
/**
`true` if and only if the value associated with the property may be
changed with an assignment operator.
Defaults to `false`.
**/
var ?writable:Bool;
/**
A function which serves as a getter for the property, or `undefined` if
there is no getter. When the property is accessed, this function is
called without arguments and with `this` set to the object through which
the property is accessed (this may not be the object on which the
property is defined due to inheritance).
The return value will be used as the value of the property.
**/
var ?get:Void->Any;
/**
A function which serves as a setter for the property, or undefined if
there is no setter. When the property is assigned to, this function
is called with one argument (the value being assigned to the property)
and with `this` set to the object through which the property is assigned.
**/
var ?set:Any->Void;
}
/**
Key/value access helper for `js.lib.Object.entries()`.
**/
abstract ObjectEntry(Array<Any>) {
public var key(get, never):String;
public var value(get, never):Any;
inline function get_key():String
return this[0];
inline function get_value():Any
return this[1];
}

View File

@ -0,0 +1,141 @@
/*
* 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.extern.EitherType;
/**
The Promise object represents the eventual completion (or failure) of an
asynchronous operation and its resulting value.
Documentation [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Promise")
extern class Promise<T> {
/**
Returns a Promise object that is resolved with the given value. If the
value is Thenable, the returned promise will "follow" that
thenable, adopting its eventual state;
otherwise the returned promise will be fulfilled with the value.
Generally, when it's unknown when value is a promise or not,
use `Promise.resolve(value)` instead and work with the return value as
a promise.
**/
@:overload(function<T>(?value:T):Promise<T> {})
static function resolve<T>(thenable:Thenable<T>):Promise<T>;
/**
Returns a Promise object that is rejected with the given reason.
**/
static function reject<T>(?reason:Dynamic):Promise<T>;
/**
Returns a promise that either fulfills when all of the promises in the
iterable argument have fulfilled or rejects as soon as one of the
promises in the iterable argument rejects. If the returned promise
fulfills, it is fulfilled with an array of the values from the
fulfilled promises in the same order as defined in the iterable.
If the returned promise rejects, it is rejected with the reason from
the first promise in the iterable that rejected. This method can be
useful for aggregating results of multiple promises.
**/
static function all(iterable:Array<Dynamic>):Promise<Array<Dynamic>>;
/**
Returns a promise that resolves after all of the given promises have either fulfilled or rejected,
with an array of objects that each describes the outcome of each promise.
It is typically used when you have multiple asynchronous tasks that are not dependent on one another
to complete successfully, or you'd always like to know the result of each promise.
In comparison, the Promise returned by `Promise.all` may be more appropriate if the tasks are dependent
on each other / if you'd like to immediately reject upon any of them rejecting.
**/
static function allSettled(iterable:Array<Dynamic>):Promise<Array<PromiseSettleOutcome>>;
/**
Returns a promise that fulfills or rejects as soon as one of the
promises in the iterable fulfills or rejects, with the value or reason
from that promise.
**/
static function race(iterable:Array<Dynamic>):Promise<Dynamic>;
/** @throws DOMError */
function new(init:(resolve:(value:T) -> Void, reject:(reason:Dynamic) -> Void) -> Void):Void;
/**
Appends fulfillment and rejection handlers to the promise and returns a
new promise resolving to the return value of the called handler, or to
its original settled value if the promise was not handled
(i.e. if the relevant handler onFulfilled or onRejected is not a function).
**/
function then<TOut>(onFulfilled:Null<PromiseHandler<T, TOut>>, ?onRejected:PromiseHandler<Dynamic, TOut>):Promise<TOut>;
/**
Appends a rejection handler callback to the promise, and returns a new
promise resolving to the return value of the callback if it is called,
or to its original fulfillment value if the promise is instead fulfilled.
**/
@:native("catch")
@:overload(function<TOut>(onRejected:PromiseHandler<Dynamic, TOut>):Promise<EitherType<T, TOut>> {})
function catchError(onRejected:PromiseHandler<Dynamic, T>):Promise<T>;
/**
Returns a Promise. When the promise is settled, i.e either fulfilled or rejected,
the specified callback function is executed. This provides a way for code to be run
whether the promise was fulfilled successfully or rejected once the Promise has been dealt with.
**/
function finally(onFinally:() -> Void):Promise<T>;
}
/**
Handler type for the Promise object.
**/
abstract PromiseHandler<T, TOut>(T->Dynamic) // T->Dynamic, so the compiler always knows the type of the argument and can infer it for then/catch callbacks
from T->Promise<TOut> // support Promise explicitly as it doesn't work transitively through Thenable at the moment
from T->Thenable<TOut> // although the checking order seems to be reversed at the moment, see https://github.com/HaxeFoundation/haxe/issues/7656
from T->TOut // order is important, because Promise<TOut> return must have priority
{}
/**
A value with a `then` method.
**/
@:forward
@:transitive
abstract Thenable<T>(ThenableStruct<T>)
from ThenableStruct<T> {} // abstract wrapping prevents compiler hanging, see https://github.com/HaxeFoundation/haxe/issues/5785
typedef ThenableStruct<T> = {
function then<TOut>(onFulfilled:Null<PromiseHandler<T, TOut>>, ?onRejected:PromiseHandler<Dynamic, TOut>):Thenable<TOut>;
}
typedef PromiseSettleOutcome = {
var status:PromiseSettleStatus;
var ?value:Dynamic;
var ?reason:Dynamic;
}
enum abstract PromiseSettleStatus(String) to String {
var Fulfilled = "fulfilled";
var Rejected = "rejected";
}

View File

@ -0,0 +1,121 @@
/*
* 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 js.lib.Object;
import haxe.extern.EitherType;
/**
The `Proxy` object is used to define custom behavior for fundamental operations
(e.g. property lookup, assignment, enumeration, function invocation, etc).
Documentation [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Proxy")
extern class Proxy<T:{}> {
@:pure function new(target:T, handler:ProxyHandler<T>);
/**
Creates a revocable `Proxy` object.
**/
@:pure static function revocable<T:{}>(target:T, handler:ProxyHandler<T>):RevocableProxy<T>;
}
typedef ProxyHandler<T:{}> = {
/**
A trap for `Object.getPrototypeOf`.
**/
var ?getPrototypeOf:(target:T) -> Null<{}>;
/**
A trap for `Object.setPrototypeOf`.
**/
var ?setPrototypeOf:(target:T, prototype:Null<{}>) -> Bool;
/**
A trap for `Object.isExtensible`.
**/
var ?isExtensible:(target:T) -> Bool;
/**
A trap for `Object.preventExtensions`.
**/
var ?preventExtensions:(target:T) -> Bool;
/**
A trap for `Object.getOwnPropertyDescriptor`.
**/
var ?getOwnPropertyDescriptor:(target:T, prop:EitherType<String, Symbol>) -> Null<ObjectPropertyDescriptor>;
/**
A trap for `Object.defineProperty`.
**/
var ?defineProperty:(target:T, property:EitherType<String, Symbol>, descriptor:ObjectPropertyDescriptor) -> Bool;
/**
A trap for the `in` operator.
**/
var ?has:(target:T, prop:EitherType<String, EitherType<Int, Symbol>>) -> Bool;
/**
A trap for getting property values.
**/
var ?get:(target:T, property:EitherType<String, EitherType<Int, Symbol>>, receiver:Null<{}>) -> Any;
/**
A trap for setting property values.
**/
var ?set:(target:T, property:EitherType<String, EitherType<Int, Symbol>>, value:Any, receiver:Null<{}>) -> Bool;
/**
A trap for the `delete` operator.
**/
var ?deleteProperty:(target:T, property:EitherType<String, EitherType<Int, Symbol>>) -> Bool;
/**
A trap for `Object.getOwnPropertyNames` and `Object.getOwnPropertySymbols`.
**/
var ?ownKeys:(target:T) -> Array<String>;
/**
A trap a function call.
**/
var ?apply:(target:T, thisArg:{}, argumentsList:Array<Any>) -> Any;
/**
A trap for the `new` operator.
**/
var ?construct:(target:Class<T>, argumentsList:Array<Any>, newTarget:Class<Any>) -> Void;
}
typedef RevocableProxy<T:{}> = {
/**
A Proxy object created with `new Proxy(target, handler)` call.
**/
final proxy:Proxy<T>;
/**
A function with no argument to invalidate (switch off) the `proxy`.
**/
function revoke():Void;
}

View File

@ -0,0 +1,118 @@
/*
* 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<T>(target:Function, thisArgument:{}, argumentsList:Array<Any>):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<T, S:T>(target:Class<T>, argumentsList:Array<Any>, ?newTarget:Class<S>):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<T>(target:Array<T>, propertyKey:Int):Bool {})
@:overload(function<T>(target:{}, propertyKey:Symbol):Bool {})
static function deleteProperty(target:{}, propertyKey:String):Bool;
/**
A function that returns the value of properties.
*/
@:overload(function<T>(target:Array<T>, propertyKey:Int, ?receiver:{}):Null<T> {})
@:overload(function<T>(target:{}, propertyKey:Symbol, ?receiver:{}):Null<T> {})
@:pure static function get<T>(target:{}, propertyKey:String, ?receiver:{}):Null<T>;
/**
Similar to `Object.getOwnPropertyDescriptor()`.
Returns a property descriptor of the given property if it exists on the object,
`undefined` otherwise.
*/
@:overload(function<T>(target:Array<T>, propertyKey:Int):Null<ObjectPropertyDescriptor> {})
@:overload(function(target:{}, propertyKey:Symbol):Null<ObjectPropertyDescriptor> {})
@:pure static function getOwnPropertyDescriptor(target:{}, propertyKey:String):Null<ObjectPropertyDescriptor>;
/**
Same as `Object.getPrototypeOf()`.
*/
@:pure static function getPrototypeOf<TProto:{}>(target:{}):Null<TProto>;
/**
The `in` operator as function. Returns a boolean indicating whether an own
or inherited property exists.
*/
@:overload(function<T>(target:Array<T>, 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<String>;
/**
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<T>(target:Array<T>, propertyKey:Int, value:T, ?receiver:{}):Bool {})
@:overload(function<T>(target:{}, propertyKey:Symbol, value:T, ?receiver:{}):Bool {})
static function set<T>(target:{}, propertyKey:String, value:T, ?receiver:{}):Bool;
/**
A function that sets the prototype of an object.
*/
static function setPrototypeOf<TProto:{}>(target:{}, prototype:TProto):Bool;
}

View File

@ -0,0 +1,106 @@
/*
* 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.DynamicAccess;
/**
Native JavaScript regular expressions.
For cross-platform regular expressions, use Haxe `EReg` class or
[regexp literals](https://haxe.org/manual/std-regex.html).
@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp>
**/
@:native("RegExp")
extern class RegExp {
/**
Indicates whether or not the "g" flag is used with the regular expression.
**/
var global(default, null):Bool;
/**
Indicates whether or not the "i" flag is used with the regular expression.
**/
var ignoreCase(default, null):Bool;
/**
Indicates whether or not the "m" flag is used with the regular expression.
**/
var multiline(default, null):Bool;
/**
The source text of the regexp object, it doesn't contain the two forward slashes on both sides and any flags.
**/
var source(default, null):String;
/**
The index at which to start the next match.
**/
var lastIndex:Int;
/**
Create a regular expression object for matching text with a pattern.
**/
function new(pattern:String, ?flags:String);
/**
Execute a search for a match in a specified string.
Returns a result array, or null.
**/
function exec(str:String):Null<RegExpMatch>;
/**
Execute a search for a match between a regular expression and a specified string.
Returns true or false.
**/
function test(str:String):Bool;
/**
Return a string representing the regular expression.
**/
function toString():String;
}
/**
A return value of the `RegExp.exec` method.
**/
extern class RegExpMatch extends Array<String> {
/**
The index of the search at which the result was found.
**/
var index:Int;
/**
A copy of the search string.
**/
var input:String;
/**
Named capturing groups or undefined if no named capturing groups were defined.
See [Groups and Ranges](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges) for more information.
Note: Not all browsers support this feature; refer to the [compatibility table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Browser_compatibility).
**/
var groups:Null<DynamicAccess<String>>;
}

View File

@ -0,0 +1,130 @@
/*
* 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;
/**
The `js.Set` object lets you store unique values of any type, whether
primitive values or object references.
Documentation [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Set")
extern class Set<T> {
/**
The number of values in the `js.Set` object.
**/
var size(default, null):Int;
/**
If an iterable object is passed, all of its elements will be added to
the new `js.Set`.
**/
@:pure function new(?iterable:Any);
/**
Returns a boolean asserting whether an element is present with the given
value in the `js.Set` object or not.
**/
@:pure function has(value:T):Bool;
/**
Appends a new element with the given value to the `js.Set` object.
Returns the `js.Set` object.
**/
function add(value:T):Set<T>;
/**
Removes the element associated to the value and returns the value that
`has(value)` would have previously returned.
`has(value)` will return `false` afterwards.
**/
function delete(value:T):Bool;
/**
Removes all elements from the `js.Set` object.
**/
function clear():Void;
/**
Calls `callback` once for each key-value pair present in the `js.Set`
object, in insertion order.
If a `thisArg` parameter is provided to forEach, it will be used as the
`this` value for each callback.
**/
function forEach(callback:(value:T, key:T, set:Set<T>) -> Void, ?thisArg:Any):Void;
/**
Returns a new `js.lib.Iterator` object that contains the keys for each element
in the `js.Set` object in insertion order.
**/
function keys():js.lib.Iterator<T>;
/**
Returns a new `js.lib.Iterator` object that contains the values for each
element in the `js.Set` object in insertion order.
**/
function values():js.lib.Iterator<T>;
/**
Returns a new `js.lib.Iterator` object that contains an array of
`[value, value]` for each element in the `js.Set` object, in insertion
order.
This is kept similar to the `js.Map` object, so that each entry has the
same value for its key and value here.
**/
function entries():js.lib.Iterator<KeyValue<T, T>>;
inline function iterator():HaxeIterator<T> {
return new HaxeIterator(this.values());
}
inline function keyValueIterator():SetKeyValueIterator<T> {
return new SetKeyValueIterator(this);
}
}
/**
key => value iterator for js.lib.Set, tracking the entry index for the key to match the behavior of haxe.ds.List
**/
class SetKeyValueIterator<T> {
final set:js.lib.Set<T>;
final values:HaxeIterator<T>;
var index = 0;
public inline function new(set:js.lib.Set<T>) {
this.set = set;
this.values = new HaxeIterator(set.values());
}
public inline function hasNext():Bool {
return values.hasNext();
}
public inline function next():{key:Int, value:T} {
return {
key: index++,
value: values.next(),
};
}
}

View File

@ -0,0 +1,68 @@
/*
* 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;
@:native("Symbol")
extern class Symbol {
/**
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.
**/
@:pure @:selfCall function new(?description:String);
/**
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.
**/
@:native("for") static function for_(key:String):Symbol;
/**
Retrieves a shared symbol key from the global symbol registry for the given symbol.
**/
@:pure static function keyFor(sym:Symbol):Null<String>;
/**
Returns a string containing the description of the Symbol.
**/
@:pure function toString():String;
/**
A method returning the default iterator for an object.
**/
static var iterator(default, null):Symbol;
/**
A method that returns the default AsyncIterator for an object.
**/
static var asyncIterator(default, null):Symbol;
/**
Retrieve symbol from a given `object`.
NOTE: This is a Haxe-specific method that generates an `object[symbol]` expression.
**/
inline function ofObject<T>(object:{}):Null<T>
return (cast object)[cast this];
}

View File

@ -0,0 +1,264 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Uint16Array` typed array represents an array of 16-bit unsigned integers in the platform
byte order. If control over byte order is needed, use `DataView` instead. The contents are
initialized to `0`. Once established, you can reference elements in the array using the object's
methods, or using standard array index syntax (that is, using bracket notation).
Documentation [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Uint16Array")
extern class Uint16Array implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 2 in the case of an `Uint16Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Uint16Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Uint16Array {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Uint16Array;
/**
Creates a new `Uint16Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Uint16Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Uint16Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Uint16Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Uint16Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Uint16Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Uint16Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Uint16Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Uint16Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Uint16Array {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Uint16Array {})
function filter(callback:(element:Int, index:Int, array:Uint16Array) -> Bool, ?thisArg:Any):Uint16Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Uint16Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Uint16Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Uint16Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Uint16Array {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Uint16Array {})
function map(callback:(element:Int, index:Int, array:Uint16Array) -> Int, ?thisArg:Any):Uint16Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint16Array) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint16Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint16Array) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint16Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Uint16Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Uint16Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Uint16Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Uint16Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Uint16Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,264 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Uint32Array` typed array represents an array of 32-bit unsigned integers in the platform
byte order. If control over byte order is needed, use `DataView` instead. The contents are
initialized to `0`. Once established, you can reference elements in the array using the object's
methods, or using standard array index syntax (that is, using bracket notation).
Documentation [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Uint32Array")
extern class Uint32Array implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 4 in the case of an `Uint32Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Uint32Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Uint32Array {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Uint32Array;
/**
Creates a new `Uint32Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Uint32Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Uint32Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Uint32Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Uint32Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Uint32Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Uint32Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Uint32Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Uint32Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Uint32Array {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Uint32Array {})
function filter(callback:(element:Int, index:Int, array:Uint32Array) -> Bool, ?thisArg:Any):Uint32Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Uint32Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Uint32Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Uint32Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Uint32Array {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Uint32Array {})
function map(callback:(element:Int, index:Int, array:Uint32Array) -> Int, ?thisArg:Any):Uint32Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint32Array) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint32Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint32Array) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint32Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Uint32Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Uint32Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Uint32Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Uint32Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Uint32Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,263 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Uint8Array` typed array represents an array of 8-bit unsigned integers. The contents
are initialized to 0. Once established, you can reference elements in the array using the object's
methods, or using standard array index syntax (that is, using bracket notation).
Documentation [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Uint8Array")
extern class Uint8Array implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 1 in the case of an `Uint8Array`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Uint8Array` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Uint8Array {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Uint8Array;
/**
Creates a new `Uint8Array` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Uint8Array;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Uint8Array` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Uint8Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Uint8Array` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Uint8Array`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Uint8Array;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Uint8Array) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Uint8Array;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Uint8Array {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Uint8Array {})
function filter(callback:(element:Int, index:Int, array:Uint8Array) -> Bool, ?thisArg:Any):Uint8Array;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Uint8Array) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Uint8Array) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Uint8Array) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Uint8Array {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Uint8Array {})
function map(callback:(element:Int, index:Int, array:Uint8Array) -> Int, ?thisArg:Any):Uint8Array;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint8Array) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint8Array) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint8Array) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint8Array) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Uint8Array;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Uint8Array;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Uint8Array) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Uint8Array;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Uint8Array;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,265 @@
/*
* 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 js.lib.intl.NumberFormat.NumberFormatOptions;
/**
The `Uint8ClampedArray` typed array represents an array of 8-bit unsigned integers clamped
to 0-255; if you specified a value that is out of the range of [0,255], 0 or 255 will be set instead;
if you specify a non-integer, the nearest integer will be set. The contents are initialized to `0`.
Once established, you can reference elements in the array using the object's methods, or using
standard array index syntax (that is, using bracket notation).
Documentation [Uint8ClampedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Uint8ClampedArray")
extern class Uint8ClampedArray implements ArrayBufferView implements ArrayAccess<Int> {
/**
Returns a number value of the element size. 1 in the case of an `Uint8ClampedArray`.
*/
static final BYTES_PER_ELEMENT:Int;
/**
Creates a new `Uint8ClampedArray` from an array-like or iterable object. See also [Array.from()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from).
*/
@:overload(function(source:{}, ?mapFn:(value:Int) -> Int, ?thisArg:Any):Uint8ClampedArray {})
@:pure static function from(source:{}, ?mapFn:(value:Int, index:Int) -> Int, ?thisArg:Any):Uint8ClampedArray;
/**
Creates a new `Uint8ClampedArray` with a variable number of arguments. See also [Array.of()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of).
*/
@:pure static function of(elements:haxe.extern.Rest<Dynamic>):Uint8ClampedArray;
/**
Returns a number value of the element size.
*/
@:native("BYTES_PER_ELEMENT")
final BYTES_PER_ELEMENT_:Int;
/**
Returns the `ArrayBuffer` referenced by the `Uint8ClampedArray` Fixed at construction time and thus read only.
*/
final buffer:ArrayBuffer;
/**
Returns the length (in bytes) of the `Uint8ClampedArray` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteLength:Int;
/**
Returns the offset (in bytes) of the `Uint8ClampedArray` from the start of its `ArrayBuffer`. Fixed at construction time and thus read only.
*/
final byteOffset:Int;
/**
Returns the number of elements hold in the `Uint8ClampedArray`. Fixed at construction time and thus read only.
*/
final length:Int;
/** @throws DOMError */
@:overload(function(length:Int):Void {})
@:overload(function(object:{}):Void {})
@:pure function new(buffer:ArrayBuffer, ?byteOffset:Int, ?length:Int):Void;
/**
Copies a sequence of array elements within the array.
See also [Array.prototype.copyWithin()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin).
*/
function copyWithin(target:Int, start:Int, ?end:Int):Uint8ClampedArray;
/**
Returns a new Array Iterator object that contains the key/value pairs for each index in the array.
See also [Array.prototype.entries()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries).
*/
@:pure function entries():js.lib.Iterator<KeyValue<Int, Int>>;
/**
Tests whether all elements in the array pass the test provided by a function.
See also [Array.prototype.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every).
*/
@:overload(function(callback:(currentValue:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(currentValue:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function every(callback:(currentValue:Int, index:Int, array:Uint8ClampedArray) -> Bool, ?thisArg:Any):Bool;
/**
Fills all the elements of an array from a start index to an end index with a static value.
See also [Array.prototype.fill()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill).
*/
function fill(value:Int, ?start:Int, ?end:Int):Uint8ClampedArray;
/**
Creates a new array with all of the elements of this array for which the provided filtering function returns true.
See also [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Uint8ClampedArray {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Uint8ClampedArray {})
function filter(callback:(element:Int, index:Int, array:Uint8ClampedArray) -> Bool, ?thisArg:Any):Uint8ClampedArray;
/**
Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found.
See also [Array.prototype.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Null<Int> {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Null<Int> {})
function find(callback:(element:Int, index:Int, array:Uint8ClampedArray) -> Bool, ?thisArg:Any):Null<Int>;
/**
Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found.
See also [Array.prototype.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Int {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Int {})
function findIndex(callback:(element:Int, index:Int, array:Uint8ClampedArray) -> Bool, ?thisArg:Any):Int;
/**
Calls a function for each element in the array.
See also [Array.prototype.forEach()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach).
*/
@:overload(function(callback:(element:Int) -> Void, ?thisArg:Any):Void {})
@:overload(function(callback:(element:Int, index:Int) -> Void, ?thisArg:Any):Void {})
function forEach(callback:(element:Int, index:Int, array:Uint8ClampedArray) -> Void, ?thisArg:Any):Void;
/**
Determines whether a typed array includes a certain element, returning true or false as appropriate.
See also [Array.prototype.includes()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
*/
@:pure function includes(searchElement:Int, ?fromIndex:Int):Bool;
/**
Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
*/
@:pure function indexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Joins all elements of an array into a string.
See also [Array.prototype.join()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join).
*/
@:pure function join(?separator:String):String;
/**
Returns a new Array Iterator that contains the keys for each index in the array.
See also [Array.prototype.keys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/keys).
*/
@:pure function keys():js.lib.Iterator<Int>;
/**
Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
See also [Array.prototype.lastIndexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf).
*/
@:pure function lastIndexOf(searchElement:Int, ?fromIndex:Int):Int;
/**
Creates a new array with the results of calling a provided function on every element in this array.
See also [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
*/
@:overload(function(callback:(element:Int) -> Int, ?thisArg:Any):Uint8ClampedArray {})
@:overload(function(callback:(element:Int, index:Int) -> Int, ?thisArg:Any):Uint8ClampedArray {})
function map(callback:(element:Int, index:Int, array:Uint8ClampedArray) -> Int, ?thisArg:Any):Uint8ClampedArray;
/**
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
See also [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint8ClampedArray) -> Int):Int {})
function reduce<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint8ClampedArray) -> T, initialValue:T):T;
/**
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
See also [Array.prototype.reduceRight()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight).
*/
@:overload(function<T>(callback:(previousValue:T, currentValue:Int) -> T, initialValue:T):T {})
@:overload(function<T>(callback:(previousValue:T, currentValue:Int, index:Int) -> T, initialValue:T):T {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int) -> Int):Int {})
@:overload(function(callbackfn:(previousValue:Int, currentValue:Int, index:Int, array:Uint8ClampedArray) -> Int):Int {})
function reduceRight<T>(callback:(previousValue:T, currentValue:Int, index:Int, array:Uint8ClampedArray) -> T, initialValue:T):T;
/**
Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first.
See also [Array.prototype.reverse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse).
*/
function reverse():Uint8ClampedArray;
/**
Stores multiple values in the typed array, reading input values from a specified array.
*/
@:overload(function(array:Int8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8Array, ?offset:Int):Void {})
@:overload(function(array:Uint8ClampedArray, ?offset:Int):Void {})
@:overload(function(array:Int16Array, ?offset:Int):Void {})
@:overload(function(array:Uint16Array, ?offset:Int):Void {})
@:overload(function(array:Int32Array, ?offset:Int):Void {})
@:overload(function(array:Uint32Array, ?offset:Int):Void {})
@:overload(function(array:Float32Array, ?offset:Int):Void {})
@:overload(function(array:Float64Array, ?offset:Int):Void {})
function set(array:Array<Int>, ?offset:Int):Void;
/**
Extracts a section of an array and returns a new array.
See also [Array.prototype.slice()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice).
*/
@:pure function slice(?start:Int, ?end:Int):Uint8ClampedArray;
/**
Returns true if at least one element in this array satisfies the provided testing function.
See also [Array.prototype.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).
*/
@:overload(function(callback:(element:Int) -> Bool, ?thisArg:Any):Bool {})
@:overload(function(callback:(element:Int, index:Int) -> Bool, ?thisArg:Any):Bool {})
function some(callback:(element:Int, index:Int, array:Uint8ClampedArray) -> Bool, ?thisArg:Any):Bool;
/**
Sorts the elements of an array in place and returns the array.
See also [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
*/
function sort(?compareFn:(x:Int, y:Int) -> Int):Uint8ClampedArray;
/**
Returns a new TypedArray from the given start and end element index.
*/
@:pure function subarray(?begin:Int, ?end:Int):Uint8ClampedArray;
/**
Returns a new Array Iterator object that contains the values for each index in the array.
See also [Array.prototype.values()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values).
*/
@:pure function values():js.lib.Iterator<Int>;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toLocaleString(?locales:String, ?options:NumberFormatOptions):String;
/**
Returns a string representing the array and its elements.
See also [Array.prototype.toString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).
*/
@:pure function toString():String;
}

View File

@ -0,0 +1,66 @@
/*
* 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;
/**
The `WeakMap` object is a collection of key/value pairs in which the keys are weakly referenced.
The keys must be objects and the values can be arbitrary values.
You can learn more about WeakMaps in the section [WeakMap object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Keyed_collections#WeakMap_object)
in [Keyed collections](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Keyed_collections).
Documentation [WeakMap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WeakMap")
extern class WeakMap<T> {
/**
The value of the `length` property is 0.
**/
static final length:Int;
/**
If an iterable object is passed, all of its elements will be added to the new WeakSet.
null is treated as undefined.
**/
@:pure function new(?iterable:Any);
/**
Removes any value associated to the `key`. `has(key)` will return `false` afterwards.
**/
function delete(key:{}):Bool;
/**
Returns the value associated to the `key`, or `undefined` if there is none.
**/
@:pure function get(key:{}):T;
/**
Returns a Boolean asserting whether a value has been associated to the `key` in the `WeakMap` object or not.
**/
@:pure function has(key:{}):Bool;
/**
Sets the value for the `key` in the `WeakMap` object. Returns the `WeakMap` object.
**/
function set(key:{}, value:T):WeakMap<T>;
}

View File

@ -0,0 +1,59 @@
/*
* 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;
/**
The `WeakSet` object lets you store weakly held objects in a collection.
Documentation [WeakSet](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WeakSet")
extern class WeakSet {
/**
The value of the `length` property is 0.
**/
static final length:Int;
/**
If an iterable object is passed, all of its elements will be added to the new WeakSet.
null is treated as undefined.
**/
@:pure function new(?iterable:Any);
/**
Appends a new object with the given value to the `WeakSet` object.
**/
function add(value:{}):WeakSet;
/**
Removes the element associated to the `value`.
`has(value)` will return `false` afterwards.
**/
function delete(value:{}):Bool;
/**
Returns a boolean asserting whether an element is present with the given value
in the `WeakSet` object or not.
**/
@:pure function has(value:{}):Bool;
}

View File

@ -0,0 +1,80 @@
/*
* 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 js.lib.webassembly.Module;
import js.lib.webassembly.Instance;
import js.html.Response;
/**
The WebAssembly JavaScript object acts as the namespace for all WebAssembly-related functionality.
Documentation [WebAssembly](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly")
extern class WebAssembly {
/**
The `WebAssembly.instantiate()` function allows you to compile and instantiate WebAssembly code.
This function has two overloads:
- The primary overload takes the WebAssembly binary code, in the form of a typed array or ArrayBuffer,
and performs both compilation and instantiation in one step. The returned Promise resolves to both
a compiled WebAssembly.Module and its first WebAssembly.Instance.
- The secondary overload takes an already-compiled WebAssembly.Module and returns a Promise that resolves
to an Instance of that Module. This overload is useful if the Module has already been compiled.
**/
@:overload(function(module:Module, importObject:{}):Promise<Instance> {})
@:pure static function instantiate(bufferSource:BufferSource, importObject:{}):Promise<WebAssemblyInstantiatedSource>;
/**
The `WebAssembly.instantiateStreaming()` function compiles and instantiates a WebAssembly module
directly from a streamed underlying source. This is the most efficient, optimized way to load wasm code.
**/
@:pure static function instantiateStreaming(source:Response, importObject:{}):Promise<WebAssemblyInstantiatedSource>;
/**
The `WebAssembly.compile()` function compiles a WebAssembly `Module` from WebAssembly binary code.
This function is useful if it is necessary to a compile a module before it can be instantiated
(otherwise, the `WebAssembly.instantiate()` function should be used).
**/
@:pure static function compile(bufferSource:BufferSource):Promise<Module>;
/**
The `WebAssembly.compileStreaming()` function compiles a WebAssembly `Module` directly from a streamed
underlying source. This function is useful if it is necessary to a compile a module before it can
be instantiated (otherwise, the `WebAssembly.instantiateStreaming()` function should be used).
**/
@:pure static function compileStreaming(source:Response):Promise<Module>;
/**
The `WebAssembly.validate()` function validates a given typed array of WebAssembly binary code,
returning whether the bytes form a valid wasm module (`true`) or not (`false`).
**/
@:pure static function validate(bufferSource:BufferSource):Bool;
}
typedef WebAssemblyInstantiatedSource = {
final module:Module;
final instance:Instance;
}

View File

@ -0,0 +1,183 @@
/*
* 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.intl;
/**
The `Collator` object is a constructor for collators, objects that enable language
sensitive string comparison.
Documentation [Collator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.Collator")
extern class Collator {
@:overload(function(?locales:Array<String>, ?options:CollatorOptions):Void {})
@:pure function new(?locales:String, ?options:CollatorOptions);
/**
Getter function that compares two strings according to the sort order of this `Collator` object.
*/
@:pure function compare(string1:String, string2:String):Int;
/**
Returns a new object with properties reflecting the locale and collation options computed
during initialization of the object.
*/
@:pure function resolvedOptions():CollatorResolvedOptions;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
@param locales A string with a BCP 47 language tag, or an array of such strings.
**/
@:overload(function(locales:Array<String>, ?options:CollatorSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:CollatorSupportedLocalesOfOptions):Array<String>;
}
typedef CollatorOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
For information about this option, see the [Intl page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
**/
var ?localeMatcher:LocaleMatcher;
/**
Whether the comparison is for sorting or for searching for matching strings.
The default is `Sort`.
**/
var ?usage:Usage;
/**
Which differences in the strings should lead to non-zero result values.
The default is `Variant` for usage `Sort`; it's locale dependent for usage `Search`.
**/
var ?sensitivity:Sensitivity;
/**
Whether punctuation should be ignored.
The default is `false`.
**/
var ?ignorePunctuation:Bool;
/**
Whether numeric collation should be used, such that "1" < "2" < "10".
The default is `false`.
This option can be set through an `options` property or through a Unicode extension key;
if both are provided, the `options` property takes precedence.
Implementations are not required to support this property.
**/
var ?numeric:Bool;
/**
Whether upper case or lower case should sort first.
The default is "false".
This option can be set through an options property or through a Unicode extension key;
if both are provided, the `options` property takes precedence.
Implementations are not required to support this property.
**/
var ?caseFirst:String;
}
typedef CollatorResolvedOptions = {
/**
The BCP 47 language tag for the locale actually used.
If any Unicode extension values were requested in the input BCP 47 language tag
that led to this locale, the key-value pairs that were requested and are supported
for this locale are included in `locale`.
**/
final locale:String;
final usage:Usage;
final sensitivity:Sensitivity;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
**/
final ignorePunctuation:Bool;
/**
he value requested using the Unicode extension key `"co"`, if it is supported for `Locale`,
or `Default`.
**/
final collation:Collation;
final numeric:Bool;
/**
The values requested for these properties in the options argument or using the
Unicode extension keys `"kn"` and `"kf"` or filled in as defaults.
If the implementation does not support these properties, they are omitted.
**/
final caseFirst:CaseFirst;
}
enum abstract Usage(String) {
var Sort = "sort";
var Search = "search";
}
enum abstract Sensitivity(String) {
/**
Only strings that differ in base letters compare as unequal.
Examples: a ≠ b, a = á, a = A.
**/
var Base = "base";
/**
Only strings that differ in base letters or accents and other diacritic marks compare as unequal.
Examples: a ≠ b, a ≠ á, a = A.
**/
var Accent = "accent";
/**
Only strings that differ in base letters or case compare as unequal.
Examples: a ≠ b, a = á, a ≠ A.
**/
var Case = "case";
/**
Strings that differ in base letters, accents and other diacritic marks, or case compare as unequal.
Other differences may also be taken into consideration.
Examples: a ≠ b, a ≠ á, a ≠ A.
**/
var Variant = "variant";
}
enum abstract CaseFirst(String) {
var Upper = "upper";
var Lower = "lower";
var False = "false";
}
enum abstract Collation(String) {
var Locale = "locale";
var Default = "default";
}
typedef CollatorSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,386 @@
/*
* 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.intl;
/**
The `DateTimeFormat` object is a constructor for objects that enable language-sensitive
date and time formatting.
Documentation [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.DateTimeFormat")
extern class DateTimeFormat {
@:overload(function(?locales:Array<String>, ?options:DateTimeFormatOptions):Void {})
@:pure function new(?locales:String, ?options:DateTimeFormatOptions);
/**
Getter function that formats a date according to the locale and formatting options
of this `DateTimeFormat` object.
**/
@:overload(function(date:js.lib.Date):String {})
@:pure function format(date:Date):String;
/**
Returns an `Array` of objects representing the date string in parts that can be used
for custom locale-aware formatting.
**/
@:overload(function(date:js.lib.Date):Array<DateTimeFormatPart> {})
@:pure function formatToParts(date:Date):Array<DateTimeFormatPart>;
/**
Returns a new object with properties reflecting the locale and formatting options
computed during initialization of the object.
**/
@:pure function resolvedOptions():DateTimeFormatResolvedOptions;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:DateTimeFormatSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:DateTimeFormatSupportedLocalesOfOptions):Array<String>;
}
typedef DateTimeFormatOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
**/
var ?localeMatcher:LocaleMatcher;
/**
The time zone to use. The only value implementations must recognize is `"UTC"`;
the default is the runtime's default time zone. Implementations may also recognize
the time zone names of the [IANA time zone database](https://www.iana.org/time-zones),
such as `"Asia/Shanghai"`, `"Asia/Kolkata"`, `"America/New_York"`.
**/
var ?timeZone:String;
/**
Whether to use 12-hour time (as opposed to 24-hour time).
The default is locale dependent.
This option overrides the hc language tag and/or the `hourCycle` option in case both are present.
**/
var ?hour12:Bool;
/**
The hour cycle to use. This option overrides the `hc` language tag, if both are present,
and the `Hour12` option takes precedence in case both options have been specified.
**/
var ?hourCycle:HourCycle;
/**
The format matching algorithm to use.
The default is `BestFit`.
See the following paragraphs for information about the use of this property.
**/
var ?formatMatcher:FormatMatcher;
/**
The representation of the weekday.
**/
var ?weekday:WeekdayRepresentation;
/**
The representation of the era.
**/
var ?era:EraRepresentation;
/**
The representation of the year.
**/
var ?year:YearRepresentation;
/**
The representation of the month.
**/
var ?month:MonthRepresentation;
/**
The representation of the day.
**/
var ?day:DayRepresentation;
/**
The representation of the hour.
**/
var ?hour:HourRepresentation;
/**
The representation of the minute.
**/
var ?minute:MinuteRepresentation;
/**
The representation of the second.
**/
var ?second:SecondRepresentation;
/**
The representation of the time zone name.
**/
var ?timeZoneName:TimeZoneName;
}
typedef DateTimeFormatResolvedOptions = {
/**
The BCP 47 language tag for the locale actually used.
If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale,
the key-value pairs that were requested and are supported for this locale are included in `locale`.
**/
final locale:String;
/**
E.g. "gregory"
**/
final calendar:String;
/**
The values requested using the Unicode extension keys "ca" and "nu" or filled in as default values.
**/
final numberingSystem:String;
/**
The value provided for this property in the options argument; `undefined` (representing the runtime's
default time zone) if none was provided.
Warning: Applications should not rely on `undefined` being returned, as future versions may return
a String value identifying the runtimes default time zone instead.
**/
final timeZone:Null<String>;
/**
The value provided for this property in the `options` argument or filled in as a default.
**/
final hour12:Bool;
final weekday:WeekdayRepresentation;
final era:EraRepresentation;
final year:YearRepresentation;
final month:MonthRepresentation;
final day:DayRepresentation;
final hour:HourRepresentation;
final minute:MinuteRepresentation;
final second:SecondRepresentation;
/**
The values resulting from format matching between the corresponding properties in the `options` argument
and the available combinations and representations for date-time formatting in the selected locale.
Some of these properties may not be present, indicating that the corresponding components will not be
represented in formatted output.
**/
final timeZoneName:TimeZoneName;
}
enum abstract HourCycle(String) {
var H11 = "h11";
var H12 = "h12";
var H23 = "h23";
var H24 = "h24";
}
enum abstract FormatMatcher(String) {
var Basic = "basic";
var BestFit = "best fit";
}
enum abstract WeekdayRepresentation(String) {
/**
(e.g., Thursday)
*/
var Long = "long";
/**
(e.g., Thu)
*/
var Short = "short";
/**
(e.g., T). Two weekdays may have the same narrow style for some locales (e.g. Tuesday's narrow style is also T).
*/
var Narrow = "narrow";
}
enum abstract EraRepresentation(String) {
/**
(e.g., Anno Domini)
*/
var Long = "long";
/**
(e.g., AD)
*/
var Short = "short";
/**
(e.g., A)
*/
var Narrow = "narrow";
}
enum abstract YearRepresentation(String) {
/**
(e.g., 2012)
**/
var Numeric = "numeric";
/**
(e.g., 12)
**/
var TwoDigit = "2-digit";
}
enum abstract MonthRepresentation(String) {
/**
(e.g., 2)
**/
var Numeric = "numeric";
/**
(e.g., 02)
**/
var TwoDigit = "2-digit";
/**
(e.g., March)
**/
var Long = "long";
/**
(e.g., Mar)
**/
var Short = "short";
/**
(e.g., M). Two months may have the same narrow style for some locales (e.g. May's narrow style is also M).
**/
var Narrow = "narrow";
}
enum abstract DayRepresentation(String) {
/**
(e.g., 1)
**/
var Numeric = "numeric";
/**
(e.g., 01)
**/
var TwoDigit = "2-digit";
}
enum abstract HourRepresentation(String) {
var Numeric = "numeric";
var TwoDigit = "2-digit";
}
enum abstract MinuteRepresentation(String) {
var Numeric = "numeric";
var TwoDigit = "2-digit";
}
enum abstract SecondRepresentation(String) {
var Numeric = "numeric";
var TwoDigit = "2-digit";
}
enum abstract TimeZoneName(String) {
/**
(e.g., British Summer Time)
**/
var Long = "long";
/**
(e.g., GMT+1)
**/
var Short = "short";
}
typedef DateTimeFormatPart = {
var type(default, never):DateTimeFormatPartType;
var value(default, never):String;
}
enum abstract DateTimeFormatPartType(String) {
/**
The string used for the day, for example "17".
**/
var Day = "day";
/**
The string used for the day period, for example, "AM" or "PM".
**/
var DayPeriod = "dayPeriod";
/**
The string used for the era, for example "BC" or "AD".
**/
var Era = "era";
/**
The string used for the hour, for example "3" or "03".
**/
var Hour = "hour";
/**
The string used for separating date and time values, for example "/", ",", "o'clock", "de", etc.
**/
var Literal = "literal";
/**
The string used for the minute, for example "00".
**/
var Minute = "minute";
/**
The string used for the month, for example "12".
**/
var Month = "month";
/**
The string used for the second, for example "07" or "42".
**/
var Second = "second";
/**
The string used for the name of the time zone, for example "UTC".
**/
var TimeZoneName = "timeZoneName";
/**
The string used for the weekday, for example "M", "Monday", or "Montag".
**/
var Weekday = "weekday";
/**
The string used for the year, for example "2012" or "96".
**/
var Year = "year";
}
typedef DateTimeFormatSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,27 @@
/*
* 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.intl;
enum abstract LocaleMatcher(String) {
var Lookup = "lookup";
var BestFit = "best fit";
}

View File

@ -0,0 +1,283 @@
/*
* 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.intl;
/**
The `NumberFormat` object is a constructor for objects that enable language sensitive number formatting.
Documentation [NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.NumberFormat")
extern class NumberFormat {
@:overload(function(?locales:Array<String>, ?options:NumberFormatOptions):Void {})
@:pure function new(?locales:String, ?options:NumberFormatOptions);
/**
Getter function that formats a number according to the locale
and formatting options of this `NumberFormat` object.
**/
@:pure function format(number:Float):String;
/**
Returns an `Array` of objects representing the number string in parts
that can be used for custom locale-aware formatting.
**/
@:pure function formatToParts(?number:Float):Array<NumberFormatPart>;
/**
Returns a new object with properties reflecting the locale and collation options
computed during initialization of the object.
**/
@:pure function resolvedOptions():NumberFormatResolvedOption;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:NumberFormatSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:NumberFormatSupportedLocalesOfOptions):Array<String>;
}
typedef NumberFormatOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
For information about this option, see the [Intl page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
**/
var ?localeMatcher:LocaleMatcher;
/**
The formatting style to use.
The default is `Decimal`.
**/
var ?style:NumberFormatStyle;
/**
The currency to use in currency formatting. Possible values are the ISO 4217 currency codes,
such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB — see the
[Current currency & funds code list](https://www.currency-iso.org/en/home/tables/table-a1.html).
There is no default value; if the style is "currency", the currency property must be provided.
**/
var ?currency:String;
/**
How to display the currency in currency formatting.
The default is `Symbol`.
**/
var ?currencyDisplay:CurrencyDisplay;
/**
Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators.
The default is `true`.
**/
var ?useGrouping:Bool;
/**
The minimum number of integer digits to use.
Possible values are from 1 to 21; the default is 1.
**/
var ?minimumIntegerDigits:Int;
/**
The minimum number of fraction digits to use.
Possible values are from 0 to 20; the default for plain number and percent formatting is 0;
the default for currency formatting is the number of minor unit digits provided by the
[ISO 4217 currency code list](http://www.currency-iso.org/en/home/tables/table-a1.html)
(2 if the list doesn't provide that information).
**/
var ?minimumFractionDigits:Int;
/**
The maximum number of fraction digits to use.
Possible values are from 0 to 20; the default for plain number formatting is the larger of
minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits
and the number of minor unit digits provided by the [ISO 4217 currency code list](http://www.currency-iso.org/en/home/tables/table-a1.html)
(2 if the list doesn't provide that information); the default for percent formatting is the larger of
minimumFractionDigits and 0.
**/
var ?maximumFractionDigits:Int;
/**
The minimum number of significant digits to use.
Possible values are from 1 to 21; the default is 1.
**/
var ?minimumSignificantDigits:Int;
/**
The maximum number of significant digits to use.
Possible values are from 1 to 21; the default is 21.
**/
var ?maximumSignificantDigits:Int;
}
typedef NumberFormatResolvedOption = {
/**
The BCP 47 language tag for the locale actually used. If any Unicode extension values were
requested in the input BCP 47 language tag that led to this locale, the key-value pairs that
were requested and are supported for this locale are included in `locale`.
**/
final locale:String;
/**
The value requested using the Unicode extension key `"nu"` or filled in as a default.
**/
final numberingSystem:String;
final style:NumberFormatStyle;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
**/
final useGrouping:String;
final currency:String;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are only present if `style` is `"currency"`.
**/
final currencyDisplay:String;
final minimumIntegerDigits:Int;
final minimumFractionDigits:Int;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are present only if neither m`inimumSignificantDigits` nor `maximumSignificantDigits`
was provided in the `options` argument.
**/
final maximumFractionDigits:Int;
final minimumSignificantDigits:Int;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are present only if at least one of them was provided in the `options` argument.
**/
final maximumSignificantDigits:Int;
}
enum abstract NumberFormatStyle(String) {
/**
plain number formatting
**/
var Decimal = "decimal";
/**
currency formatting
**/
var Currency = "currency";
/**
percent formatting
**/
var Percent = "percent";
}
enum abstract CurrencyDisplay(String) {
/**
To use a localized currency symbol such as €.
**/
var Symbol = "symbol";
/**
To use the ISO currency code.
**/
var Code = "code";
/**
To use a localized currency name such as "dollar".
**/
var Name = "name";
}
typedef NumberFormatPart = {
final type:NumberFormatPartType;
final value:String;
}
enum abstract NumberFormatPartType(String) {
/**
The currency string, such as the symbols "$" and "€" or the name "Dollar", "Euro" depending
on how currencyDisplay is specified.
**/
var Currency = "currency";
/**
The decimal separator string (".").
**/
var Decimal = "decimal";
/**
The fraction number.
**/
var Fraction = "fraction";
/**
The group separator string (",").
**/
var group = "group";
/**
The Infinity string ("∞").
**/
var infinity = "infinity";
/**
The integer number.
**/
var integer = "integer";
/**
Any literal strings or whitespace in the formatted number.
**/
var literal = "literal";
/**
The minus sign string ("-").
**/
var minusSign = "minusSign";
/**
The NaN string ("NaN").
**/
var nan = "nan";
/**
The plus sign string ("+").
**/
var plusSign = "plusSign";
/**
The percent sign string ("%").
**/
var percentSign = "percentSign";
}
typedef NumberFormatSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,124 @@
/*
* 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.intl;
/**
The `PluralRules` object is a constructor for objects that enable plural sensitive formatting
and plural language rules.
Documentation [PluralRules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.PluralRules")
extern class PluralRules {
@:overload(function(?locales:Array<String>, ?options:PluralRulesOptions):Void {})
@:pure function new(?locales:String, ?options:PluralRulesOptions);
/**
Returns a new object with properties reflecting the locale and collation options computed during initialization of the object.
**/
@:pure function resolvedOptions():PluralRulesResolvedOptions;
/**
Returns a String indicating which plurar rule to use for locale-aware formatting.
**/
@:pure function select(number:Int):String;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:PluralRulesSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:PluralRulesSupportedLocalesOfOptions):Array<String>;
}
typedef PluralRulesOptions = {
/**
The locale matching algorithm to use.
The default is "best fit".
For information about this option, see the [Intl page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
*/
var ?localeMatcher:LocaleMatcher;
/**
The type to use.
The default is `Cardinal`.
*/
var ?type:PluralRulesType;
}
typedef PluralRulesResolvedOptions = {
/**
The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in
the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are
supported for this locale are included in `locale`.
*/
final locale:String;
/**
An `Array` of plural rules used by the given language.
**/
final pluralCategories:Array<String>;
/**
The type used (cardinal or ordinal).
**/
final type:PluralRulesType;
final minimumIntegerDigits:Int;
final minimumFractionDigits:Int;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are present only if neither `minimumSignificantDigits` nor `maximumSignificantDigits`
was provided in the options argument.
**/
final maximumFractionDigits:Int;
final minimumSignificantDigits:Int;
/**
The values provided for these properties in the `options` argument or filled in as defaults.
These properties are present only if at least one of them was provided in the `options` argument.
**/
final maximumSignificantDigits:Int;
}
enum abstract PluralRulesType(String) {
/**
For cardinal numbers (refering to the quantity of things).
*/
var Cardinal = "cardinal";
/**
For ordinal number (refering to the ordering or ranking of things, e.g. "1st", "2nd", "3rd" in English).
*/
var Ordinal = "ordinal";
}
typedef PluralRulesSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,163 @@
/*
* 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.intl;
/**
The `RelativeTimeFormat` object is a constructor for objects that enable language-sensitive
relative time formatting.
Documentation [RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("Intl.RelativeTimeFormat")
extern class RelativeTimeFormat {
@:overload(function(?locales:Array<String>, ?options:RelativeTimeFormatOptions):Void {})
@:pure function new(?locales:String, ?options:RelativeTimeFormatOptions);
/**
Formats a value and a unit according to the locale and formatting options
of the given Intl.RelativeTimeFormat object.
**/
@:pure function format(value:Float, unit:RelativeTimeUnit):String;
/**
Returns an Array of objects representing the relative time format in parts
that can be used for custom locale-aware formatting.
**/
@:pure function formatToParts(value:Float, unit:RelativeTimeUnit):Array<RelativeTimeFormatPart>;
/**
Returns a new object with properties reflecting the locale and formatting options
computed during initialization of the object.
**/
@:pure function resolvedOptions():RelativeTimeFormatResolvedOptions;
/**
Returns an array containing those of the provided locales that are supported
without having to fall back to the runtime's default locale.
**/
@:overload(function(locales:Array<String>, ?options:RelativeTimeFormatSupportedLocalesOfOptions):Array<String> {})
@:pure static function supportedLocalesOf(locales:String, ?options:RelativeTimeFormatSupportedLocalesOfOptions):Array<String>;
}
typedef RelativeTimeFormatOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
For information about this option, see [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
**/
var ?localeMatcher:LocaleMatcher;
/**
The format of output message.
The default value is `Always`.
The `Auto` value allows to not always have to use numeric values in the output.
**/
var ?numeric:RelativeTimeNumeric;
/**
The length of the internationalized message.
The default value is `Long`.
The `Narrow` style could be similar to the short style for some locales.
**/
var ?style:RelativeTimeFormatStyle;
}
typedef RelativeTimeFormatResolvedOptions = {
/**
The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in
the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are
supported for this locale are included in `locale`.
**/
final locale:String;
/**
The length of the internationalized message.
**/
final style:RelativeTimeFormatStyle;
/**
The format of output message.
**/
final numeric:RelativeTimeNumeric;
/**
The value requested using the Unicode extension key `"nu"` or filled in as a default.
**/
final numberingSystem:String;
}
enum abstract RelativeTimeNumeric(String) {
/**
(e.g., 1 day ago),
**/
var Always = "always";
/**
(e.g., yesterday).
**/
var Auto = "auto";
}
enum abstract RelativeTimeFormatStyle(String) {
/**
(e.g., in 1 month)
*/
var Long = "long";
/**
(e.g., in 1 mo.)
*/
var Short = "short";
/**
(e.g., in 1 mo.)
*/
var Narrow = "narrow";
}
enum abstract RelativeTimeUnit(String) from String to String {
var Year = "year";
var Quarter = "quarter";
var Month = "month";
var Week = "week";
var Day = "day";
var Hour = "hour";
var Minute = "minute";
var Second = "second";
}
typedef RelativeTimeFormatPart = {
final type:RelativeTimeFormatPartType;
final value:String;
final ?unit:RelativeTimeUnit;
}
typedef RelativeTimeFormatPartType = NumberFormat.NumberFormatPartType;
typedef RelativeTimeFormatSupportedLocalesOfOptions = {
/**
The locale matching algorithm to use.
The default is `BestFit`.
*/
var ?localeMatcher:LocaleMatcher;
}

View File

@ -0,0 +1,34 @@
/*
* 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.webassembly;
/**
A WebAssembly `CompileError` object indicates an error during WebAssembly
decoding or validation.
Documentation [CompileError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.CompileError")
extern class CompileError extends js.lib.Error {
function new(?message:String):Void;
}

View File

@ -0,0 +1,62 @@
/*
* 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.webassembly;
/**
A WebAssembly `Global` object represents a global variable instance, accessible from
both JavaScript and importable/exportable across one or more WebAssembly `Module` instances.
This allows dynamic linking of multiple modules.
Documentation [Global](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.Global")
extern class Global {
/**
The value contained inside the global variable — this can be used to directly set
and get the global's value.
**/
var value:Any;
@:pure function new(descriptor:GlobalDescriptor, value:Any):Void;
/**
Old-style method that returns the value contained inside the global variable.
*/
@:pure function valueOf():Any;
}
typedef GlobalDescriptor = {
var value:ValueType;
/**
By default, this is false.
*/
var ?mutable:Bool;
}
enum abstract ValueType(String) {
var I32 = "i32";
var I64 = "i64";
var F32 = "f32";
var F64 = "f64";
}

View File

@ -0,0 +1,43 @@
/*
* 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.webassembly;
import haxe.Constraints.Function;
/**
A WebAssembly `Instance` object is a stateful, executable instance of a WebAssembly `Module`.
Instance objects contain all the [Exported WebAssembly functions](https://developer.mozilla.org/en-US/docs/WebAssembly/Exported_functions)
that allow calling into WebAssembly code from JavaScript.
Documentation [Instance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.Instance")
extern class Instance {
/**
Returns an object containing as its members all the functions exported from
the WebAssembly module instance, to allow them to be accessed and used by JavaScript.
**/
var exports(default, never):Dynamic<Function>;
@:pure function new(module:Module, ?importObject:{}):Void;
}

View File

@ -0,0 +1,34 @@
/*
* 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.webassembly;
/**
A WebAssembly `LinkError` object indicates an error during module instantiation
(besides [traps](http://webassembly.org/docs/semantics/#traps) from the start function).
Documentation [LinkError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.LinkError")
extern class LinkError extends js.lib.Error {
function new(?message:String):Void;
}

View File

@ -0,0 +1,63 @@
/*
* 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.webassembly;
/**
A new WebAssembly `Memory` object which is a resizable ArrayBuffer that holds the raw bytes of memory
accessed by a WebAssembly WebAssembly `Instance`.
A memory created by JavaScript or in WebAssembly code will be accessible and mutable from
both JavaScript and WebAssembly.
Documentation [Memory](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.Memory")
extern class Memory {
/**
An accessor property that returns the buffer contained in the memory.
**/
final buffer:js.lib.ArrayBuffer;
@:pure function new(memoryDescriptor:MemoryDescriptor):Void;
/**
Increases the size of the memory instance by a specified number of WebAssembly pages
(each one is 64KB in size).
**/
function grow(number:Int):Int;
}
typedef MemoryDescriptor = {
/**
The initial size of the WebAssembly Memory, in units of WebAssembly pages.
**/
var initial:Int;
/**
The maximum size the WebAssembly Memory is allowed to grow to, in units of WebAssembly pages.
When present, the `maximum` parameter acts as a hint to the engine to reserve memory up front.
However, the engine may ignore or clamp this reservation request.
In general, most WebAssembly modules shouldn't need to set a `maximum`.
*/
var ?maximum:Int;
}

View File

@ -0,0 +1,72 @@
/*
* 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.webassembly;
import js.lib.BufferSource;
/**
A WebAssembly `Module` object contains stateless WebAssembly code that has already
been compiled by the browser and can be efficiently [shared with Workers](https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage),
and instantiated multiple times. To instantiate the module, call
[the secondary overload of `WebAssembly.instantiate()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate#Secondary_overload_%E2%80%94_taking_a_module_object_instance).
Documentation [Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.Module")
extern class Module {
@:pure function new(bufferSource:BufferSource):Void;
/**
Given a `Module` and string, returns a copy of the contents of all custom sections
in the module with the given string name.
**/
@:pure static function customSections(module:Module, sectionName:String):Array<ArrayBuffer>;
/**
Given a `Module`, returns an array containing descriptions of all the declared exports.
**/
@:pure static function exports(module:Module):Array<ModuleExportDescriptor>;
/**
Given a `Module`, returns an array containing descriptions of all the declared imports.
**/
@:pure static function imports(module:Module):Array<ModuleImportDescriptor>;
}
typedef ModuleExportDescriptor = {
var name:String;
var kind:ImportExportKind;
}
typedef ModuleImportDescriptor = {
var module:String;
var name:String;
var kind:ImportExportKind;
}
enum abstract ImportExportKind(String) {
var Function = "function";
var Table = "table";
var Memory = "memory";
var Global = "global";
}

View File

@ -0,0 +1,34 @@
/*
* 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.webassembly;
/**
A WebAssembly `RuntimeError` object is thrown whenever WebAssembly specifies a
[trap](http://webassembly.org/docs/semantics/#traps).
Documentation [RuntimeError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.RuntimeError")
extern class RuntimeError extends js.lib.Error {
function new(?message:String):Void;
}

View File

@ -0,0 +1,81 @@
/*
* 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.webassembly;
import haxe.Constraints.Function;
/**
A Table object of the given size and element type.
This is a JavaScript wrapper object — an array-like structure representing a WebAssembly Table,
which stores function references. A table created by JavaScript or in WebAssembly code will be
accessible and mutable from both JavaScript and WebAssembly.
Documentation [Table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
**/
@:native("WebAssembly.Table")
extern class Table {
/**
Returns the length of the table, i.e. the number of elements.
**/
var length:Int;
@:pure function new(tableDescriptor:TableDescriptor):Void;
/**
Accessor function — gets the element stored at a given index.
**/
@:pure function get(index:Int):Function;
/**
Increases the size of the Table instance by a specified number of elements.
**/
function grow(number:Int):Int;
/**
Sets an element stored at a given index to a given value.
**/
function set(index:Int, value:Function):Void;
}
typedef TableDescriptor = {
/**
A string representing the type of value to be stored in the table.
At the moment this can only have a value of `Anyfunc` (functions).
**/
var element:TableKind;
/**
The initial number of elements of the WebAssembly Table.
**/
var initial:Int;
/**
The maximum number of elements the WebAssembly Table is allowed to grow to.
**/
var ?maximum:Int;
}
enum abstract TableKind(String) {
var Anyfunc = "anyfunc";
}