diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 36bcdb307..a41d225ec 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -726,7 +726,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](q-io/Q-io.d.ts) [Q-io](https://github.com/kriskowal/q-io) by [Bart van der Schoor](https://github.com/Bartvds)
* [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic)
* [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade)
-* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer100)
+* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer)
* [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei)
* [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim)
* [:link:](ractive/ractive.d.ts) [Ractive](http://ractivejs.org) by [Han Lin Yap](http://yap.nu)
diff --git a/DataStream.js/DataStream.js-tests.ts b/DataStream.js/DataStream.js-tests.ts
new file mode 100644
index 000000000..71bb08537
--- /dev/null
+++ b/DataStream.js/DataStream.js-tests.ts
@@ -0,0 +1,180 @@
+///
+
+var buf = new ArrayBuffer(100);
+var ds = new DataStream(buf);
+ds = new DataStream(buf, 10);
+ds = new DataStream(buf, 10, DataStream.BIG_ENDIAN);
+
+ds.save('somefile.ext');
+ds.dynamicSize = true;
+
+for (var i=0; i
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare class DataStream {
+
+ /**
+ Big-endian const to use as default endianness.
+ */
+ static BIG_ENDIAN: boolean;
+
+ /**
+ Little-endian const to use as default endianness.
+ */
+ static LITTLE_ENDIAN: boolean;
+
+ /**
+ DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
+ It's like a file-like DataView on steroids.
+
+ @param {ArrayBuffer} arrayBuffer ArrayBuffer to read from.
+ */
+ constructor(arrayBuffer: ArrayBuffer);
+
+ /**
+ DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
+ It's like a file-like DataView on steroids.
+
+ @param arrayBuffer ArrayBuffer to read from.
+ @param byteOffset Offset from arrayBuffer beginning for the DataStream.
+ */
+ constructor(arrayBuffer: ArrayBuffer, byteOffset: number);
+
+ /**
+ DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
+ It's like a file-like DataView on steroids.
+
+ @param arrayBuffer ArrayBuffer to read from.
+ @param byteOffset Offset from arrayBuffer beginning for the DataStream.
+ @param endianness DataStream.BIG_ENDIAN or DataStream.LITTLE_ENDIAN (the default).
+ */
+ constructor(arrayBuffer: ArrayBuffer, byteOffset: number, endianness: boolean);
+
+ /**
+ Saves the DataStream contents to the given filename.
+ Uses Chrome's anchor download property to initiate download.
+ *
+ @param filename Filename to save as.
+ @return nothing
+ */
+ save(filename: string): void;
+
+ /**
+ Whether to extend DataStream buffer when trying to write beyond its size.
+ If set, the buffer is reallocated to twice its current size until the
+ requested write fits the buffer.
+ */
+ dynamicSize: boolean;
+
+ /**
+ Returns the byte length of the DataStream object.
+ */
+ byteLength: number;
+
+ /**
+ Set/get the backing ArrayBuffer of the DataStream object.
+ The setter updates the DataView to point to the new buffer.
+ */
+ buffer: ArrayBuffer;
+
+ /**
+ Set/get the byteOffset of the DataStream object.
+ The setter updates the DataView to point to the new byteOffset.
+ */
+ byteOffset: number;
+
+ /**
+ Set/get the backing DataView of the DataStream object.
+ The setter updates the buffer and byteOffset to point to the DataView values.
+ */
+ dataView: Object;
+
+ /**
+ Sets the DataStream read/write position to given position.
+ Clamps between 0 and DataStream length.
+ *
+ @param pos Position to seek to.
+ @return nothing
+ */
+ seek(pos: number): void;
+
+ /**
+ Returns true if the DataStream seek pointer is at the end of buffer and
+ there's no more data to read.
+ *
+ @return true if the seek pointer is at the end of the buffer.
+ */
+ isEof(): boolean;
+
+ /**
+ Maps an Int32Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @return Int32Array to the DataStream backing buffer.
+ */
+ mapInt32Array(length: number): Int32Array;
+
+ /**
+ Maps an Int32Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return Int32Array to the DataStream backing buffer.
+ */
+ mapInt32Array(length: number, e: boolean): Int32Array;
+
+ /**
+ Maps an Int16Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @return Int16Array to the DataStream backing buffer.
+ */
+ mapInt16Array(length: number): Int16Array;
+
+ /**
+ Maps an Int16Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return Int16Array to the DataStream backing buffer.
+ */
+ mapInt16Array(length: number, e: boolean): Int16Array;
+
+ /**
+ Maps an Int8Array into the DataStream buffer.
+ *
+ Nice for quickly reading in data.
+ *
+ @param length Number of elements to map.
+ @return Int8Array to the DataStream backing buffer.
+ */
+ mapInt8Array(length: number): Int8Array;
+
+ /**
+ Maps a Uint32Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @return Uint32Array to the DataStream backing buffer.
+ */
+ mapUint32Array(length: number): Uint32Array;
+
+ /**
+ Maps a Uint32Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return Uint32Array to the DataStream backing buffer.
+ */
+ mapUint32Array(length: number, e: boolean): Uint32Array;
+
+ /**
+ Maps a Uint16Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @return Uint16Array to the DataStream backing buffer.
+ */
+ mapUint16Array(length: number): Uint16Array;
+
+ /**
+ Maps a Uint16Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return Uint16Array to the DataStream backing buffer.
+ */
+ mapUint16Array(length: number, e: boolean): Uint16Array;
+
+ /**
+ Maps a Uint8Array into the DataStream buffer.
+ *
+ Nice for quickly reading in data.
+ *
+ @param length Number of elements to map.
+ @return Uint8Array to the DataStream backing buffer.
+ */
+ mapUint8Array(length: number): Uint8Array;
+
+ /**
+ Maps a Float64Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @return Float64Array to the DataStream backing buffer.
+ */
+ mapFloat64Array(length: number): Float64Array;
+
+ /**
+ Maps a Float64Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return Float64Array to the DataStream backing buffer.
+ */
+ mapFloat64Array(length: number, e: boolean): Float64Array;
+
+ /**
+ Maps a Float32Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @return Float32Array to the DataStream backing buffer.
+ */
+ mapFloat32Array(length: number): Float32Array;
+
+ /**
+ Maps a Float32Array into the DataStream buffer, swizzling it to native
+ endianness in-place. The current offset from the start of the buffer needs to
+ be a multiple of element size, just like with typed array views.
+ *
+ Nice for quickly reading in data. Warning: potentially modifies the buffer
+ contents.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return Float32Array to the DataStream backing buffer.
+ */
+ mapFloat32Array(length: number, e: boolean): Float32Array;
+
+ /**
+ Reads an Int32Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Int32Array.
+ */
+ readInt32Array(length: number): Int32Array;
+
+ /**
+ Reads an Int32Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return The read Int32Array.
+ */
+ readInt32Array(length: number, e: boolean): Int32Array;
+
+ /**
+ Reads an Int16Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Int16Array.
+ */
+ readInt16Array(length: number): Int16Array;
+
+ /**
+ Reads an Int16Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return The read Int16Array.
+ */
+ readInt16Array(length: number, e: boolean): Int16Array;
+
+ /**
+ Reads an Int8Array of desired length from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Int8Array.
+ */
+ readInt8Array(length: number): Int8Array;
+
+ /**
+ Reads an Uint32Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Uint32Array.
+ */
+ readUint32Array(length: number): Uint32Array;
+
+ /**
+ Reads an Uint32Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return The read Uint32Array.
+ */
+ readUint32Array(length: number, e: boolean): Uint32Array;
+
+ /**
+ Reads an Uint16Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Uint16Array.
+ */
+ readUint16Array(length: number): Uint16Array;
+
+ /**
+ Reads an Uint16Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return The read Uint16Array.
+ */
+ readUint16Array(length: number, e: boolean): Uint16Array;
+
+ /**
+ Reads an Uint8Array of desired length from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Uint8Array.
+ */
+ readUint8Array(length: number): Uint8Array;
+
+ /**
+ Reads a Float64Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return The read Float64Array.
+ */
+ readFloat64Array(length: number, e: boolean): Float64Array;
+
+ /**
+ Reads a Float64Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Float64Array.
+ */
+ readFloat64Array(length: number): Float64Array;
+
+ /**
+ Reads a Float32Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @param e Endianness of the data to read.
+ @return The read Float32Array.
+ */
+ readFloat32Array(length: number, e: boolean): Float32Array;
+
+ /**
+ Reads a Float32Array of desired length and endianness from the DataStream.
+ *
+ @param length Number of elements to map.
+ @return The read Float32Array.
+ */
+ readFloat32Array(length: number): Float32Array;
+
+ /**
+ Writes an Int32Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ @param e Endianness of the data to write.
+ */
+ writeInt32Array(arr: Int32Array, e: boolean): void;
+
+ /**
+ Writes an Int32Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeInt32Array(arr: Int32Array): void;
+
+ /**
+ Writes an Int16Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ @param e Endianness of the data to write.
+ */
+ writeInt16Array(arr: Int16Array, e: boolean): void;
+
+ /**
+ Writes an Int16Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeInt16Array(arr: Int16Array): void;
+
+ /**
+ Writes an Int8Array to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeInt8Array(arr: Int8Array): void;
+
+ /**
+ Writes an Uint32Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ @param e Endianness of the data to write.
+ */
+ writeUint32Array(arr: Uint32Array, e: boolean): void;
+
+ /**
+ Writes an Uint32Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeUint32Array(arr: Uint32Array): void;
+
+ /**
+ Writes an Uint16Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ @param e Endianness of the data to write.
+ */
+ writeUint16Array(arr: Uint16Array, e: boolean): void;
+
+ /**
+ Writes an Uint16Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeUint16Array(arr: Uint16Array): void;
+
+ /**
+ Writes an Uint8Array to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeUint8Array(arr: Uint8Array): void;
+
+ /**
+ Writes a Float64Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeFloat64Array(arr: Float64Array): void;
+
+ /**
+ Writes a Float64Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ @param e Endianness of the data to write.
+ */
+ writeFloat64Array(arr: Float64Array, e: boolean): void;
+
+ /**
+ Writes a Float32Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ */
+ writeFloat32Array(arr: Float32Array): void;
+
+ /**
+ Writes a Float32Array of specified endianness to the DataStream.
+ *
+ @param arr The array to write.
+ @param e Endianness of the data to write.
+ */
+ writeFloat32Array(arr: Float32Array, e: boolean): void;
+
+ /**
+ Reads a 32-bit int from the DataStream with the desired endianness.
+ *
+ @return The read number.
+ */
+ readInt32(): number;
+
+ /**
+ Reads a 32-bit int from the DataStream with the desired endianness.
+ *
+ @param e Endianness of the number.
+ @return The read number.
+ */
+ readInt32(e: boolean): number;
+
+ /**
+ Reads a 16-bit int from the DataStream with the desired endianness.
+ *
+ @return The read number.
+ */
+ readInt16(): number;
+
+ /**
+ Reads a 16-bit int from the DataStream with the desired endianness.
+ *
+ @param e Endianness of the number.
+ @return The read number.
+ */
+ readInt16(e: boolean): number;
+
+ /**
+ Reads an 8-bit int from the DataStream.
+ *
+ @return The read number.
+ */
+ readInt8(): number;
+
+ /**
+ Reads a 32-bit unsigned int from the DataStream with the desired endianness.
+ *
+ @return The read number.
+ */
+ readUint32(): number;
+
+ /**
+ Reads a 32-bit unsigned int from the DataStream with the desired endianness.
+ *
+ @param e Endianness of the number.
+ @return The read number.
+ */
+ readUint32(e: boolean): number;
+
+ /**
+ Reads a 16-bit unsigned int from the DataStream with the desired endianness.
+ *
+ @return The read number.
+ */
+ readUint16(): number;
+
+ /**
+ Reads a 16-bit unsigned int from the DataStream with the desired endianness.
+ *
+ @param e Endianness of the number.
+ @return The read number.
+ */
+ readUint16(e: boolean): number;
+
+ /**
+ Reads an 8-bit unsigned intfrom the DataStream.
+ *
+ @return The read number.
+ */
+ readUint8(): number;
+
+ /**
+ Reads a 32-bit float from the DataStream with the desired endianness.
+ *
+ @return The read number.
+ */
+ readFloat32(): number;
+
+ /**
+ Reads a 32-bit float from the DataStream with the desired endianness.
+ *
+ @param e Endianness of the number.
+ @return The read number.
+ */
+ readFloat32(e: boolean): number;
+
+ /**
+ Reads a 64-bit float from the DataStream with the desired endianness.
+ *
+ @return The read number.
+ */
+ readFloat64(): number;
+
+ /**
+ Reads a 64-bit float from the DataStream with the desired endianness.
+ *
+ @param e Endianness of the number.
+ @return The read number.
+ */
+ readFloat64(e: boolean): number;
+
+ /**
+ Writes a 32-bit int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ */
+ writeInt32(v: number): void;
+
+ /**
+ Writes a 32-bit int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ @param e Endianness of the number.
+ */
+ writeInt32(v: number, e: boolean): void;
+
+ /**
+ Writes a 16-bit int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ */
+ writeInt16(v: number): void;
+
+ /**
+ Writes a 16-bit int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ @param e Endianness of the number.
+ */
+ writeInt16(v: number, e: boolean): void;
+
+ /**
+ Writes an 8-bit int to the DataStream.
+ *
+ @param v Number to write.
+ */
+ writeInt8(v: number): void;
+
+ /**
+ Writes a 32-bit undigned int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ */
+ writeUint32(v: number): void;
+
+ /**
+ Writes a 32-bit undigned int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ @param e Endianness of the number.
+ */
+ writeUint32(v: number, e: boolean): void;
+
+ /**
+ Writes a 16-bit undigned int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ */
+ writeUint16(v: number): void;
+
+ /**
+ Writes a 16-bit undigned int to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ @param e Endianness of the number.
+ */
+ writeUint16(v: number, e: boolean): void;
+
+ /**
+ Writes an 8-bit undigned int to the DataStream.
+ *
+ @param v Number to write.
+ */
+ writeUint8(v: number): void;
+
+ /**
+ Writes a 32-bit float to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ */
+ writeFloat32(v: number): void;
+
+ /**
+ Writes a 32-bit float to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ @param e Endianness of the number.
+ */
+ writeFloat32(v: number, e: boolean): void;
+
+ /**
+ Writes a 64-bit float to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ */
+ writeFloat64(v: number): void;
+
+ /**
+ Writes a 64-bit float to the DataStream with the desired endianness.
+ *
+ @param v Number to write.
+ @param e Endianness of the number.
+ */
+ writeFloat64(v: number, e: boolean): void;
+
+ /**
+ Reads a struct of data from the DataStream. The struct is defined as
+ a flat array of [name, type]-pairs. See the example below:
+ *
+ ds.readStruct([
+ 'headerTag', 'uint32', // Uint32 in DataStream endianness.
+ 'headerTag2', 'uint32be', // Big-endian Uint32.
+ 'headerTag3', 'uint32le', // Little-endian Uint32.
+ 'array', ['[]', 'uint32', 16], // Uint32Array of length 16.
+ 'array2Length', 'uint32',
+ 'array2', ['[]', 'uint32', 'array2Length'] // Uint32Array of length array2Length
+ ]);
+ *
+ The possible values for the type are as follows:
+ *
+ // Number types
+ // Unsuffixed number types use DataStream endianness.
+ // To explicitly specify endianness, suffix the type with
+ // 'le' for little-endian or 'be' for big-endian,
+ // e.g. 'int32be' for big-endian int32.
+ 'uint8' -- 8-bit unsigned int
+ 'uint16' -- 16-bit unsigned int
+ 'uint32' -- 32-bit unsigned int
+ 'int8' -- 8-bit int
+ 'int16' -- 16-bit int
+ 'int32' -- 32-bit int
+ 'float32' -- 32-bit float
+ 'float64' -- 64-bit float
+ *
+ // String types
+ 'cstring' -- ASCII string terminated by a zero byte.
+ 'string:N' -- ASCII string of length N, where N is a literal integer.
+ 'string:variableName' -- ASCII string of length $variableName,
+ where 'variableName' is a previously parsed number in the current struct.
+ 'string,CHARSET:N' -- String of byteLength N encoded with given CHARSET.
+ 'u16string:N' -- UCS-2 string of length N in DataStream endianness.
+ 'u16stringle:N' -- UCS-2 string of length N in little-endian.
+ 'u16stringbe:N' -- UCS-2 string of length N in big-endian.
+ *
+ // Complex types
+ [name, type, name_2, type_2, ..., name_N, type_N] -- Struct
+ function(dataStream, struct) {} -- Callback function to read and return data.
+ {get: function(dataStream, struct) {},
+ set: function(dataStream, struct) {}}
+ -- Getter/setter functions to read and return data, handy for using the same
+ struct definition for reading and writing structs.
+ ['[]', type, length] -- Array of given type and length. The length can be either
+ a number, a string that references a previously-read
+ field, or a callback function(struct, dataStream, type){}.
+ If length is '*', reads in as many elements as it can.
+ *
+ @param structDefinition Struct definition object.
+ @return The read struct. Null if failed to read struct.
+ */
+ readStruct(structDefinition: any[]): Object;
+
+ /**
+ Writes a struct to the DataStream. Takes a structDefinition that gives the
+ types and a struct object that gives the values. Refer to readStruct for the
+ structure of structDefinition.
+ *
+ @param structDefinition Type definition of the struct.
+ @param struct The struct data object.
+ */
+ writeStruct(structDefinition: Object, struct: Object): void;
+
+ /**
+ Read UCS-2 string of desired length and endianness from the DataStream.
+ *
+ @param length The length of the string to read.
+ @return The read string.
+ */
+ readUCS2String(length: number): string;
+
+ /**
+ Read UCS-2 string of desired length and endianness from the DataStream.
+ *
+ @param length The length of the string to read.
+ @param endianness The endianness of the string data in the DataStream.
+ @return The read string.
+ */
+ readUCS2String(length: number, endianness: boolean): string;
+
+ /**
+ Write a UCS-2 string of desired endianness to the DataStream. The
+ lengthOverride argument lets you define the number of characters to write.
+ If the string is shorter than lengthOverride, the extra space is padded with
+ zeroes.
+ *
+ @param str The string to write.
+ */
+ writeUCS2String(str: string): void;
+
+ /**
+ Write a UCS-2 string of desired endianness to the DataStream. The
+ lengthOverride argument lets you define the number of characters to write.
+ If the string is shorter than lengthOverride, the extra space is padded with
+ zeroes.
+ *
+ @param str The string to write.
+ @param endianness The endianness to use for the written string data.
+ */
+ writeUCS2String(str: string, endianness: boolean): void;
+
+ /**
+ Write a UCS-2 string of desired endianness to the DataStream. The
+ lengthOverride argument lets you define the number of characters to write.
+ If the string is shorter than lengthOverride, the extra space is padded with
+ zeroes.
+ *
+ @param str The string to write.
+ @param endianness The endianness to use for the written string data.
+ @param lengthOverride The number of characters to write.
+ */
+ writeUCS2String(str: string, endianness: boolean, lengthOverride: number): void;
+
+ /**
+ Read a string of desired length and encoding from the DataStream.
+ *
+ @param length The length of the string to read in bytes.
+ @return The read string.
+ */
+ readString(length: number): string;
+
+ /**
+ Read a string of desired length and encoding from the DataStream.
+ *
+ @param length The length of the string to read in bytes.
+ @param encoding The encoding of the string data in the DataStream. Defaults to ASCII.
+ @return The read string.
+ */
+ readString(length: number, encoding: string): string;
+
+ /**
+ Writes a string of desired length and encoding to the DataStream.
+ *
+ @param s The string to write.
+ */
+ writeString(s: string): void;
+
+ /**
+ Writes a string of desired length and encoding to the DataStream.
+ *
+ @param s The string to write.
+ @param encoding The encoding for the written string data. Defaults to ASCII.
+ */
+ writeString(s: string, encoding: string): void;
+
+ /**
+ Writes a string of desired length and encoding to the DataStream.
+ *
+ @param s The string to write.
+ @param encoding The encoding for the written string data. Defaults to ASCII.
+ @param length The number of characters to write.
+ */
+ writeString(s: string, encoding: string, length: number): void;
+
+ /**
+ Read null-terminated string of desired length from the DataStream. Truncates
+ the returned string so that the null byte is not a part of it.
+ *
+ @return The read string.
+ */
+ readCString(): string;
+
+ /**
+ Read null-terminated string of desired length from the DataStream. Truncates
+ the returned string so that the null byte is not a part of it.
+ *
+ @param length The length of the string to read.
+ @return The read string.
+ */
+ readCString(length: number): string;
+
+ /**
+ Writes a null-terminated string to DataStream and zero-pads it to length
+ bytes. If length is not given, writes the string followed by a zero.
+ If string is longer than length, the written part of the string does not have
+ a trailing zero.
+ *
+ @param s The string to write.
+ */
+ writeCString(s: string): void;
+
+ /**
+ Writes a null-terminated string to DataStream and zero-pads it to length
+ bytes. If length is not given, writes the string followed by a zero.
+ If string is longer than length, the written part of the string does not have
+ a trailing zero.
+ *
+ @param s The string to write.
+ @param length The number of characters to write.
+ */
+ writeCString(s: string, length: number): void;
+
+ /**
+ Reads an object of type t from the DataStream, passing struct as the thus-far
+ read struct to possible callbacks that refer to it. Used by readStruct for
+ reading in the values, so the type is one of the readStruct types.
+ *
+ @param t Type of the object to read.
+ @return Returns the object on successful read, null on unsuccessful.
+ */
+ readType(t: Object): Object;
+
+ /**
+ Reads an object of type t from the DataStream, passing struct as the thus-far
+ read struct to possible callbacks that refer to it. Used by readStruct for
+ reading in the values, so the type is one of the readStruct types.
+ *
+ @param t Type of the object to read.
+ @param struct Struct to refer to when resolving length references and for calling callbacks.
+ @return Returns the object on successful read, null on unsuccessful.
+ */
+ readType(t: Object, struct: Object): Object;
+
+ /**
+ Writes object v of type t to the DataStream.
+ *
+ @param t Type of data to write.
+ @param v Value of data to write.
+ @param struct Struct to pass to write callback functions.
+ */
+ writeType(t: Object, v: Object, struct: Object): void;
+}
diff --git a/ace/ace.d.ts b/ace/ace.d.ts
index 29fadf3bc..72fefbc6e 100644
--- a/ace/ace.d.ts
+++ b/ace/ace.d.ts
@@ -576,7 +576,7 @@ declare module AceAjax {
/**
* Returns the current tab size.
**/
- getTabSize(): string;
+ getTabSize(): number;
/**
* Returns `true` if the character at the position is a soft tab.
@@ -1034,6 +1034,9 @@ declare module AceAjax {
* Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
**/
export interface Editor {
+
+ addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any);
+ addEventListener(ev: string, callback: Function);
inMultiSelectMode: boolean;
@@ -1710,6 +1713,13 @@ declare module AceAjax {
**/
new(renderer: VirtualRenderer, session?: IEditSession): Editor;
}
+
+ interface EditorChangeEvent {
+ start: Position;
+ end: Position;
+ action: string; // insert, remove
+ lines: any[];
+ }
////////////////////////////////
/// PlaceHolder
diff --git a/angular-file-upload/angular-file-upload-tests.ts b/angular-file-upload/angular-file-upload-tests.ts
index d59e65b4e..85dcb7853 100644
--- a/angular-file-upload/angular-file-upload-tests.ts
+++ b/angular-file-upload/angular-file-upload-tests.ts
@@ -10,35 +10,41 @@ module controllers {
static $inject = ["$upload"];
constructor(
- private $upload: ng.angularFileUpload.IUploadService
+ private $upload: angular.angularFileUpload.IUploadService
) {
}
onFileSelect($files: File[]) {
- //$files: an array of files selected, each file has name, size, and type.
- var uploads: ng.IPromise[] = [];
+ // $files: an array of files selected, each file has name, size, and type.
for (var i = 0; i < $files.length; i++) {
var file = $files[i];
- uploads.push(this.$upload.upload({
- url: "/api/upload",
- method: "POST",
- data: {
- extraData: {
- fileName: file.name, test: "anything"
- }
- },
- file: file
+ this.$upload.upload({
+ url: "/api/upload",
+ method: "POST",
+ data: {
+ extraData: {
+ fileName: file.name,
+ test: "anything"
+ }
+ },
+ file: file
+ })
+ .abort()
+ .xhr((evt: any) => {
+ console.log('xhr');
})
- .progress((evt: any) => {
- console.log('progress');
- })
- .then(success => {
- // file is uploaded successfully
- console.log(success.data);
- })
- .catch(err => {
- console.error(err);
- }));
+ .progress((evt: angular.angularFileUpload.IFileProgressEvent) => {
+ var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10);
+ console.log("upload progress: " + percent + "% for " + evt.config.file.name);
+ })
+ .error((data: any, status: number, response: any, headers: any) => {
+ console.error(data, status, response, headers);
+ })
+ .success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfig) => {
+ // file is uploaded successfully
+ console.log("Success!", data, status, headers, config);
+ });
+
}
}
}
diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts
index bd76a6e7e..d38c43226 100644
--- a/angular-file-upload/angular-file-upload.d.ts
+++ b/angular-file-upload/angular-file-upload.d.ts
@@ -1,5 +1,5 @@
-// Type definitions for Angular File Upload 1.6.7
-// Project: https://github.com/danialfarid/angular-file-upload
+// Type definitions for Angular File Upload 4.2.1
+// Project: https://github.com/danialfarid/ng-file-upload
// Definitions by: John Reilly
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -14,8 +14,9 @@ declare module angular.angularFileUpload {
}
interface IUploadPromise extends IHttpPromise {
-
+ abort(): IUploadPromise;
progress(callback: IHttpPromiseCallback): IUploadPromise;
+ xhr(callback: IHttpPromiseCallback): IUploadPromise;
}
interface IFileUploadConfig extends IRequestConfig {
@@ -23,4 +24,9 @@ declare module angular.angularFileUpload {
file: File;
fileName?: string;
}
-}
+
+ interface IFileProgressEvent extends ProgressEvent {
+
+ config: IFileUploadConfig;
+ }
+}
\ No newline at end of file
diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts
new file mode 100644
index 000000000..7f66f2611
--- /dev/null
+++ b/angular-jwt/angular-jwt-tests.ts
@@ -0,0 +1,17 @@
+///
+///
+
+var app = angular.module("angular-jwt-tests", ["angular-jwt"]);
+
+var $jwtHelper: angular.jwt.IJwtHelper;
+
+var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8';
+var tokenPayload = $jwtHelper.decodeToken(expToken);
+var date = $jwtHelper.getTokenExpirationDate(expToken);
+var bool = $jwtHelper.isTokenExpired(expToken);
+
+var $jwtInterceptor: angular.jwt.IJwtInterceptor;
+
+$jwtInterceptor.tokenGetter = () => {
+ return expToken;
+}
diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts
new file mode 100644
index 000000000..55bb3e4f6
--- /dev/null
+++ b/angular-jwt/angular-jwt.d.ts
@@ -0,0 +1,30 @@
+// Type definitions for angular-jwt 0.0.8
+// Project: https://github.com/auth0/angular-jwt
+// Definitions by: Reto Rezzonico
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module angular.jwt {
+
+ interface JwtToken {
+ iss: string;
+ sub: string;
+ aud: string;
+ exp: number;
+ nbf: number;
+ iat: number;
+ jti: string;
+ unique_name: string;
+ }
+
+ interface IJwtHelper {
+ decodeToken(token: string): JwtToken;
+ getTokenExpirationDate(token: any): Date;
+ isTokenExpired(token: any, offsetSeconds?: number): boolean;
+ }
+
+ interface IJwtInterceptor {
+ tokenGetter(): string;
+ }
+}
diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts
new file mode 100644
index 000000000..9ce0a33e9
--- /dev/null
+++ b/angular-meteor/angular-meteor-tests.ts
@@ -0,0 +1,255 @@
+///
+
+interface ITodo {
+ _id?: string;
+ name: string;
+ public?: boolean;
+ sticky?: boolean;
+}
+
+interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject {}
+
+interface CustomScope extends angular.meteor.IScope {
+ sticky: boolean;
+
+ todos: angular.meteor.AngularMeteorCollection;
+ stickyTodos: angular.meteor.AngularMeteorCollection;
+ notAutoTodos: angular.meteor.AngularMeteorCollection;
+
+ todo: ITodo;
+ todoNotAuto: TodoAngularMeteorObject;
+ todoSubscribed: TodoAngularMeteorObject;
+
+ save: (todo: ITodo) => void;
+ saveAll: () =>void;
+ autoSave: (todo: ITodo) => void;
+ remove: (todoId: string) => void;
+ removeAll: () => void;
+ removeAuto: (todo: ITodo) => void;
+ toSticky: (todo: ITodo) => void;
+}
+
+var Todos = new Mongo.Collection('todos');
+
+var app = angular.module('angularMeteorTestApp');
+
+app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => {
+ // Bind all the todos to $scope.todos
+ $scope.todos = $meteor.collection(Todos);
+
+ $scope.sticky = true;
+ // Bind all sticky todos to $scope.stickyTodos
+ // Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it
+ // to $scope.stickyTodos
+ $scope.stickyTodos = $meteor.collection(function(){
+ return Todos.find({sticky: $scope.getReactively('sticky')});
+ });
+
+ // Bind without auto-save all todos to $scope.notAutoTodos
+ $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos");
+
+ $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false);
+ $scope.todoSubscribed = $meteor.object(Todos, 'TodoID').subscribe('todos');
+ $scope.todo = $scope.todoNotAuto.getRawObject();
+ $scope.todoNotAuto.reset();
+ $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });;
+
+ // todo might be an object like this {text: "Learn Angular", sticky: false}
+ // or an array like this:
+ // [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}]
+
+ $scope.save = function(todo) {
+ $scope.notAutoTodos.save(todo);
+ };
+
+ $scope.saveAll = function() {
+ $scope.notAutoTodos.save();
+ };
+
+ $scope.autoSave = function(todo) {
+ $scope.todos.push(todo);
+ };
+
+ // todoId might be an string like this "WhrnEez5yBRgo4yEm"
+ // or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"]
+ $scope.remove = function(todoId) {
+ $scope.notAutoTodos.remove(todoId);
+ };
+
+ $scope.removeAll = function() {
+ $scope.notAutoTodos.remove();
+ };
+
+ $scope.removeAuto = function(todo) {
+ $scope.todos.splice( $scope.todos.indexOf(todo), 1 );
+ }
+
+ $scope.toSticky = function(todo) {
+ if (angular.isArray(todo)){
+ angular.forEach(todo, function(object) {
+ object.sticky = true;
+ });
+ } else {
+ todo.sticky = true;
+ }
+
+ $scope.stickyTodos.save(todo);
+ };
+
+ var todoObject = {name:'first todo'};
+ var todosArray = [{name:'second todo'}, {name:'third todo'}];
+ var todoSecondObject = {name:'forth todo'};
+
+ $scope.todos.save(todoObject); // todos equals [{name:'first todo'}]
+
+ $scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}]
+
+ $scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}]
+ // but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}]
+
+ $scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}]
+
+ $scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}]
+
+ var todoIdsArray = ['secondTodoId', 'thirdTodoId'];
+ $scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection
+
+ $scope.todos.pop(); // removes only in scope
+
+ $scope.todos.remove(); // syncs also in Meteor collection
+
+ // Subscribe ->
+
+ $meteor.subscribe('todos').then((subscriptionHandle) => {
+ // Bind all the todos to $scope.todos
+ $scope.todos = $meteor.collection(Todos);
+
+ console.log($scope.todos + ' is ready');
+
+ // You can use the subscription handle to stop the subscription if you want
+ subscriptionHandle.stop();
+ });
+
+ $scope.subscribe('todos').then((subscriptionHandle) => {
+ // Bind all the todos to $scope.books
+ $scope.todos = $meteor.collection(Todos);
+
+ console.log($scope.todos + ' is ready');
+
+ // No need to stop the subscription, it will automatically close on scope destroy
+ });
+
+ $meteor.call('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => {
+ // Handle success
+ console.log('success subscribing', data.name);
+ }, (err) => {
+ // Handle error
+ console.log('failed', err);
+ });
+
+ if (!$scope.loggingIn) {
+ $meteor.waitForUser();
+
+ $meteor.requireUser();
+
+ $meteor.requireValidUser(user => {
+ return user.username == 'admin';
+ });
+
+ $meteor.loginWithPassword('user', 'password').then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+
+ $meteor.createUser({
+ username:'moma',
+ email:'example@gmail.com',
+ password: 'Bksd@asdf',
+ profile: {expertize: 'Developer'}
+ }).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+
+ $meteor.changePassword('old', 'new232f3').then(() => {
+ console.log('Change password success');
+ }, err => {
+ console.log('Error changing password - ', err);
+ });
+
+ $meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => {
+ console.log('Success sending forgot password email');
+ }, err => {
+ console.log('Error sending forgot password email - ', err);
+ });
+
+ $meteor.resetPassword('tokenID', 'new232f3').then(() => {
+ console.log('Reset password success');
+ }, err => {
+ console.log('Error resetting password - ', err);
+ });
+
+ $meteor.verifyEmail('tokenID').then(() => {
+ console.log('Success verifying password ');
+ }, err => {
+ console.log('Error verifying password - ', err);
+ });
+
+ $meteor.logout().then(() => {
+ console.log('Logout success');
+ }, err => {
+ console.log('logout error - ', err);
+ });
+
+ $meteor.logoutOtherClients().then(() => {
+ console.log('Logout success');
+ }, err => {
+ console.log('logout error - ', err);
+ });
+
+ var loginWithOptions = {requestPermissions: ['email']};
+
+ $meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+ $meteor.loginWithGithub({requestPermissions: ['email']}).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+ $meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+ $meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+ $meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+ $meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => {
+ console.log('Login success');
+ }, err => {
+ console.log('Login error - ', err);
+ });
+ }
+
+ $meteor.autorun($scope, () => { console.log("Aurorun triggered."); });
+ $meteor.getCollectionByName('collectionName');
+
+ // requires meteor add mdg:camera
+ $meteor.getPicture().then(function(data){
+ $scope['picture'] = data;
+ });
+
+ $meteor.session('counter').bind($scope, 'counter');
+}]);
diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts
new file mode 100644
index 000000000..b3f520ac5
--- /dev/null
+++ b/angular-meteor/angular-meteor.d.ts
@@ -0,0 +1,330 @@
+// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module)
+// Project: https://github.com/Urigo/angular-meteor
+// Definitions by: Peter Grman
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+///
+
+declare module angular.meteor {
+ interface IRootScopeService extends angular.IRootScopeService {
+ /**
+ * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source.
+ */
+ currentUser: Meteor.User;
+
+ /**
+ * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress.
+ * A reactive data source. Can be use to display animation while user is logging in.
+ */
+ loggingIn: boolean;
+ }
+
+ interface IScope extends angular.IScope, IRootScopeService {
+ /**
+ * A method to get a $scope variable and watch it reactivly
+ *
+ * @param scopeVariableName - The name of the scope's variable to bind to
+ * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower
+ */
+ getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult;
+
+ /**
+ * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready.
+ * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed.
+ *
+ * @param name - Name of the subscription. Matches the name of the server's publish() call.
+ * @param publisherArguments - Optional arguments passed to publisher function on server.
+ *
+ * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle.
+ */
+ subscribe(name: string, ...publisherArguments: any[]): angular.IPromise;
+ }
+
+ /**
+ * $meteor in angularjs
+ */
+ interface IMeteorService {
+ /**
+ * A service that wraps the Meteor collections to enable reactivity within AngularJS.
+ *
+ * @param collection - A Meteor Collection or a reactive function to bind to.
+ * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor.
+ * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection.
+ * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection.
+ */
+ collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection;
+
+ /**
+ * A service that wraps the Meteor collections to enable reactivity within AngularJS.
+ *
+ * @param collection - A Meteor Collection or a reactive function to bind to.
+ * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor.
+ * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection.
+ * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection.
+ * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete).
+ */
+ collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2;
+
+ /**
+ * A service that wraps a Meteor object to enable reactivity within AngularJS.
+ * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne
+ *
+ * @param collection - A Meteor Collection to bind to.
+ * @param selector - A query describing the documents to find or just the ID of the document.
+ * - $meteor.object will find the first document that matches the selector,
+ * - as ordered by sort and skip options, exactly like Meteor's collection.findOne
+ * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object.
+ * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object.
+ */
+ object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject;
+
+ /**
+ * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready.
+ *
+ * @param name - Name of the subscription. Matches the name of the server's publish() call.
+ * @param publisherArguments - Optional arguments passed to publisher function on server.
+ *
+ * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle.
+ */
+ subscribe(name: string, ...publisherArguments: any[]): angular.IPromise;
+
+ /**
+ * A service service which wraps up Meteor.methods with AngularJS promises.
+ *
+ * @param name - Name of method to invoke
+ * @param methodArguments - Optional method arguments
+ *
+ * @return The promise solves successfully with the return value of the method or return reject with the error from the method.
+ */
+ call(name: string, ...methodArguments: any[]): angular.IPromise;
+
+ // User Authentication BEGIN ->
+
+ /**
+ * Returns a promise fulfilled with the currentUser when the user subscription is ready.
+ * This is useful when you want to grab the current user before the route is rendered.
+ * If there is no logged in user, it will return null.
+ * See the “Authentication with Routers” section of our tutorial for more information and a full example.
+ */
+ waitForUser(): angular.IPromise;
+
+ /**
+ * Resolves the promise successfully if a user is authenticated and rejects otherwise.
+ * This is useful in cases where you want to require a route to have an authenticated user.
+ * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page.
+ * See the “Authentication with Routers” section of our tutorial for more information and a full example.
+ */
+ requireUser(): angular.IPromise;
+
+ /**
+ * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise.
+ * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group.
+ * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page.
+ * See the “Authentication with Routers” section of our tutorial for more information and a full example.
+ *
+ * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve.
+ * If it returns a string, the promise will be rejected using said string as the reason.
+ * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason.
+ */
+ requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise;
+
+ /**
+ * Log the user in with a password.
+ *
+ * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id.
+ * @param password - The user's password.
+ */
+ loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise;
+
+ /**
+ * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser
+ *
+ * @param options.username - A unique name for this user. Either this, or email is required.
+ * @param options.email - The user's email address. Either this, or username is required.
+ * @param options.password - The user's password. This is not sent in plain text over the wire.
+ * @param options.profile - The user's profile, typically including the name field.
+ */
+ createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise;
+
+ /**
+ * Change the current user's password. Must be logged in.
+ *
+ * @param oldPassword - The user's current password. This is not sent in plain text over the wire.
+ * @param newPassword - A new password for the user. This is not sent in plain text over the wire.
+ */
+ changePassword(oldPassword: string, newPassword: string): angular.IPromise;
+
+ /**
+ * Request a forgot password email.
+ *
+ * @param options.email - The email address to send a password reset link.
+ */
+ forgotPassword(options: {email: string}): angular.IPromise;
+
+ /**
+ * Reset the password for a user using a token received in email. Logs the user in afterwards.
+ *
+ * @param token - The token retrieved from the reset password URL.
+ * @param newPassword - A new password for the user. This is not sent in plain text over the wire.
+ */
+ resetPassword(token: string, newPassword: string): angular.IPromise;
+
+ /**
+ * Marks the user's email address as verified. Logs the user in afterwards.
+ *
+ * @param token - The token retrieved from the reset password URL.
+ */
+ verifyEmail(token: string): angular.IPromise;
+
+ loginWithFacebook: ILoginWithExternalService;
+ loginWithTwitter: ILoginWithExternalService;
+ loginWithGoogle: ILoginWithExternalService;
+ loginWithGithub: ILoginWithExternalService;
+ loginWithMeetup: ILoginWithExternalService;
+ loginWithWeibo: ILoginWithExternalService;
+
+ /**
+ * Log the user out.
+ *
+ * @return Resolves with no arguments on success, or reject with a Error argument on failure.
+ */
+ logout(): angular.IPromise;
+
+ /**
+ * Log out other clients logged in as the current user, but does not log out the client that calls this function.
+ * For example, when called in a user's browser, connections in that browser remain logged in,
+ * but any other browsers or DDP clients logged in as that user will be logged out.
+ *
+ * @return Resolves with no arguments on success, or reject with a Error argument on failure.
+ */
+ logoutOtherClients(): angular.IPromise;
+
+ // <- User Authentication END
+ // $meteorUtils BEGIN ->
+
+ /**
+ * @param scope - The AngularJS scope you use the autorun on.
+ * @param fn - The function that will re-run every time a reactive variable changes inside it.
+ */
+ autorun(scope: angular.IScope, fn: Function): void;
+
+ /**
+ * @param collectionName - The name of the collection you want to get back
+ */
+ getCollectionByName(collectionName: string): Mongo.Collection;
+
+ // <- $meteorUtils END
+ // $meteorCamera BEGIN ->
+
+ /**
+ * A helper service for taking pictures across platforms.
+ * Must add mdg:camera package to use! (meteor add mdg:camera)
+ *
+ * @param [options] - options is an optional argument that is an Object with the following possible keys:
+ * @param options.width - An integer that specifies the minimum width of the returned photo.
+ * @param options.height - An integer that specifies the minimum height of the returned photo.
+ * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding.
+ *
+ * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error.
+ */
+ getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise;
+
+ // <- $meteorCamera END
+
+ /**
+ * A service that binds a scope variable to a Meteor Session variable.
+ *
+ * @param sessionKey - The name of the session variable
+ * @return An object with a single function bind - to bind to that variable.
+ */
+ session(sessionKey: string): {
+ /**
+ * @param scope - The scope the document will be bound to.
+ * @param model - The name of the scope's model variable that the document will be bound to.
+ */
+ bind: (scope: IScope, model: string) => void;
+ };
+ }
+
+ /**
+ * An object that connects a Meteor Object to an AngularJS scope variable.
+ *
+ * The object contains also all the properties from the generic type T,
+ * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates).
+ * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this:
+ *
+ * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { }
+ * var todo = $meteor.object(TodoCollection, 'TodoID');
+ */
+ interface AngularMeteorObject {
+ /**
+ * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is.
+ * - Unchanged properties will be overridden with their existing values, which may trigger hooks.
+ * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved.
+ *
+ * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success.
+ */
+ save(doc?: T): angular.IPromise;
+
+ /**
+ * Reset the current value of the object to the one in the server.
+ */
+ reset(): void;
+
+ /**
+ * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed.
+ * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON.
+ */
+ getRawObject(): T;
+
+ /**
+ * A shorten (Syntactic sugar) function for the $meteor.subscribe function.
+ * Takes only one parameter and not returns a promise like $meteor.subscribe does.
+ *
+ * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service.
+ */
+ subscribe(subscriptionName:string): AngularMeteorObject;
+ }
+
+ /**
+ * An object that connects a Meteor Collection to an AngularJS scope variable
+ */
+ interface AngularMeteorCollection extends AngularMeteorCollection2 { }
+
+ /**
+ * An object that connects a Meteor Collection to an AngularJS scope variable,
+ * but can use a differen type for updates.
+ */
+ interface AngularMeteorCollection2 extends Array {
+ /**
+ * @param [docs] - The docs to save to the Meteor Collection.
+ * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is.
+ * - If an object is passed, the method pushes that object into the AngularMeteorCollection.
+ * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection.
+ */
+ save(docs?: U|U[]): void;
+
+ /**
+ * @param [keys] - The keys of the object to remove from the Meteor Collection.
+ * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection.
+ * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection.
+ * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection.
+ */
+ remove(keys?: U|string|number|string[]|number[]): void;
+
+ /**
+ * A shorten (Syntactic sugar) function for the $meteor.subscribe function.
+ * Takes only one parameter and not returns a promise like $meteor.subscribe does.
+ *
+ * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service.
+ */
+ subscribe(subscriptionName:string): AngularMeteorCollection2;
+ }
+
+ interface ILoginWithExternalService {
+ (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise;
+ }
+
+ interface ReactiveResult { }
+}
diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts
index bfc573dcc..87a75439b 100644
--- a/angular-translate/angular-translate.d.ts
+++ b/angular-translate/angular-translate.d.ts
@@ -6,13 +6,7 @@
///
declare module angular.translate {
-
- interface ITranslatePartialLoaderService {
- addPart(name: string): ITranslatePartialLoaderService;
- deletePart(name: string, removeData?: boolean): ITranslatePartialLoaderService;
- isPartAvailable(name: string): boolean;
- }
-
+
interface ITranslationTable {
[key: string]: string;
}
@@ -26,12 +20,27 @@ declare module angular.translate {
set(name: string, value: string): void;
}
- interface ISTaticFilesLoaderOptions {
+ interface IStaticFilesLoaderOptions {
prefix: string;
suffix: string;
key?: string;
}
+ interface IPartialLoader {
+ addPart(name : string, priority? : number) : T;
+ deletePart(name : string) : T;
+ isPartAvailable(name : string) : boolean;
+ }
+
+ interface ITranslatePartialLoaderService extends IPartialLoader {
+ getRegisteredParts() : Array;
+ isPartLoaded(name : string, lang : string) : boolean;
+ }
+
+ interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader {
+ setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider;
+ }
+
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise;
(translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>;
@@ -78,7 +87,7 @@ declare module angular.translate {
storageKey(): string;
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
useUrlLoader(url: string): ITranslateProvider;
- useStaticFilesLoader(options: ISTaticFilesLoaderOptions): ITranslateProvider;
+ useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider;
useLoader(loaderFactory: string, options: any): ITranslateProvider;
useLocalStorage(): ITranslateProvider;
useCookieStorage(): ITranslateProvider;
diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts
index d636c88e6..c649301e3 100644
--- a/angularfire/angularfire-tests.ts
+++ b/angularfire/angularfire-tests.ts
@@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
// AngularFireObject
{
- var obj = sync.$asObject();
+ var obj = $FirebaseObject(ref);
// $id
if (obj.$id !== ref.name()) throw "error";
@@ -63,7 +63,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
});
// $ref()
- if (obj.$ref() !== sync) throw "error";
+ if (obj.$ref() !== ref) throw "error";
// $bindTo()
obj.$bindTo($scope, "data").then(function () {
@@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
// AngularFireArray
{
- var list = sync.$asArray();
+ var list = $FirebaseArray(ref);
// $ref()
- if (list.$ref() !== sync) throw "error";
+ if (list.$ref() !== ref) throw "error";
// $add()
list.$add({ foo: "foo value" });
diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts
index 46d95750c..b1e7f4c2e 100644
--- a/angularfire/angularfire.d.ts
+++ b/angularfire/angularfire.d.ts
@@ -10,6 +10,9 @@ interface AngularFireService {
(firebase: Firebase, config?: any): AngularFire;
}
+/**
+ * @deprecated. Not possible with AngularFire 1.0+
+ */
interface AngularFire {
$asArray(): AngularFireArray;
$asObject(): AngularFireObject;
@@ -24,37 +27,279 @@ interface AngularFire {
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise;
}
+/**
+ * Creates and maintains a synchronized object, with 2-way bindings between Angular and Firebase.
+ */
interface AngularFireObject extends AngularFireSimpleObject {
$id: string;
$priority: number;
$value: any;
+
+ /**
+ * Removes all keys from the FirebaseObject and also removes
+ * the remote data from the server.
+ *
+ * @returns a promise which will resolve after the op completes
+ */
+
$remove(): ng.IPromise;
+ /**
+ * Saves all data on the FirebaseObject back to Firebase.
+ * @returns a promise which will resolve after the save is completed.
+ */
$save(): ng.IPromise;
+
+ /**
+ * The loaded method is invoked after the initial batch of data arrives from the server.
+ * When this resolves, all data which existed prior to calling $asObject() is now cached
+ * locally in the object.
+ *
+ * As a shortcut is also possible to pass resolve/reject methods directly into this
+ * method just as they would be passed to .then()
+ *
+ * @param {Function} resolve
+ * @param {Function} reject
+ * @returns a promise which resolves after initial data is downloaded from Firebase
+ */
$loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise;
+
+ /**
+ * The loaded method is invoked after the initial batch of data arrives from the server.
+ * When this resolves, all data which existed prior to calling $asObject() is now cached
+ * locally in the object.
+ *
+ * As a shortcut is also possible to pass resolve/reject methods directly into this
+ * method just as they would be passed to .then()
+ *
+ * @param {Function} resolve
+ * @param {Function} reject
+ * @returns a promise which resolves after initial data is downloaded from Firebase
+ */
$loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise;
+
+ /**
+ * The loaded method is invoked after the initial batch of data arrives from the server.
+ * When this resolves, all data which existed prior to calling $asObject() is now cached
+ * locally in the object.
+ *
+ * As a shortcut is also possible to pass resolve/reject methods directly into this
+ * method just as they would be passed to .then()
+ *
+ * @param {Function} resolve
+ * @param {Function} reject
+ * @returns a promise which resolves after initial data is downloaded from Firebase
+ */
$loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise;
- $ref(): AngularFire;
+
+ /**
+ * @returns {Firebase} the original Firebase instance used to create this object.
+ */
+ $ref(): Firebase;
+
+ /**
+ * Creates a 3-way data sync between this object, the Firebase server, and a
+ * scope variable. This means that any changes made to the scope variable are
+ * pushed to Firebase, and vice versa.
+ *
+ * If scope emits a $destroy event, the binding is automatically severed. Otherwise,
+ * it is possible to unbind the scope variable by using the `unbind` function
+ * passed into the resolve method.
+ *
+ * Can only be bound to one scope variable at a time. If a second is attempted,
+ * the promise will be rejected with an error.
+ *
+ * @param {object} scope
+ * @param {string} varName
+ * @returns a promise which resolves to an unbind method after data is set in scope
+ */
$bindTo(scope: ng.IScope, varName: string): ng.IPromise;
+
+ /**
+ * Listeners passed into this method are notified whenever a new change is received
+ * from the server. Each invocation is sent an object containing
+ * { type: 'value', key: 'my_firebase_id' }
+ *
+ * This method returns an unbind function that can be used to detach the listener.
+ *
+ * @param {Function} cb
+ * @param {Object} [context]
+ * @returns {Function} invoke to stop observing events
+ */
$watch(callback: Function, context?: any): Function;
+
+ /**
+ * Informs $firebase to stop sending events and clears memory being used
+ * by this object (delete's its local content).
+ */
$destroy(): void;
}
interface AngularFireObjectService {
+ /**
+ * Creates a synchronized object with 2-way bindings between Angular and Firebase.
+ *
+ * @param {Firebase} ref
+ * @returns {FirebaseObject}
+ */
(firebase: Firebase): AngularFireObject;
$extend(ChildClass: Object, methods?: Object): Object;
}
+/**
+ * Creates and maintains a synchronized list of data. This is a pseudo-read-only array. One should
+ * not call splice(), push(), pop(), et al directly on this array, but should instead use the
+ * $remove and $add methods.
+ *
+ * It is acceptable to .sort() this array, but it is important to use this in conjunction with
+ * $watch(), so that it will be re-sorted any time the server data changes. Examples of this are
+ * included in the $watch documentation.
+ */
interface AngularFireArray extends Array {
+ /**
+ * Create a new record with a unique ID and add it to the end of the array.
+ * This should be used instead of Array.prototype.push, since those changes will not be
+ * synchronized with the server.
+ *
+ * Any value, including a primitive, can be added in this way. Note that when the record
+ * is created, the primitive value would be stored in $value (records are always objects
+ * by default).
+ *
+ * Returns a future which is resolved when the data has successfully saved to the server.
+ * The resolve callback will be passed a Firebase ref representing the new data element.
+ *
+ * @param data
+ * @returns a promise resolved after data is added
+ */
$add(newData: any): ng.IPromise;
+
+ /**
+ * Pass either an item in the array or the index of an item and it will be saved back
+ * to Firebase. While the array is read-only and its structure should not be changed,
+ * it is okay to modify properties on the objects it contains and then save those back
+ * individually.
+ *
+ * Returns a future which is resolved when the data has successfully saved to the server.
+ * The resolve callback will be passed a Firebase ref representing the saved element.
+ * If passed an invalid index or an object which is not a record in this array,
+ * the promise will be rejected.
+ *
+ * @param {int|object} indexOrItem
+ * @returns a promise resolved after data is saved
+ */
$save(recordOrIndex: any): ng.IPromise;
+
+ /**
+ * Pass either an existing item in this array or the index of that item and it will
+ * be removed both locally and in Firebase. This should be used in place of
+ * Array.prototype.splice for removing items out of the array, as calling splice
+ * will not update the value on the server.
+ *
+ * Returns a future which is resolved when the data has successfully removed from the
+ * server. The resolve callback will be passed a Firebase ref representing the deleted
+ * element. If passed an invalid index or an object which is not a record in this array,
+ * the promise will be rejected.
+ *
+ * @param {int|object} indexOrItem
+ * @returns a promise which resolves after data is removed
+ */
$remove(recordOrIndex: any): ng.IPromise;
+
+ /**
+ * Returns the record for a given Firebase key (record.$id). If the record is not found
+ * then returns null.
+ *
+ * @param {string} key
+ * @returns {Object|null} a record in this array
+ */
$getRecord(key: string): AngularFireSimpleObject;
+
+ /**
+ * Given an item in this array or the index of an item in the array, this returns the
+ * Firebase key (record.$id) for that record. If passed an invalid key or an item which
+ * does not exist in this array, it will return null.
+ *
+ * @param {int|object} indexOrItem
+ * @returns {null|string}
+ */
$keyAt(recordOrIndex: any): string;
+
+ /**
+ * The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the
+ * index in the array where that record is stored. If the record is not in the array,
+ * this method returns -1.
+ *
+ * @param {String} key
+ * @returns {int} -1 if not found
+ */
$indexFor(key: string): number;
+
+ /**
+ * The loaded method is invoked after the initial batch of data arrives from the server.
+ * When this resolves, all data which existed prior to calling $asArray() is now cached
+ * locally in the array.
+ *
+ * As a shortcut is also possible to pass resolve/reject methods directly into this
+ * method just as they would be passed to .then()
+ *
+ * @param {Function} [resolve]
+ * @param {Function} [reject]
+ * @returns a promise
+ */
$loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise;
+
+ /**
+ * The loaded method is invoked after the initial batch of data arrives from the server.
+ * When this resolves, all data which existed prior to calling $asArray() is now cached
+ * locally in the array.
+ *
+ * As a shortcut is also possible to pass resolve/reject methods directly into this
+ * method just as they would be passed to .then()
+ *
+ * @param {Function} [resolve]
+ * @param {Function} [reject]
+ * @returns a promise
+ */
$loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise;
+
+ /**
+ * The loaded method is invoked after the initial batch of data arrives from the server.
+ * When this resolves, all data which existed prior to calling $asArray() is now cached
+ * locally in the array.
+ *
+ * As a shortcut is also possible to pass resolve/reject methods directly into this
+ * method just as they would be passed to .then()
+ *
+ * @param {Function} [resolve]
+ * @param {Function} [reject]
+ * @returns a promise
+ */
$loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise;
- $ref(): AngularFire;
+
+ /**
+ * @returns {Firebase} the original Firebase ref used to create this object.
+ */
+ $ref(): Firebase;
+
+ /**
+ * Listeners passed into this method are notified whenever a new change (add, updated,
+ * move, remove) is received from the server. Each invocation is sent an object
+ * containing { type: 'child_added|child_updated|child_moved|child_removed',
+ * key: 'key_of_item_affected'}
+ *
+ * Additionally, added and moved events receive a prevChild parameter, containing the
+ * key of the item before this one in the array.
+ *
+ * This method returns a function which can be invoked to stop observing events.
+ *
+ * @param {Function} cb
+ * @param {Object} [context]
+ * @returns {Function} used to stop observing
+ */
$watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function;
+
+ /**
+ * Informs $firebase to stop sending events and clears memory being used
+ * by this array (delete's its local content).
+ */
$destroy(): void;
}
interface AngularFireArrayService {
@@ -75,20 +320,160 @@ interface AngularFireAuthService {
}
interface AngularFireAuth {
+ /**
+ * Authenticates the Firebase reference with a custom authentication token.
+ *
+ * @param {string} authToken An authentication token or a Firebase Secret. A Firebase Secret
+ * should only be used for authenticating a server process and provides full read / write
+ * access to the entire Firebase.
+ * @param {Object} [options] An object containing optional client arguments, such as configuring
+ * session persistence.
+ * @return {Promise