TypeScript/src/lib/extensions.d.ts
2014-07-12 17:30:19 -07:00

819 lines
31 KiB
TypeScript

/////////////////////////////
/// IE10 ECMAScript Extensions
/////////////////////////////
/**
* Represents a raw buffer of binary data, which is used to store data for the
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
* but can be passed to a typed array or DataView Object to interpret the raw
* buffer as needed.
*/
interface ArrayBuffer {
/**
* Read-only. The length of the ArrayBuffer (in bytes).
*/
byteLength: number;
}
declare var ArrayBuffer: {
prototype: ArrayBuffer;
new (byteLength: number): ArrayBuffer;
}
interface ArrayBufferView {
buffer: ArrayBuffer;
byteOffset: number;
byteLength: number;
}
/**
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Int8Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Int8Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Int8Array;
}
declare var Int8Array: {
prototype: Int8Array;
new (length: number): Int8Array;
new (array: Int8Array): Int8Array;
new (array: number[]): Int8Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Uint8Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Uint8Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Uint8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Uint8Array;
}
declare var Uint8Array: {
prototype: Uint8Array;
new (length: number): Uint8Array;
new (array: Uint8Array): Uint8Array;
new (array: number[]): Uint8Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 16-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Int16Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Int16Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Int16Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Int16Array;
}
declare var Int16Array: {
prototype: Int16Array;
new (length: number): Int16Array;
new (array: Int16Array): Int16Array;
new (array: number[]): Int16Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Uint16Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Uint16Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Uint16Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Uint16Array;
}
declare var Uint16Array: {
prototype: Uint16Array;
new (length: number): Uint16Array;
new (array: Uint16Array): Uint16Array;
new (array: number[]): Uint16Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 32-bit integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Int32Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Int32Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Int32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Int32Array;
}
declare var Int32Array: {
prototype: Int32Array;
new (length: number): Int32Array;
new (array: Int32Array): Int32Array;
new (array: number[]): Int32Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Uint32Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Uint32Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Int8Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Uint32Array;
}
declare var Uint32Array: {
prototype: Uint32Array;
new (length: number): Uint32Array;
new (array: Uint32Array): Uint32Array;
new (array: number[]): Uint32Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Float32Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Float32Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Float32Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Float32Array;
}
declare var Float32Array: {
prototype: Float32Array;
new (length: number): Float32Array;
new (array: Float32Array): Float32Array;
new (array: number[]): Float32Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;
BYTES_PER_ELEMENT: number;
}
/**
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.
*/
interface Float64Array extends ArrayBufferView {
/**
* The size in bytes of each element in the array.
*/
BYTES_PER_ELEMENT: number;
/**
* The length of the array.
*/
length: number;
[index: number]: number;
/**
* Gets the element at the specified index.
* @param index The index at which to get the element of the array.
*/
get(index: number): number;
/**
* Sets a value or an array of values.
* @param index The index of the location to set.
* @param value The value to set.
*/
set(index: number, value: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: Float64Array, offset?: number): void;
/**
* Sets a value or an array of values.
* @param A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: number[], offset?: number): void;
/**
* Gets a new Float64Array view of the ArrayBuffer Object store for this array, specifying the first and last members of the subarray.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): Float64Array;
}
declare var Float64Array: {
prototype: Float64Array;
new (length: number): Float64Array;
new (array: Float64Array): Float64Array;
new (array: number[]): Float64Array;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;
BYTES_PER_ELEMENT: number;
}
/**
* You can use a DataView object to read and write the different kinds of binary data to any location in the ArrayBuffer.
*/
interface DataView extends ArrayBufferView {
/**
* Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt8(byteOffset: number): number;
/**
* Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint8(byteOffset: number): number;
/**
* Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt16(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint16(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt32(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint32(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat32(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat64(byteOffset: number, littleEndian?: boolean): number;
/**
* Stores an Int8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setInt8(byteOffset: number, value: number): void;
/**
* Stores an Uint8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setUint8(byteOffset: number, value: number): void;
/**
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;
/**
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;
/**
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;
/**
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
/**
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;
/**
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written, otherwise a little-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;
}
declare var DataView: {
prototype: DataView;
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): DataView;
}
/////////////////////////////
/// IE11 ECMAScript Extensions
/////////////////////////////
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): Map<K, V>;
size: number;
}
declare var Map: {
new <K, V>(): Map<K, V>;
}
interface WeakMap<K, V> {
clear(): void;
delete(key: K): boolean;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): WeakMap<K, V>;
}
declare var WeakMap: {
new <K, V>(): WeakMap<K, V>;
}
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
size: number;
}
declare var Set: {
new <T>(): Set<T>;
}
declare module Intl {
interface CollatorOptions {
usage?: string;
localeMatcher?: string;
numeric?: boolean;
caseFirst?: string;
sensitivity?: string;
ignorePunctuation?: boolean;
}
interface ResolvedCollatorOptions {
locale: string;
usage: string;
sensitivity: string;
ignorePunctuation: boolean;
collation: string;
caseFirst: string;
numeric: boolean;
}
interface Collator {
compare(x: string, y: string): number;
resolvedOptions(): ResolvedCollatorOptions;
}
var Collator: {
new (locales?: string[], options?: CollatorOptions): Collator;
new (locale?: string, options?: CollatorOptions): Collator;
(locales?: string[], options?: CollatorOptions): Collator;
(locale?: string, options?: CollatorOptions): Collator;
supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];
supportedLocalesOf(locale: string, options?: CollatorOptions): string[];
}
interface NumberFormatOptions {
localeMatcher?: string;
style?: string;
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
}
interface ResolvedNumberFormatOptions {
locale: string;
numberingSystem: string;
style: string;
currency?: string;
currencyDisplay?: string;
minimumintegerDigits: number;
minimumFractionDigits: number;
maximumFractionDigits: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
useGrouping: boolean;
}
interface NumberFormat {
format(value: number): string;
resolvedOptions(): ResolvedNumberFormatOptions;
}
var NumberFormat: {
new (locales?: string[], options?: NumberFormatOptions): Collator;
new (locale?: string, options?: NumberFormatOptions): Collator;
(locales?: string[], options?: NumberFormatOptions): Collator;
(locale?: string, options?: NumberFormatOptions): Collator;
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
}
interface DateTimeFormatOptions {
localeMatcher?: string;
weekday?: string;
era?: string;
year?: string;
month?: string;
day?: string;
hour?: string;
minute?: string;
second?: string;
timeZoneName?: string;
formatMatcher?: string;
hour12: boolean;
}
interface ResolvedDateTimeFormatOptions {
locale: string;
calendar: string;
numberingSystem: string;
timeZone: string;
hour12?: boolean;
weekday?: string;
era?: string;
year?: string;
month?: string;
day?: string;
hour?: string;
minute?: string;
second?: string;
timeZoneName?: string;
}
interface DateTimeFormat {
format(date: number): string;
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
new (locale?: string, options?: DateTimeFormatOptions): Collator;
(locales?: string[], options?: DateTimeFormatOptions): Collator;
(locale?: string, options?: DateTimeFormatOptions): Collator;
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
}
}
interface String {
/**
* Determines whether two strings are equivalent in the current locale.
* @param that String to compare to target string
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
*/
localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;
/**
* Determines whether two strings are equivalent in the current locale.
* @param that String to compare to target string
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
*/
localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;
}
interface Number {
/**
* Converts a number to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;
/**
* Converts a number to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;
}
interface Date {
/**
* Converts a date to a string by using the current or specified locale.
* @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;
/**
* Converts a date to a string by using the current or specified locale.
* @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.
* @param options An object that contains one or more properties that specify comparison options.
*/
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
}