Merge pull request #12841 from DefinitelyTyped/types-merge-20161118

Types merge 2016-11-18
This commit is contained in:
Nathan Shively-Sanders
2016-11-22 11:08:06 -08:00
committed by GitHub
110 changed files with 10099 additions and 2339 deletions
+2 -1
View File
@@ -37,5 +37,6 @@ node_modules
.sublimets
.settings/launch.json
.vscode
yarn.lock
yarn.lock
+2 -1
View File
@@ -1665,7 +1665,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](supertest/supertest.d.ts) [SuperTest](https://github.com/visionmedia/supertest) by [Alex Varju](https://github.com/varju)
* [:link:](supertest-as-promised/supertest-as-promised.d.ts) [SuperTest as Promised](https://github.com/WhoopInc/supertest-as-promised) by [Tanguy Krotoff](https://github.com/tkrotoff)
* [:link:](svg-injector/svg-injector.d.ts) [SVG Injector](https://github.com/iconic/SVGInjector) by [Patrick Westerhoff](https://github.com/poke)
* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact)
* [:link:](svg-pan-zoom/svg-pan-zoom-2.3.9.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact)
* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [César Vidril](https://github.com/Yimiprod)
* [:link:](svg-sprite/svg-sprite.d.ts) [svg-sprite](https://github.com/jkphl/svg-sprite) by [Qubo](https://github.com/tkqubo)
* [:link:](svgjs/svgjs.d.ts) [svg.js](http://www.svgjs.com) by [Sean Hess](https://seanhess.github.io)
* [:link:](svg2png/svg2png.d.ts) [svg2png node package](https://github.com/domenic/svg2png) by [hans windhoff](https://github.com/hansrwindhoff)
+13 -8
View File
@@ -55,18 +55,23 @@ Before you share your improvement with the world, use it yourself.
#### Test editing an exiting package
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`,
or copy them from there and paste inside of `declarations.d.ts` and follow the steps below.
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below.
#### Test a new package
* Add a new file `declarations.d.ts` to your project.
* Add it to the compilation, through `"includes"` or `"files"` in your [tsconfig](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html),
or through a `/// <reference path="" />` declaration in your code.
* Inside `declarations.d.ts`, write `declare module "foo" { }`, then write the module declaration inside.
* Test that your code works.
* *Then*, once you've tested your definitions, make a PR contributing the definition.
Add to your `tsconfig.json`:
```json
"baseUrl": "types",
"typeRoots": ["types"],
```
(You can also use `src/types`.)
Create `types/foo/index.d.ts` containing declarations for the module "foo".
You should now be able import from `"foo"` in your code and it will route to the new type definition.
Then build *and* run the code to make sure your type definition actually corresponds to what happens at runtime.
Once you've tested your definitions with real code, make a PR contributing the definition by copying `types/foo` to `DefinitelyTyped/foo` and adding a `tsconfig.json` and `foo-tests.ts`.
### Make a pull request
+3
View File
@@ -24,6 +24,9 @@ declare namespace AmCharts {
/** Set it to true if you want UTC time to be used instead of local time. */
var useUTC: boolean;
/** Object with themes */
var themes: any;
/** Clears all the charts on page, removes listeners and intervals. */
function clear(): void;
+1 -1
View File
@@ -76,4 +76,4 @@ declare namespace ncy {
**/
getLastStep(): angular.ui.IState;
}
}
}
+5 -4
View File
@@ -76,7 +76,7 @@ declare module 'angular' {
}
interface IColorService {
applyThemeColors(element: Element|JQuery, colorExpression: IColorExpression): void;
applyThemeColors(element: Element | JQuery, colorExpression: IColorExpression): void;
getThemeColor(expression: string): string;
hasTheme(): boolean;
}
@@ -158,7 +158,7 @@ declare module 'angular' {
hideDelay(delay: number): T;
position(position: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
toastClass(toastClass: string): T;
toastClass(toastClass: string): T;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
@@ -225,7 +225,7 @@ declare module 'angular' {
hues: IThemeHues;
}
interface IBrowserColors{
interface IBrowserColors {
theme: string;
palette: string;
hue: string;
@@ -264,6 +264,7 @@ declare module 'angular' {
definePalette(name: string, palette: IPalette): IThemingProvider;
enableBrowserColor(browserColors: IBrowserColors): Function;
extendPalette(name: string, palette: IPalette): IPalette;
registerStyles(styles: String): void;
setDefaultTheme(theme: string): void;
setNonce(nonce: string): void;
theme(name: string, inheritFrom?: string): ITheme;
@@ -414,7 +415,7 @@ declare module 'angular' {
ESCAPE: string,
};
absPosition: {
TOP: string,
TOP: string,
RIGHT: string,
BOTTOM: string,
LEFT: string,
+8 -1
View File
@@ -3,7 +3,13 @@
// Definitions by: vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// copy from assert external module in node.d.ts
// Definitions for commonjs-assert match that of node.js' assert module,
// but commonjs-assert is intended to be used as an independent module,
// for instance when making a stand-alone site or app that doesn't have
// access to node modules. For that reason, these definitions define a
// "assert" module. This will conflict with node.d.ts and other assert
// modules such as "power-assert", but a project should realistically
// only be using one of these at a time.
declare function assert(value:any, message?:string):void;
declare namespace assert {
@@ -50,3 +56,4 @@ declare namespace assert {
export function ifError(value:any):void;
}
+67 -66
View File
@@ -7,22 +7,23 @@ declare var path: {
exists: (path: string, callback?: (err: Error, exists: boolean) => any) => void;
};
function funcStringCbErrBoolean(v:string, cb:(err:Error,res:boolean) => void) {}
function callback() { }
async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { });
async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err, results) { });
async.map(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err:Error, results:Array<fs.Stats>) { });
async.filter(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.filterSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.filterLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.select(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.selectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.selectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.filter(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.filterSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.filterLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.select(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.selectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.selectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.reject(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.rejectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { });
async.rejectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { });
async.reject(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.rejectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.rejectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array<string>) { });
async.parallel([
function () { },
@@ -46,9 +47,9 @@ var openFilesObj = {
file2: "fileTwo"
}
var saveFile = function () { }
async.each(openFiles, saveFile, function (err) { });
async.eachSeries(openFiles, saveFile, function (err) { });
var saveFile = function (file:string,cb:(err:Error)=>void) { }
async.each(openFiles, saveFile, function (err:Error) { });
async.eachSeries(openFiles, saveFile, function (err:Error) { });
var documents: any, requestApi: any;
async.eachLimit(documents, 20, requestApi, function (err) { });
@@ -77,9 +78,9 @@ async.foldl(numArray, 0, reducer, function (err, result) { });
async.reduceRight(numArray, 0, reducer, function (err, result) { });
async.foldr(numArray, 0, reducer, function (err, result) { });
async.detect(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.detectSeries(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.detectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.detect(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err: Error,result:string) { });
async.detectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err,result) { });
async.detectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err,result) { });
async.sortBy(['file1', 'file2', 'file3'], function (file, callback) {
fs.stat(file, function (err, stats) {
@@ -87,13 +88,13 @@ async.sortBy(['file1', 'file2', 'file3'], function (file, callback) {
});
}, function (err, results) { });
async.some(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.someLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.any(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.some(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.someLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.any(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.every(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.everyLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { });
async.all(['file1', 'file2', 'file3'], path.exists, function (result) { });
async.every(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.everyLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.all(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { });
async.concat(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { });
async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { });
@@ -111,7 +112,7 @@ async.series([
],
function (err, results) { });
async.series<string>([
async.series<string,Error>([
function (callback) {
callback(undefined, 'one');
},
@@ -135,7 +136,7 @@ async.series({
},
function (err, results) { });
async.series<number>({
async.series<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
@@ -175,7 +176,7 @@ async.parallel([
],
function (err, results) { });
async.parallel<string>([
async.parallel<string,Error>([
function (callback) {
setTimeout(function () {
callback(undefined, 'one');
@@ -204,7 +205,7 @@ async.parallel({
},
function (err, results) { });
async.parallel<number>({
async.parallel<number,Error>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
@@ -270,7 +271,7 @@ async.waterfall([
], function (err, result) { });
var q = async.queue<any>(function (task: any, callback: any) {
var q = async.queue<any,Error>(function (task: any, callback: () => void) {
console.log('hello ' + task.name);
callback();
}, 2);
@@ -323,7 +324,7 @@ q.resume();
q.kill();
// tests for strongly typed tasks
var q2 = async.queue<string>(function (task: string, callback: any) {
var q2 = async.queue<string,Error>(function (task: string, callback: () => void) {
console.log('Task: ' + task);
callback();
}, 1);
@@ -386,10 +387,10 @@ async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }
async.parallel([
function (callback) { },
function (callback: ( err:Error, val:string ) => void ) { },
function (callback) { }
],
function (results) {
function (err:Error,results:Array<string>) {
async.series([
function (callback) { },
function email_link(callback) { }
@@ -442,10 +443,10 @@ async.dir(function (name: string, callback: any) {
// each
async.each<number>({
async.each<number,Error>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback): void {
}, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -461,10 +462,10 @@ async.each<number>({
});
async.eachSeries<number>({
async.eachSeries<number, Error>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback): void {
}, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -480,14 +481,14 @@ async.eachSeries<number>({
});
async.eachLimit<number>({
async.eachLimit<number, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: ErrorCallback): void {
}, 2, function(val: number, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -505,10 +506,10 @@ async.eachLimit<number>({
// forEachOf/eachOf
async.eachOf<number>({
async.eachOf<number, Error>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback): void {
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -524,10 +525,10 @@ async.eachOf<number>({
});
async.forEachOfSeries<number>({
async.forEachOfSeries<number, Error>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback): void {
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -543,14 +544,14 @@ async.forEachOfSeries<number>({
});
async.forEachOfLimit<number>({
async.forEachOfLimit<number, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, key: string, next: ErrorCallback): void {
}, 2, function(val: number, key: string, next: ErrorCallback<Error>): void {
setTimeout(function(): void {
@@ -568,11 +569,11 @@ async.forEachOfLimit<number>({
// map
async.map<number, string>({
async.map<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string>): void {
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -588,11 +589,11 @@ async.map<number, string>({
});
async.mapSeries<number, string>({
async.mapSeries<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string>): void {
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -608,14 +609,14 @@ async.mapSeries<number, string>({
});
async.mapLimit<number, string>({
async.mapLimit<number, string, Error>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: AsyncResultCallback<string>): void {
}, 2, function(val: number, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -633,11 +634,11 @@ async.mapLimit<number, string>({
// mapValues
async.mapValues<number, string>({
async.mapValues<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -653,11 +654,11 @@ async.mapValues<number, string>({
});
async.mapValuesSeries<number, string>({
async.mapValuesSeries<number, string, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
setTimeout(function(): void {
@@ -675,11 +676,11 @@ async.mapValuesSeries<number, string>({
// filter/select/reject
async.filter<number>({
async.filter<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback): void {
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
setTimeout(function(): void {
@@ -695,11 +696,11 @@ async.filter<number>({
});
async.reject<number>({
async.reject<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback): void {
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
setTimeout(function(): void {
@@ -717,11 +718,11 @@ async.reject<number>({
// concat
async.concat<string, string>({
async.concat<string, string, Error>({
"a": "1",
"b": "2",
"c": "3"
}, function(item: string, next: AsyncResultCallback<string[]>): void {
}, function(item: string, next: AsyncResultCallback<string[], Error>): void {
console.log(`async.concat: ${item}`);
@@ -735,11 +736,11 @@ async.concat<string, string>({
// detect/find
async.detect<number>({
async.detect<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback): void {
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.detect/find: ${item}`);
@@ -760,11 +761,11 @@ async.detect<number>({
// every/all
async.every<number>({
async.every<number,Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback): void {
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.every/all: ${item}`);
@@ -778,11 +779,11 @@ async.every<number>({
// some/any
async.some<number>({
async.some<number, Error>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback): void {
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
console.log(`async.some/any: ${item}`);
+88 -88
View File
@@ -5,22 +5,22 @@
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback { (err?: Error): void; }
interface AsyncWaterfallCallback { (err: Error, ...args: any[]): void; }
interface AsyncBooleanResultCallback { (err: Error, truthValue: boolean): void; }
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
interface ErrorCallback<T> { (err?: T): void; }
interface AsyncWaterfallCallback<E> { (err: E, ...args: any[]): void; }
interface AsyncBooleanResultCallback<E> { (err: E, truthValue: boolean): void; }
interface AsyncResultCallback<T, E> { (err: E, result: T): void; }
interface AsyncResultArrayCallback<T, E> { (err: E, results: T[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
interface AsyncFunction<T> { (callback: (err?: Error, result?: T) => void): void; }
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
interface AsyncForEachOfIterator<T> { (item: T, key: number|string, callback: ErrorCallback): void; }
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncResultCallback<R>): void; }
interface AsyncBooleanIterator<T> { (item: T, callback: AsyncBooleanResultCallback): void; }
interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
interface AsyncWorker<T> { (task: T, callback: ErrorCallback): void; }
interface AsyncVoidFunction { (callback: ErrorCallback): void; }
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
interface AsyncVoidFunction<E> { (callback: ErrorCallback<E>): void; }
interface AsyncQueue<T> {
length(): number;
@@ -28,10 +28,10 @@ interface AsyncQueue<T> {
running(): number;
idle(): boolean;
concurrency: number;
push(task: T, callback?: ErrorCallback): void;
push(task: T[], callback?: ErrorCallback): void;
unshift(task: T, callback?: ErrorCallback): void;
unshift(task: T[], callback?: ErrorCallback): void;
push<E>(task: T, callback?: ErrorCallback<E>): void;
push<E>(task: T[], callback?: ErrorCallback<E>): void;
unshift<E>(task: T, callback?: ErrorCallback<E>): void;
unshift<E>(task: T[], callback?: ErrorCallback<E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
@@ -53,8 +53,8 @@ interface AsyncPriorityQueue<T> {
concurrency: number;
started: boolean;
paused: boolean;
push(task: T, priority: number, callback?: AsyncResultArrayCallback<T>): void;
push(task: T[], priority: number, callback?: AsyncResultArrayCallback<T>): void;
push<E>(task: T, priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
push<E>(task: T[], priority: number, callback?: AsyncResultArrayCallback<T, E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
@@ -90,122 +90,122 @@ interface AsyncCargo {
interface Async {
// Collections
each<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
each<T>(arr: Dictionary<T>, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
each<T, E>(arr: T[], iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
each<T, E>(arr: Dictionary<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
eachSeries: typeof async.each;
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachLimit<T, E>(arr: T[], limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
eachLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
forEach: typeof async.each;
forEachSeries: typeof async.each;
forEachLimit: typeof async.eachLimit;
forEachOf<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOf<T>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOf<T, E>(obj: T[], iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOf<T, E>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOfSeries: typeof async.forEachOf;
forEachOfLimit<T>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfLimit<T>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfLimit<T, E>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
forEachOfLimit<T, E>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
eachOf: typeof async.forEachOf;
eachOfSeries: typeof async.forEachOf;
eachOfLimit: typeof async.forEachOfLimit;
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
map<T, R>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
map<T, R, E>(arr: T[], iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
map<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapSeries: typeof async.map;
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
mapLimit<T, R>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
mapValuesLimit<T, R>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapValues<T, R>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
mapLimit<T, R, E>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapLimit<T, R, E>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultCallback<R[], E>): void;
mapValuesSeries: typeof async.mapValues;
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filter<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filter<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filter<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filterSeries: typeof async.filter;
filterLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filterLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
filterLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
filterLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
select: typeof async.filter;
selectSeries: typeof async.filter;
selectLimit: typeof async.filterLimit;
reject: typeof async.filter;
rejectSeries: typeof async.filter;
rejectLimit: typeof async.filterLimit;
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): void;
reduce<T, R, E>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R, E>, callback?: AsyncResultCallback<R, E>): void;
inject: typeof async.reduce;
foldl: typeof async.reduce;
reduceRight: typeof async.reduce;
foldr: typeof async.reduce;
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detect<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detect<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detect<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detectSeries: typeof async.detect;
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detectLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
detectLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
detectLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
find: typeof async.detect;
findSeries: typeof async.detect;
findLimit: typeof async.detectLimit;
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): void;
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
some<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
sortBy<T, V, E>(arr: T[], iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
some<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
some<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
someSeries: typeof async.some;
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
someLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
someLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
someLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
any: typeof async.some;
anySeries: typeof async.someSeries;
anyLimit: typeof async.someLimit;
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
every<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
every<T, E>(arr: T[], iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
every<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
everySeries: typeof async.every;
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
everyLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
everyLimit<T, E>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
everyLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
all: typeof async.every;
allSeries: typeof async.every;
allLimit: typeof async.everyLimit;
concat<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): void;
concat<T, R>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): void;
concat<T, R, E>(arr: T[], iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
concat<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
concatSeries: typeof async.concat;
// Control Flow
series<T>(tasks: AsyncFunction<T>[], callback?: AsyncResultArrayCallback<T>): void;
series<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
parallel<T>(tasks: Array<AsyncFunction<T>>, callback?: AsyncResultArrayCallback<T>): void;
parallel<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
parallelLimit<T>(tasks: Array<AsyncFunction<T>>, limit: number, callback?: AsyncResultArrayCallback<T>): void;
parallelLimit<T>(tasks: Dictionary<AsyncFunction<T>>, limit: number, callback?: AsyncResultObjectCallback<T>): void;
whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void;
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void;
until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void;
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void;
during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void;
doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void;
forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void;
waterfall<T>(tasks: Function[], callback?: AsyncResultCallback<T>): void;
series<T, E>(tasks: AsyncFunction<T, E>[], callback?: AsyncResultArrayCallback<T, E>): void;
series<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
parallel<T, E>(tasks: Array<AsyncFunction<T, E>>, callback?: AsyncResultArrayCallback<T, E>): void;
parallel<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
parallelLimit<T, E>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
parallelLimit<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
whilst<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doWhilst<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
until<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doUntil<E>(fn: AsyncVoidFunction<E>, test: () => boolean, callback: ErrorCallback<E>): void;
during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T,E>): void;
compose(...fns: Function[]): Function;
seq(...fns: Function[]): Function;
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
applyEachSeries(fns: Function[], argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
queue<T>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
auto(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any>): void;
autoInject(tasks: any, callback?: AsyncResultCallback<any>): void;
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: AsyncResultCallback<any>): void;
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: AsyncResultCallback<any>): void;
retryable<T>(opts: number | {times: number, interval: number}, task: AsyncFunction<T>): AsyncFunction<T>;
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
queue<T, E>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncQueue<T>;
priorityQueue<T, E>(worker: AsyncWorker<T, E>, concurrency: number): AsyncPriorityQueue<T>;
cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
auto<E>(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any, E>): void;
autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E>;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
reflect<T>(fn: AsyncFunction<T>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T>(tasks: AsyncFunction<T>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
timeout<T>(fn: AsyncFunction<T>, milliseconds: number, info: any): AsyncFunction<T>;
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info: any): AsyncFunction<T, E>;
times<T> (n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesSeries<T>(n: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
timesLimit<T>(n: number, limit: number, iterator: AsyncResultIterator<number, T>, callback: AsyncResultArrayCallback<T>): void;
times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
transform<T, R>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
race<T>(tasks: (AsyncFunction<T>)[], callback: AsyncResultCallback<T>) : void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
+1 -1
View File
@@ -237,7 +237,7 @@ declare namespace Azure.MobileApps {
interface SqlParameterDefinition {
name: string;
value: any;
}
}
interface TableDefinition {
access?: AccessType;
+23
View File
@@ -336,6 +336,29 @@ fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{
class CustomError extends Error {
public customField: number;
}
fooProm = fooProm.catch(CustomError, reason => {
let a: number = reason.customField
})
}
{
class CustomErrorWithConstructor extends Error {
constructor(public arg1: boolean, public arg2: number) {
super();
};
}
fooProm = fooProm.catch(CustomErrorWithConstructor, reason => {
let a: boolean = reason.arg1;
let b: number = reason.arg2;
})
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
barProm = fooProm.error((reason: any) => {
return bar;
});
+9 -4
View File
@@ -65,14 +65,19 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
*/
catch(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
+11 -11
View File
@@ -11,7 +11,7 @@ import { EventEmitter } from 'events';
declare class Logger extends EventEmitter {
constructor(options: LoggerOptions);
addStream(stream: Stream): void;
addSerializers(serializers:Serializers | StdSerializers):void;
addSerializers(serializers:Serializers | StdSerializers):void;
child(options: LoggerOptions, simple?: boolean): Logger;
child(obj: Object, simple?: boolean): Logger;
reopenFileStreams(): void;
@@ -58,18 +58,18 @@ interface LoggerOptions {
src?: boolean;
}
interface Serializer {
(input:any): any;
}
interface Serializer {
(input:any): any;
}
interface Serializers {
[key:string]: Serializer;
}
[key: string]: Serializer
}
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
}
interface Stream {
@@ -82,7 +82,7 @@ interface Stream {
count?: number;
}
export var stdSerializers:StdSerializers;
export declare var stdSerializers: StdSerializers;
export declare var TRACE: number;
export declare var DEBUG: number;
+1 -1
View File
@@ -134,7 +134,7 @@ export namespace types {
var LocalTime: LocalTimeStatic;
var Long: _Long;
var ResultSet: ResultSetStatic;
// var ResultStream: ResultStreamStatic;
// var ResultStream: ResultStreamStatic;
var Row: RowStatic;
var TimeUuid: TimeUuidStatic;
var Tuple: TupleStatic;
+1
View File
@@ -74,6 +74,7 @@ declare namespace connectMongo {
* (Default: 10)
*/
autoRemoveInterval?: number;
/**
* don't save session if unmodified
*/
+9 -1
View File
@@ -58,7 +58,15 @@ export interface ILegendwidget {
export var events: IEvents;
export interface IListener<T> {
on: (eventName: string, fnctn: (c:T) => void) => T;
on: {
(event: "preRender", fnctn: (c: T) => any): T;
(event: "postRender", fnctn: (c: T) => any): T;
(event: "preRedraw", fnctn: (c: T) => any): T;
(event: "postRedraw", fnctn: (c: T) => any): T;
(event: "filtered", fnctn: (c: T, filter: any) => any): T;
(event: "zoomed", fnctn: (c: T, filter: any) => any): T;
(event: string, fnctn: (c: T, ...args: any[]) => any): T;
};
}
export interface ImarginObj {
+10 -1
View File
@@ -160,7 +160,16 @@ declare namespace DC {
legend: IGetSet<Legend, T>;
options(optionsObject: any): T;
renderlet(fn: (chart: T) => any): T;
on(event: string, fn: (chart: T) => any): T;
on(event: "renderlet", fn: (chart: T, filter: any) => any): T;
on(event: "pretransition", fn: (chart: T, filter: any) => any): T;
on(event: "preRender", fn: (chart: T) => any): T;
on(event: "postRender", fn: (chart: T) => any): T;
on(event: "preRedraw", fn: (chart: T) => any): T;
on(event: "postRedraw", fn: (chart: T) => any): T;
on(event: "filtered", fn: (chart: T, filter: any) => any): T;
on(event: "zoomed", fn: (chart: T, filter: any) => any): T;
on(event: string, fn: (chart: T, ...args: any[]) => any): T;
}
export interface Margins {
+7
View File
@@ -0,0 +1,7 @@
/// <reference path="electron.d.ts" />
/// <reference path="../node/node.d.ts" />
import electron = require('electron');
import child_process = require('child_process');
child_process.spawn(electron);
+5765
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -29,13 +29,13 @@ interface PageTabDialogParams {
interface RequestsDialogParams {
method: string; // "apprequests"
app_id: string;
app_id?: string;
redirect_uri?: string;
to?: string;
message: string;
action_type?: string; // "send" | "askfor" | "turn"
object_id?: string;
filters: string /* "app_users" | "app_non_users" */ | {
filters: string[] | {
name: string;
user_ids: string[];
};
+1
View File
@@ -2,6 +2,7 @@
///<reference types="node" />
///<reference types="mocha" />
///<reference types="assert" />
'use strict';
/**
-1
View File
@@ -5,7 +5,6 @@
/// <reference types="node" />
import {ServerRequest, ServerResponse} from "http";
declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: finalHandler.Options): (err: any) => void;
+8
View File
@@ -18,6 +18,9 @@ export declare function copySync(src: string, dest: string): void;
export declare function copySync(src: string, dest: string, filter: CopyFilter): void;
export declare function copySync(src: string, dest: string, options: CopyOptions): void;
export declare function move(src: string, dest: string, callback?: (err: Error) => void): void;
export declare function move(src: string, dest: string, options: MoveOptions, callback?: (err: Error) => void): void;
export declare function createFile(file: string, callback?: (err: Error) => void): void;
export declare function createFileSync(file: string): void;
@@ -89,6 +92,11 @@ export interface CopyOptions {
limit?: number;
}
export interface MoveOptions {
clobber? : boolean;
limit?: number;
}
export interface OpenOptions {
encoding?: string;
flag?: string;
+7 -1
View File
@@ -136,7 +136,13 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
eventAfterAllRender?: (view: ViewObject) => void;
eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void;
//scheduler options
//scheduler options
resourceAreaWidth?:number,
schedulerLicenseKey?:string,
customButtons?:any,
resourceLabelText?:any,
resourceColumns?:any,
displayEventTime?:any,
}
/**
+1 -1
View File
@@ -161,7 +161,7 @@ declare class TimelineLite extends SimpleTimeline {
static exportRoot(vars?: Object, omitDelayedCalls?: boolean): TimelineLite;
from(target: Object, duration: number, vars: Object, position?: any): TimelineLite;
fromTo(target: Object, duration: number, fromVars: Object, toVars: Object, position?: any): TimelineLite;
getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): Tween | Timeline[];
getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): (Tween | Timeline)[];
getLabelTime(label: string): number;
getTweensOf(target: Object, nested?: boolean): Tween[];
recent(): Animation;
+6
View File
@@ -290,3 +290,9 @@ declare namespace ht {
declare var Handsontable: {
new (element: Element, options: ht.Options): ht.Methods;
};
declare module "handsontable" {
export var Handsontable: {
new (element: Element, options: ht.Options): ht.Methods;
};
}
-3
View File
@@ -1,6 +1,3 @@
/// <reference types="hapi" />
/// <reference types="hapi-decorators" />
import * as hapi from 'hapi';
import { controller, get, post, put, cache, config, route, validate, Controller } from 'hapi-decorators';
+1 -1
View File
@@ -17,4 +17,4 @@
"index.d.ts",
"hapi-decorators-tests.ts"
]
}
}
+2 -2
View File
@@ -304,9 +304,9 @@ export interface ISessionHandler {
export interface IStrictSessionHandler {
<T>(request: Request, reply: IStrictReply<T>): void;
}
}
export interface IRequestHandler<T> {
export interface IRequestHandler<T> {
(request: Request): T;
}
+2 -2
View File
@@ -116,8 +116,8 @@ server.route([{
server.route({
method: 'GET',
path: '/hello6',
handler: function (request, reply) {
request.log('info', { route: '/hello' }, Date.now());
handler: function (request: Hapi.Request, reply: Hapi.IReply) {
request.log('info', { route: '/hello' }, Date.now());
reply('hello world');
}
});
+23 -22
View File
@@ -28,10 +28,10 @@ declare namespace __Highstock {
}
interface RangeSelectorButton {
type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'.
count?: number;
text: string;
dataGrouping?: any; //not sure how this works
type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'.
count?: number;
text: string;
dataGrouping?: any; //not sure how this works
}
interface RangeSelectorOptions {
@@ -59,24 +59,24 @@ declare namespace __Highstock {
}
interface ScrollbarOptions {
barBackgroundColor?: string;
barBorderColor?: string;
barBorderRadius?: number;
barBorderWidth?: number;
buttonArrowColor?: string;
buttonBackgroundColor?: string;
buttonBorderColor?: string;
buttonBorderRadius?: number;
buttonBorderWidth?: number;
enabled?: boolean;
height?: number;
liveRedraw?: boolean;
minWidth?: number;
rifleColor?: string;
trackBackgroundColor?: string;
trackBorderColor?: string;
trackBorderRadius?: number;
trackBorderWidth?: number;
barBackgroundColor?: string;
barBorderColor?: string;
barBorderRadius?: number;
barBorderWidth?: number;
buttonArrowColor?: string;
buttonBackgroundColor?: string;
buttonBorderColor?: string;
buttonBorderRadius?: number;
buttonBorderWidth?: number;
enabled?: boolean;
height?: number;
liveRedraw?: boolean;
minWidth?: number;
rifleColor?: string;
trackBackgroundColor?: string;
trackBorderColor?: string;
trackBorderRadius?: number;
trackBorderWidth?: number;
}
interface Options extends Highcharts.Options {
@@ -119,3 +119,4 @@ interface JQuery {
highcharts(type: string, options: Highcharts.Options): JQuery;
highcharts(type: string, options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery;
}
+82 -81
View File
@@ -3,89 +3,90 @@
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'http-errors' {
namespace createHttpError {
declare namespace createHttpError {
// See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42
interface HttpError extends Error {
status: number;
statusCode: number;
expose: boolean;
}
// See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42
interface HttpError extends Error {
status: number;
statusCode: number;
expose: boolean;
type HttpErrorConstructor = new(msg?: string) => HttpError;
interface CreateHttpError {
// See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674
[code: string]: new () => HttpError;
(...args: Array<Error | string | number | Object>): HttpError;
Continue: HttpErrorConstructor;
SwitchingProtocols: HttpErrorConstructor;
Processing: HttpErrorConstructor;
OK: HttpErrorConstructor;
Created: HttpErrorConstructor;
Accepted: HttpErrorConstructor;
NonAuthoritativeInformation: HttpErrorConstructor;
NoContent: HttpErrorConstructor;
ResetContent: HttpErrorConstructor;
PartialContent: HttpErrorConstructor;
MultiStatus: HttpErrorConstructor;
AlreadyReported: HttpErrorConstructor;
IMUsed: HttpErrorConstructor;
MultipleChoices: HttpErrorConstructor;
MovedPermanently: HttpErrorConstructor;
Found: HttpErrorConstructor;
SeeOther: HttpErrorConstructor;
NotModified: HttpErrorConstructor;
UseProxy: HttpErrorConstructor;
Unused: HttpErrorConstructor;
TemporaryRedirect: HttpErrorConstructor;
PermanentRedirect: HttpErrorConstructor;
BadRequest: HttpErrorConstructor;
Unauthorized: HttpErrorConstructor;
PaymentRequired: HttpErrorConstructor;
Forbidden: HttpErrorConstructor;
NotFound: HttpErrorConstructor;
MethodNotAllowed: HttpErrorConstructor;
NotAcceptable: HttpErrorConstructor;
ProxyAuthenticationRequired: HttpErrorConstructor;
RequestTimeout: HttpErrorConstructor;
Conflict: HttpErrorConstructor;
Gone: HttpErrorConstructor;
LengthRequired: HttpErrorConstructor;
PreconditionFailed: HttpErrorConstructor;
PayloadTooLarge: HttpErrorConstructor;
URITooLong: HttpErrorConstructor;
UnsupportedMediaType: HttpErrorConstructor;
RangeNotSatisfiable: HttpErrorConstructor;
ExpectationFailed: HttpErrorConstructor;
ImATeapot: HttpErrorConstructor;
MisdirectedRequest: HttpErrorConstructor;
UnprocessableEntity: HttpErrorConstructor;
Locked: HttpErrorConstructor;
FailedDependency: HttpErrorConstructor;
UnorderedCollection: HttpErrorConstructor;
UpgradeRequired: HttpErrorConstructor;
PreconditionRequired: HttpErrorConstructor;
TooManyRequests: HttpErrorConstructor;
RequestHeaderFieldsTooLarge: HttpErrorConstructor;
UnavailableForLegalReasons: HttpErrorConstructor;
InternalServerError: HttpErrorConstructor;
NotImplemented: HttpErrorConstructor;
BadGateway: HttpErrorConstructor;
ServiceUnavailable: HttpErrorConstructor;
GatewayTimeout: HttpErrorConstructor;
HTTPVersionNotSupported: HttpErrorConstructor;
VariantAlsoNegotiates: HttpErrorConstructor;
InsufficientStorage: HttpErrorConstructor;
LoopDetected: HttpErrorConstructor;
BandwidthLimitExceeded: HttpErrorConstructor;
NotExtended: HttpErrorConstructor;
NetworkAuthenticationRequired: HttpErrorConstructor;
}
}
type HttpErrorConstructor = new(msg?: string) => HttpError;
interface CreateHttpError {
// See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674
[code: string]: new () => HttpError;
(...args: Array<Error | string | number | Object>): HttpError;
Continue: HttpErrorConstructor;
SwitchingProtocols: HttpErrorConstructor;
Processing: HttpErrorConstructor;
OK: HttpErrorConstructor;
Created: HttpErrorConstructor;
Accepted: HttpErrorConstructor;
NonAuthoritativeInformation: HttpErrorConstructor;
NoContent: HttpErrorConstructor;
ResetContent: HttpErrorConstructor;
PartialContent: HttpErrorConstructor;
MultiStatus: HttpErrorConstructor;
AlreadyReported: HttpErrorConstructor;
IMUsed: HttpErrorConstructor;
MultipleChoices: HttpErrorConstructor;
MovedPermanently: HttpErrorConstructor;
Found: HttpErrorConstructor;
SeeOther: HttpErrorConstructor;
NotModified: HttpErrorConstructor;
UseProxy: HttpErrorConstructor;
Unused: HttpErrorConstructor;
TemporaryRedirect: HttpErrorConstructor;
PermanentRedirect: HttpErrorConstructor;
BadRequest: HttpErrorConstructor;
Unauthorized: HttpErrorConstructor;
PaymentRequired: HttpErrorConstructor;
Forbidden: HttpErrorConstructor;
NotFound: HttpErrorConstructor;
MethodNotAllowed: HttpErrorConstructor;
NotAcceptable: HttpErrorConstructor;
ProxyAuthenticationRequired: HttpErrorConstructor;
RequestTimeout: HttpErrorConstructor;
Conflict: HttpErrorConstructor;
Gone: HttpErrorConstructor;
LengthRequired: HttpErrorConstructor;
PreconditionFailed: HttpErrorConstructor;
PayloadTooLarge: HttpErrorConstructor;
URITooLong: HttpErrorConstructor;
UnsupportedMediaType: HttpErrorConstructor;
RangeNotSatisfiable: HttpErrorConstructor;
ExpectationFailed: HttpErrorConstructor;
ImATeapot: HttpErrorConstructor;
MisdirectedRequest: HttpErrorConstructor;
UnprocessableEntity: HttpErrorConstructor;
Locked: HttpErrorConstructor;
FailedDependency: HttpErrorConstructor;
UnorderedCollection: HttpErrorConstructor;
UpgradeRequired: HttpErrorConstructor;
PreconditionRequired: HttpErrorConstructor;
TooManyRequests: HttpErrorConstructor;
RequestHeaderFieldsTooLarge: HttpErrorConstructor;
UnavailableForLegalReasons: HttpErrorConstructor;
InternalServerError: HttpErrorConstructor;
NotImplemented: HttpErrorConstructor;
BadGateway: HttpErrorConstructor;
ServiceUnavailable: HttpErrorConstructor;
GatewayTimeout: HttpErrorConstructor;
HTTPVersionNotSupported: HttpErrorConstructor;
VariantAlsoNegotiates: HttpErrorConstructor;
InsufficientStorage: HttpErrorConstructor;
LoopDetected: HttpErrorConstructor;
BandwidthLimitExceeded: HttpErrorConstructor;
NotExtended: HttpErrorConstructor;
NetworkAuthenticationRequired: HttpErrorConstructor;
}
var createHttpError: createHttpError.CreateHttpError;
export = createHttpError;
}
declare var createHttpError: createHttpError.CreateHttpError;
export = createHttpError;
+2
View File
@@ -130,6 +130,8 @@ declare namespace i18n {
on(languageChanged: 'languageChanged', listener: (lng: string) => void): void;
off(event: string, listener: () => void): void;
options: Options;
}
}
+1 -1
View File
@@ -111,7 +111,7 @@ declare namespace inquirer {
* A key/value hash containing the client answers in each prompt.
*/
interface Answers {
[key: string]: any;
[key: string]: any;
}
namespace ui {
+5
View File
@@ -292,6 +292,11 @@ declare namespace Handsontable {
*/
manualRowResize?: boolean;
/**
* Turns on Manual row move, if set to a boolean or define initial row order, if set to an array of row indexes.
*/
manualRowMove?: boolean;
/**
* Setting to true enables the copyPaste plugin, which enables the copying and pasting to the clipboard.
*/
+4
View File
@@ -66,6 +66,8 @@ export declare class Offset {
fetch(payloads: Array<OffsetRequest>, cb: (error: any, data: any) => any): void;
commit(groupId: string, payloads: Array<OffsetCommitRequest>, cb: (error: any, data: any) => any): void;
fetchCommits(groupId: string, payloads: Array<OffsetFetchRequest>, cb: (error: any, data: any) => any): void;
fetchLatestOffsets(topics: Array<string>, cb: (error: any, data: any) => any): void;
on(eventName: string, cb: (error: any) => any): void;
}
export declare class KeyedMessage {
@@ -100,6 +102,8 @@ export interface ConsumerOptions {
export interface Topic {
topic: string;
offset?: number;
encoding?: string;
autoCommit?: boolean;
}
export interface OffsetRequest {
+11
View File
@@ -16,6 +16,17 @@ export interface Observer<T, S> {
end?: () => void;
}
export interface Subscription {
unsubscribe(): void;
closed: boolean; // Actually, `readonly` but it's avaiable in tsc starting with 2.0.0
}
export interface Observer<T, S> {
value?: (value: T) => void;
error?: (error: S) => void;
end?: () => void;
}
export interface Observable<T, S> {
// Subscribe / add side effects
onValue(callback: (value: T) => void): void;
+2
View File
@@ -1026,6 +1026,8 @@ declare namespace kendo.data {
class DataSource extends Observable{
options: DataSourceOptions;
transports: any;
static create(options?: DataSourceOptions): DataSource;
constructor(options?: DataSourceOptions);
+36 -34
View File
@@ -326,9 +326,9 @@ declare namespace Knex {
}
interface Transaction extends QueryBuilder {
commit: any;
rollback: any;
raw: Knex.RawBuilder;
commit: any;
rollback: any;
raw: Knex.RawBuilder;
}
//
@@ -349,37 +349,39 @@ declare namespace Knex {
}
interface TableBuilder {
increments(columnName?: string): ColumnBuilder;
bigIncrements(columnName?: string): ColumnBuilder;
dropColumn(columnName: string): TableBuilder;
dropColumns(...columnNames: string[]): TableBuilder;
renameColumn(from: string, to: string): ColumnBuilder;
integer(columnName: string): ColumnBuilder;
bigInteger(columnName: string): ColumnBuilder;
text(columnName: string, textType?: string): ColumnBuilder;
string(columnName: string, length?: number): ColumnBuilder;
float(columnName: string, precision?: number, scale?: number): ColumnBuilder;
decimal(columnName: string, precision?: number, scale?: number): ColumnBuilder;
boolean(columnName: string): ColumnBuilder;
date(columnName: string): ColumnBuilder;
dateTime(columnName: string): ColumnBuilder;
time(columnName: string): ColumnBuilder;
timestamp(columnName: string): ColumnBuilder;
timestamps(): ColumnBuilder;
binary(columnName: string): ColumnBuilder;
enum(columnName: string, values: Value[]): ColumnBuilder;
enu(columnName: string, values: Value[]): ColumnBuilder;
json(columnName: string): ColumnBuilder;
jsonb(columnName: string): ColumnBuilder;
uuid(columnName: string): ColumnBuilder;
comment(val: string): TableBuilder;
specificType(columnName: string, type: string): ColumnBuilder;
primary(columnNames: string[]) : TableBuilder;
index(columnNames: string[], indexName?: string, indexType?: string) : TableBuilder;
unique(columnNames: string[], indexName?: string) : TableBuilder;
foreign(column: string): ForeignConstraintBuilder;
foreign(columns: string[]): MultikeyForeignConstraintBuilder;
dropForeign(columnNames: string[], foreignKeyName?: string): TableBuilder;
increments(columnName?: string): ColumnBuilder;
bigIncrements(columnName?: string): ColumnBuilder;
dropColumn(columnName: string): TableBuilder;
dropColumns(...columnNames: string[]): TableBuilder;
renameColumn(from: string, to: string): ColumnBuilder;
integer(columnName: string): ColumnBuilder;
bigInteger(columnName: string): ColumnBuilder;
text(columnName: string, textType?: string): ColumnBuilder;
string(columnName: string, length?: number): ColumnBuilder;
float(columnName: string, precision?: number, scale?: number): ColumnBuilder;
decimal(columnName: string, precision?: number, scale?: number): ColumnBuilder;
boolean(columnName: string): ColumnBuilder;
date(columnName: string): ColumnBuilder;
dateTime(columnName: string): ColumnBuilder;
time(columnName: string): ColumnBuilder;
timestamp(columnName: string): ColumnBuilder;
timestamps(): ColumnBuilder;
binary(columnName: string): ColumnBuilder;
enum(columnName: string, values: Value[]): ColumnBuilder;
enu(columnName: string, values: Value[]): ColumnBuilder;
json(columnName: string): ColumnBuilder;
jsonb(columnName: string): ColumnBuilder;
uuid(columnName: string): ColumnBuilder;
comment(val: string): TableBuilder;
specificType(columnName: string, type: string): ColumnBuilder;
primary(columnNames: string[]): TableBuilder;
index(columnNames: string[], indexName?: string, indexType?: string): TableBuilder;
unique(columnNames: string[], indexName?: string): TableBuilder;
foreign(column: string): ForeignConstraintBuilder;
foreign(columns: string[]): MultikeyForeignConstraintBuilder;
dropForeign(columnNames: string[], foreignKeyName?: string): TableBuilder;
dropUnique(columnNames: string[], indexName?: string): TableBuilder;
dropPrimary(constraintName?: string): TableBuilder;
}
interface CreateTableBuilder extends TableBuilder {
+4
View File
@@ -453,6 +453,10 @@ knex.schema.raw("SET sql_mode='TRADITIONAL'")
table.dropColumn('name');
table.string('first_name');
table.string('last_name');
table.dropUnique(["name1", "name2"], "index_name");
table.dropUnique(["name1", "name2"]);
table.dropPrimary();
table.dropPrimary("constraint_name");
});
knex('users')
+1 -1
View File
@@ -332,7 +332,7 @@ interface KnockoutUtils {
}
interface KnockoutArrayChange<T> {
status: "added" | "deleted";
status: "added" | "deleted" | "retained";
value: T;
index: number;
moved?: number;
+6 -22
View File
@@ -1,4 +1,4 @@
// Type definitions for Leaflet.js 1.0.0-rc3
// Type definitions for Leaflet.js 1.0.0
// Project: https://github.com/Leaflet/Leaflet
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -1413,8 +1413,12 @@ declare namespace L {
createShadow(oldIcon?: HTMLElement): HTMLElement;
}
export interface IconDefault extends Icon {
imagePath: string;
}
export namespace Icon {
export const Default: Icon;
export const Default: IconDefault;
}
export function icon(options: IconOptions): Icon;
@@ -1471,45 +1475,25 @@ declare namespace L {
export const gecko: boolean;
export const android: boolean;
export const android23: boolean;
export const chrome: boolean;
export const safari: boolean;
export const win: boolean;
export const ie3d: boolean;
export const webkit3d: boolean;
export const gecko3d: boolean;
export const opera12: boolean;
export const any3d: boolean;
export const mobile: boolean;
export const mobileWebkit: boolean;
export const mobiWebkit3d: boolean;
export const mobileOpera: boolean;
export const mobileGecko: boolean;
export const touch: boolean;
export const msPointer: boolean;
export const pointer: boolean;
export const retina: boolean;
export const canvas: boolean;
export const vml: boolean;
export const svg: boolean;
}
}
+127 -45
View File
@@ -1594,12 +1594,13 @@ declare module _ {
*
* @param array The array to search.
* @param predicate The function invoked per iteration.
* @param thisArg The this binding of predicate.
* @param fromIndex The index to search from.
* @return Returns the index of the found element, else -1.
*/
findIndex<T>(
array: List<T>,
predicate?: ListIterator<T, boolean>
predicate?: ListIterator<T, boolean>,
fromIndex?: number
): number;
/**
@@ -1607,7 +1608,8 @@ declare module _ {
*/
findIndex<T>(
array: List<T>,
predicate?: string
predicate?: string,
fromIndex?: number
): number;
/**
@@ -1615,7 +1617,8 @@ declare module _ {
*/
findIndex<W, T>(
array: List<T>,
predicate?: W
predicate?: W,
fromIndex?: number
): number;
}
@@ -1624,21 +1627,24 @@ declare module _ {
* @see _.findIndex
*/
findIndex(
predicate?: ListIterator<T, boolean>
predicate?: ListIterator<T, boolean>,
fromIndex?: number
): number;
/**
* @see _.findIndex
*/
findIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): number;
/**
* @see _.findIndex
*/
findIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): number;
}
@@ -1647,21 +1653,24 @@ declare module _ {
* @see _.findIndex
*/
findIndex<TResult>(
predicate?: ListIterator<TResult, boolean>
predicate?: ListIterator<TResult, boolean>,
fromIndex?: number
): number;
/**
* @see _.findIndex
*/
findIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): number;
/**
* @see _.findIndex
*/
findIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): number;
}
@@ -1670,21 +1679,24 @@ declare module _ {
* @see _.findIndex
*/
findIndex(
predicate?: ListIterator<T, boolean>
predicate?: ListIterator<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findIndex
*/
findIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findIndex
*/
findIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
@@ -1693,21 +1705,24 @@ declare module _ {
* @see _.findIndex
*/
findIndex<TResult>(
predicate?: ListIterator<TResult, boolean>
predicate?: ListIterator<TResult, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findIndex
*/
findIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findIndex
*/
findIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
@@ -1727,12 +1742,13 @@ declare module _ {
*
* @param array The array to search.
* @param predicate The function invoked per iteration.
* @param thisArg The function invoked per iteration.
* @param fromIndex The index to search from.
* @return Returns the index of the found element, else -1.
*/
findLastIndex<T>(
array: List<T>,
predicate?: ListIterator<T, boolean>
predicate?: ListIterator<T, boolean>,
fromIndex?: number
): number;
/**
@@ -1740,7 +1756,8 @@ declare module _ {
*/
findLastIndex<T>(
array: List<T>,
predicate?: string
predicate?: string,
fromIndex?: number
): number;
/**
@@ -1748,7 +1765,8 @@ declare module _ {
*/
findLastIndex<W, T>(
array: List<T>,
predicate?: W
predicate?: W,
fromIndex?: number
): number;
}
@@ -1757,21 +1775,24 @@ declare module _ {
* @see _.findLastIndex
*/
findLastIndex(
predicate?: ListIterator<T, boolean>
predicate?: ListIterator<T, boolean>,
fromIndex?: number
): number;
/**
* @see _.findLastIndex
*/
findLastIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): number;
/**
* @see _.findLastIndex
*/
findLastIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): number;
}
@@ -1780,21 +1801,24 @@ declare module _ {
* @see _.findLastIndex
*/
findLastIndex<TResult>(
predicate?: ListIterator<TResult, boolean>
predicate?: ListIterator<TResult, boolean>,
fromIndex?: number
): number;
/**
* @see _.findLastIndex
*/
findLastIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): number;
/**
* @see _.findLastIndex
*/
findLastIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): number;
}
@@ -1803,21 +1827,24 @@ declare module _ {
* @see _.findLastIndex
*/
findLastIndex(
predicate?: ListIterator<T, boolean>
predicate?: ListIterator<T, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findLastIndex
*/
findLastIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findLastIndex
*/
findLastIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
@@ -1826,21 +1853,24 @@ declare module _ {
* @see _.findLastIndex
*/
findLastIndex<TResult>(
predicate?: ListIterator<TResult, boolean>
predicate?: ListIterator<TResult, boolean>,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findLastIndex
*/
findLastIndex(
predicate?: string
predicate?: string,
fromIndex?: number
): LoDashExplicitWrapper<number>;
/**
* @see _.findLastIndex
*/
findLastIndex<W>(
predicate?: W
predicate?: W,
fromIndex?: number
): LoDashExplicitWrapper<number>;
}
@@ -6898,26 +6928,32 @@ declare module _ {
* right to left.
* @param collection Searches for a value in this list.
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
* @param fromIndex The index to search from.
* @return The found element, else undefined.
**/
findLast<T>(
collection: Array<T>,
callback: ListIterator<T, boolean>): T;
callback: ListIterator<T, boolean>,
fromIndex?: number
): T;
/**
* @see _.find
**/
findLast<T>(
collection: List<T>,
callback: ListIterator<T, boolean>): T;
callback: ListIterator<T, boolean>,
fromIndex?: number
): T;
/**
* @see _.find
**/
findLast<T>(
collection: Dictionary<T>,
callback: DictionaryIterator<T, boolean>): T;
callback: DictionaryIterator<T, boolean>,
fromIndex?: number
): T;
/**
* @see _.find
@@ -6925,7 +6961,9 @@ declare module _ {
**/
findLast<W, T>(
collection: Array<T>,
whereValue: W): T;
whereValue: W,
fromIndex?: number
): T;
/**
* @see _.find
@@ -6933,7 +6971,9 @@ declare module _ {
**/
findLast<W, T>(
collection: List<T>,
whereValue: W): T;
whereValue: W,
fromIndex?: number
): T;
/**
* @see _.find
@@ -6941,7 +6981,9 @@ declare module _ {
**/
findLast<W, T>(
collection: Dictionary<T>,
whereValue: W): T;
whereValue: W,
fromIndex?: number
): T;
/**
* @see _.find
@@ -6949,7 +6991,9 @@ declare module _ {
**/
findLast<T>(
collection: Array<T>,
pluckValue: string): T;
pluckValue: string,
fromIndex?: number
): T;
/**
* @see _.find
@@ -6957,7 +7001,9 @@ declare module _ {
**/
findLast<T>(
collection: List<T>,
pluckValue: string): T;
pluckValue: string,
fromIndex?: number
): T;
/**
* @see _.find
@@ -6965,7 +7011,9 @@ declare module _ {
**/
findLast<T>(
collection: Dictionary<T>,
pluckValue: string): T;
pluckValue: string,
fromIndex?: number
): T;
}
interface LoDashImplicitArrayWrapper<T> {
@@ -6973,20 +7021,26 @@ declare module _ {
* @see _.findLast
*/
findLast(
callback: ListIterator<T, boolean>): T;
callback: ListIterator<T, boolean>,
fromIndex?: number
): T;
/**
* @see _.findLast
* @param _.where style callback
*/
findLast<W>(
whereValue: W): T;
whereValue: W,
fromIndex?: number
): T;
/**
* @see _.findLast
* @param _.where style callback
*/
findLast(
pluckValue: string): T;
pluckValue: string,
fromIndex?: number
): T;
}
//_.flatMap
@@ -18210,6 +18264,34 @@ declare module _ {
constant<TResult>(): LoDashExplicitObjectWrapper<() => TResult>;
}
//_.defaultTo
interface LoDashStatic {
/**
* Checks `value` to determine whether a default value should be returned in
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
* or `undefined`.
*
* @param value The value to check.
* @param defaultValue The default value.
* @returns Returns the resolved value.
*/
defaultTo<T>(value: T, defaultValue: T): T;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.defaultTo
*/
defaultTo<TResult>(value: TResult): LoDashImplicitObjectWrapper<TResult>;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.defaultTo
*/
defaultTo<TResult>(value: TResult): LoDashExplicitObjectWrapper<TResult>;
}
//_.identity
interface LoDashStatic {
/**
+137
View File
@@ -681,6 +681,7 @@ namespace TestFindIndex {
let array: TResult[];
let list: _.List<TResult>;
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
let fromIndex: number;
{
let result: number;
@@ -689,21 +690,25 @@ namespace TestFindIndex {
result = _.findIndex<TResult>(array, predicateFn);
result = _.findIndex<TResult>(array, '');
result = _.findIndex<{a: number}, TResult>(array, {a: 42});
result = _.findIndex<TResult>(array, predicateFn, fromIndex);
result = _.findIndex<TResult>(list);
result = _.findIndex<TResult>(list, predicateFn);
result = _.findIndex<TResult>(list, '');
result = _.findIndex<{a: number}, TResult>(list, {a: 42});
result = _.findIndex<TResult>(list, predicateFn, fromIndex);
result = _<TResult>(array).findIndex();
result = _<TResult>(array).findIndex(predicateFn);
result = _<TResult>(array).findIndex('');
result = _<TResult>(array).findIndex<{a: number}>({a: 42});
result = _<TResult>(array).findIndex(predicateFn, fromIndex);
result = _(list).findIndex();
result = _(list).findIndex<TResult>(predicateFn);
result = _(list).findIndex('');
result = _(list).findIndex<{a: number}>({a: 42});
result = _(list).findIndex<TResult>(predicateFn, fromIndex);
}
{
@@ -713,11 +718,13 @@ namespace TestFindIndex {
result = _<TResult>(array).chain().findIndex(predicateFn);
result = _<TResult>(array).chain().findIndex('');
result = _<TResult>(array).chain().findIndex<{a: number}>({a: 42});
result = _<TResult>(array).chain().findIndex(predicateFn, fromIndex);
result = _(list).chain().findIndex();
result = _(list).chain().findIndex<TResult>(predicateFn);
result = _(list).chain().findIndex('');
result = _(list).chain().findIndex<{a: number}>({a: 42});
result = _(list).chain().findIndex<TResult>(predicateFn, fromIndex);
}
}
@@ -727,6 +734,7 @@ namespace TestFindLastIndex {
let list: _.List<TResult>;
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
let fromIndex: number;
{
let result: number;
@@ -735,21 +743,25 @@ namespace TestFindLastIndex {
result = _.findLastIndex<TResult>(array, predicateFn);
result = _.findLastIndex<TResult>(array, '');
result = _.findLastIndex<{a: number}, TResult>(array, {a: 42});
result = _.findLastIndex<TResult>(array, predicateFn, fromIndex);
result = _.findLastIndex<TResult>(list);
result = _.findLastIndex<TResult>(list, predicateFn);
result = _.findLastIndex<TResult>(list, '');
result = _.findLastIndex<{a: number}, TResult>(list, {a: 42});
result = _.findLastIndex<TResult>(list, predicateFn, fromIndex);
result = _<TResult>(array).findLastIndex();
result = _<TResult>(array).findLastIndex(predicateFn);
result = _<TResult>(array).findLastIndex('');
result = _<TResult>(array).findLastIndex<{a: number}>({a: 42});
result = _<TResult>(array).findLastIndex(predicateFn, fromIndex);
result = _(list).findLastIndex();
result = _(list).findLastIndex<TResult>(predicateFn);
result = _(list).findLastIndex('');
result = _(list).findLastIndex<{a: number}>({a: 42});
result = _(list).findLastIndex<TResult>(predicateFn, fromIndex);
}
{
@@ -759,11 +771,13 @@ namespace TestFindLastIndex {
result = _<TResult>(array).chain().findLastIndex(predicateFn);
result = _<TResult>(array).chain().findLastIndex('');
result = _<TResult>(array).chain().findLastIndex<{a: number}>({a: 42});
result = _<TResult>(array).chain().findLastIndex(predicateFn, fromIndex);
result = _(list).chain().findLastIndex();
result = _(list).chain().findLastIndex<TResult>(predicateFn);
result = _(list).chain().findLastIndex('');
result = _(list).chain().findLastIndex<{a: number}>({a: 42});
result = _(list).chain().findLastIndex<TResult>(predicateFn, fromIndex);
}
}
@@ -3735,12 +3749,16 @@ result = <number>_.findLast([1, 2, 3, 4], function (num) {
result = <IFoodCombined>_.findLast(foodsCombined, { 'type': 'vegetable' });
result = <IFoodCombined>_.findLast(foodsCombined, 'organic');
result = <IFoodCombined>_.findLast(foodsCombined, 'organic', 1);
result = <number>_([1, 2, 3, 4]).findLast(function (num) {
return num % 2 == 0;
});
result = <IFoodCombined>_(foodsCombined).findLast({ 'type': 'vegetable' });
result = <IFoodCombined>_(foodsCombined).findLast('organic');
result = <IFoodCombined>_(foodsCombined).findLast('organic', 1);
// _.flatMap
namespace TestFlatMap {
let numArray: (number|number[])[] = [1, [2, 3]];
@@ -11111,6 +11129,125 @@ namespace TestConstant {
}
}
// _.defaultTo
namespace TestDefaultTo {
{
let result: number;
result = _.defaultTo<number>(42, 42);
result = _.defaultTo<number>(undefined, 42);
result = _.defaultTo<number>(null, 42);
result = _.defaultTo<number>(NaN, 42);
}
{
let result: string;
result = _.defaultTo<string>('a', 'default');
result = _.defaultTo<string>(undefined, 'default');
result = _.defaultTo<string>(null, 'default');
}
{
let result: boolean;
result = _.defaultTo<boolean>(true, true);
result = _.defaultTo<boolean>(undefined, true);
result = _.defaultTo<boolean>(null, true);
}
{
let result: string[];
result = _.defaultTo<string[]>(['a'], ['default']);
result = _.defaultTo<string[]>(undefined, ['default']);
result = _.defaultTo<string[]>(null, ['default']);
}
{
let result: {a: string};
result = _.defaultTo<{a: string}>({a: 'a'}, {a: 'a'});
result = _.defaultTo<{a: string}>(undefined, {a: 'a'});
result = _.defaultTo<{a: string}>(null, {a: 'a'});
}
{
let result: _.LoDashImplicitObjectWrapper<number>;
result = _(42).defaultTo(42);
result = _(undefined).defaultTo(42);
result = _(null).defaultTo(42);
result = _(NaN).defaultTo(42);
}
{
let result: _.LoDashImplicitObjectWrapper<string>;
result = _('a').defaultTo('default');
result = _(null).defaultTo('default');
result = _(NaN).defaultTo('default');
}
{
let result: _.LoDashImplicitObjectWrapper<boolean>;
result = _(true).defaultTo(true);
result = _(undefined).defaultTo(true);
result = _(null).defaultTo(true);
result = _(NaN).defaultTo(true);
}
{
let result: _.LoDashImplicitObjectWrapper<string[]>;
result = _(['a']).defaultTo(['default']);
result = _(undefined).defaultTo(['default']);
result = _(null).defaultTo(['default']);
result = _(NaN).defaultTo(['default']);
}
{
let result: _.LoDashImplicitObjectWrapper<{ a: string }>;
result = _({ a: 'a' }).defaultTo({a : 'a'});
result = _(undefined).defaultTo({a : 'a'});
result = _(null).defaultTo({a : 'a'});
result = _(NaN).defaultTo({a : 'a'});
}
{
let result: _.LoDashExplicitObjectWrapper<number>;
result = _(42).chain().defaultTo(42);
result = _(undefined).chain().defaultTo(42);
result = _(null).chain().defaultTo(42);
result = _(NaN).chain().defaultTo(42);
}
{
let result: _.LoDashExplicitObjectWrapper<string>;
result = _('a').chain().defaultTo('default');
result = _(undefined).chain().defaultTo('default');
result = _(null).chain().defaultTo('default');
result = _(NaN).chain().defaultTo('default');
}
{
let result: _.LoDashExplicitObjectWrapper<boolean>;
result = _(true).chain().defaultTo(true);
result = _(undefined).chain().defaultTo(true);
result = _(null).chain().defaultTo(true);
result = _(NaN).chain().defaultTo(true);
}
{
let result: _.LoDashExplicitObjectWrapper<string[]>;
result = _(['a']).chain().defaultTo(['default']);
result = _(undefined).chain().defaultTo(['default']);
result = _(null).chain().defaultTo(['default']);
result = _(NaN).chain().defaultTo(['default']);
}
{
let result: _.LoDashExplicitObjectWrapper<{ a: string }>;
result = _({ a: 'a' }).chain().defaultTo({a : 'a'});
result = _(undefined).chain().defaultTo({a : 'a'});
result = _(null).chain().defaultTo({a : 'a'});
result = _(NaN).chain().defaultTo({a : 'a'});
}
}
// _.identity
namespace TestIdentity {
{
+168
View File
@@ -0,0 +1,168 @@
// Type definitions for math3.d.ts
// Project: https://github.com/adragonite/math3d
// Definitions by: Laszlo Jakab <https://github.com/laszlojakab>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class Vector3 {
constructor(x?: number, y?: number, z?: number);
static back: Vector3;
static down: Vector3;
static forward: Vector3;
static left: Vector3;
static one: Vector3;
static right: Vector3;
static up: Vector3;
static zero: Vector3;
static dimension: number;
static FromVector4: (vector4: Vector4) => Vector3;
homogeneous: Vector4;
magnitude: number;
values: number[];
vector4: Vector4;
x: number;
y: number;
z: number;
add(vector3: Vector3): Vector3;
average(vector3: Vector3): Vector3;
cross(vector3: Vector3): Vector3;
distanceTo(vector3: Vector3): number;
dot(vector3: Vector3): number;
equals(vector3: Vector3): boolean;
mulScalar(scalar: number): Vector3;
negate(): Vector3;
normalize(): Vector3;
scale(vector3: Vector3): Vector3;
sub(vector3: Vector3): Vector3;
toString(): string;
}
export class Vector4 {
constructor(x?: number, y?: number, z?: number, w?: number);
static one: Vector4;
static zero: Vector4;
static dimension: number;
magnitude: number;
values: number[];
x: number;
y: number;
z: number;
w: number;
add(vector4: Vector4): Vector4;
distanceTo(vector4: Vector4): number;
dot(vector4: Vector4): number;
equals(vector4: Vector4): boolean;
mulScalar(scalar: number): Vector4;
negate(): Vector4;
normalize(): Vector3;
sub(vector4: Vector4): Vector3;
toString(): string;
}
export class Quaternion {
constructor(x?: number, y?: number, z?: number, w?: number);
static Euler(x?: number, y?: number, z?: number): Quaternion;
static AngleAxis(axis: Vector3, angle: number): Quaternion;
static identity: Quaternion;
static zero: Quaternion;
angleAxis: { axis: Vector3, angle: number };
eulerAngles: { x: number, y: number, z: number };
x: number;
y: number;
z: number;
w: number;
angleTo(quaternion: Quaternion): number;
conjugate(): Quaternion;
distanceTo(quaternion: Quaternion): number;
dot(quaternion: Quaternion): number;
equals(quaternion: Quaternion): boolean;
inverse(): Quaternion;
mul(quaternion: Quaternion): Quaternion;
mulVector3(vector3: Vector3): Vector3;
toString(): string;
}
export class Matrix4x4 {
constructor(data: number[]);
static FlipMatrix(flipX: boolean, flipY: boolean, flipZ: boolean): Matrix4x4;
static ScaleMatrix(scale: number | Vector3): Matrix4x4;
static RotationMatrix(quaternion: Quaternion): Matrix4x4;
static TranslationMatrix(translation: Vector3): Matrix4x4;
static TRS(translation: Vector3, rotation: Quaternion, scale: number | Vector3): Matrix4x4;
static LocalToWorldMatrix(position: Vector3, rotation: Quaternion, scale: number | Vector3): Matrix4x4;
static WorldToLocalMatrix(position: Vector3, rotation: Quaternion, scale: number | Vector3): Matrix4x4;
static identity: Matrix4x4;
static zero: Matrix4x4;
columns: number[][];
m11: number;
m12: number;
m13: number;
m14: number;
m21: number;
m22: number;
m23: number;
m24: number;
m31: number;
m32: number;
m33: number;
m34: number;
m41: number;
m42: number;
m43: number;
m44: number;
rows: number[][];
size: { rows: number, columns: number };
values: number[];
determinant(): number
inverse(): Matrix4x4;
negate(): Matrix4x4;
transpose(): Matrix4x4;
add(matrix4x4: Matrix4x4): Matrix4x4;
sub(matrix4x4: Matrix4x4): Matrix4x4;
mul(matrix4x4: Matrix4x4): Matrix4x4;
mulScalar(scalar: number): Matrix4x4;
mulVector3(vector3: Vector3): Vector3;
}
export class Transform {
constructor(position?: Vector3, rotation?: Quaternion);
forward: Vector3;
localPosition: Vector3;
localRotation: Quaternion;
localToWorldMatrix: Matrix4x4;
name: string;
parent: Transform;
position: Vector3;
right: Vector3;
root: Transform;
rotation: Vector3;
up: Vector3;
worldToLocalMatrix: Matrix4x4;
addChild(child: Transform): void;
inverseTransformPosition(position: Vector3): Vector3;
removeChild(child: Transform): void;
transformPosition(position: Vector3): Vector3;
translate(translation: Vector3, relativeTo?: Transform.Space): Transform;
rotate(x: number, y: number, z: number, relativeTo?: Transform.Space): Transform;
}
export namespace Transform {
export enum Space {
Self,
World
}
}
+7
View File
@@ -0,0 +1,7 @@
import * as math3d from 'math3d';
const v = new math3d.Vector3(1, 2, 3);
v.add(new math3d.Vector3(0, 0, 1));
new math3d.Matrix4x4([1,1,1,1,
2,2,2,2,
3,3,3,3,
4,4,4,4]);
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"math3d-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+35 -12
View File
@@ -487,7 +487,7 @@ declare namespace Matter {
* @type boolean
* @default true
*/
visible: boolean;
visible?: boolean;
/**
* An `Object` that defines the sprite properties to use when rendering, if any.
@@ -495,31 +495,31 @@ declare namespace Matter {
* @property render.sprite
* @type object
*/
sprite: IBodyRenderOptionsSprite;
sprite?: IBodyRenderOptionsSprite;
/**
* A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values.
Default: a random colour
*/
fillStyle: string;
fillStyle?: string;
/**
* A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered.
Default: 1.5
*/
lineWidth: number;
lineWidth?: number;
/**
* A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values.
Default: a random colour
*/
strokeStyle: string;
strokeStyle?: string;
/*
* Sets the opacity. 1.0 is fully opaque. 0.0 is fully translucent
*/
opacity: number;
opacity?: number;
}
export interface IBodyRenderOptionsSprite {
@@ -1969,6 +1969,11 @@ declare namespace Matter {
*/
enableSleeping: boolean;
/**
* Collision pair set for this `Engine`.
*/
pairs: any;
/**
* An integer `Number` that specifies the number of position iterations to perform each update.
* The higher the value, the higher quality the simulation will be at the expense of performance.
@@ -2124,7 +2129,7 @@ declare namespace Matter {
* @param {} options
* @return {MouseConstraint} A new MouseConstraint
*/
create(engine: Engine, options: IMouseConstraintDefinition): MouseConstraint;
static create(engine: Engine, options?: IMouseConstraintDefinition): MouseConstraint;
/**
* The `Constraint` object that is used to move the body during interaction.
@@ -2173,6 +2178,21 @@ declare namespace Matter {
type: string;
}
/**
* The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets.
*
* @class Pairs
*/
export class Pairs {
/**
* Clears the given pairs structure.
* @method clear
* @param {pairs} pairs
* @return {pairs} pairs
*/
static clear(pairs: any): any;
}
export interface IPair {
id: number;
bodyA: Body;
@@ -2328,9 +2348,12 @@ declare namespace Matter {
*/
hasBounds?: boolean;
/**
* Render wireframes only
* @type boolean
* @default true
*/
wireframes?: boolean;
}
/**
@@ -2923,7 +2946,7 @@ declare namespace Matter {
* @param body
* @returns world
*/
static add(world: World, body: Body | Array<Body> | Composite | Array<Composite> | Constraint | Array<Constraint>): World;
static add(world: World, body: Body | Array<Body> | Composite | Array<Composite> | Constraint | Array<Constraint> | MouseConstraint): World;
/**
* An alias for Composite.addBody since World is also a Composite
@@ -3285,7 +3308,7 @@ declare namespace Matter {
* @param eventNames
* @param event
*/
static trigger(object: any, eventNames: string, event: (e: any) => void): void;
static trigger(object: any, eventNames: string, event?: (e: any) => void): void;
}
}
+4 -2
View File
@@ -982,8 +982,10 @@ export interface FindOperatorsOrdered {
upsert(): FindOperatorsOrdered;
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html
//http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html
export interface UnorderedBulkOperation {
//http://mongodb.github.io/node-mongodb-native/2.1/api/lib_bulk_unordered.js.html line 339
length: number;
//http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute
execute(callback: MongoCallback<BulkWriteResult>): void;
execute(options?: FSyncOptions): Promise<BulkWriteResult>;
@@ -1170,7 +1172,7 @@ export interface Cursor extends Readable, NodeJS.EventEmitter {
// http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#limit
limit(value: number): Cursor;
// http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#map
map(transform: Function): void;
map(transform: Function): Cursor;
// http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#max
max(max: number): Cursor;
//http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html#maxAwaitTimeMS
+1 -1
View File
@@ -19,7 +19,7 @@ export declare class Form extends events.EventEmitter {
* @param callback
*/
parse(request: http.IncomingMessage, callback?: (error: Error, fields: any, files: any) => any): void;
}
}
export interface File {
/**
-1
View File
@@ -1,4 +1,3 @@

/// <reference types="qunit"/>
+81 -86
View File
@@ -5,93 +5,88 @@
/// <reference types="node" />
declare var needle: Needle.NeedleStatic;
export = needle;
declare module "needle" {
import * as http from 'http';
import * as Buffer from 'buffer';
module Needle {
interface NeedleResponse extends http.IncomingMessage {
body: any;
raw: Buffer;
bytes: number;
}
declare namespace Needle {
interface ReadableStream extends NodeJS.ReadableStream {
}
interface ReadableStream extends NodeJS.ReadableStream {
}
interface Callback {
(error: Error, response: any, body: any): void;
interface Callback {
(error: Error, response: NeedleResponse, body: any): void;
}
interface RequestOptions {
timeout?: number;
follow?: number;
follow_max?: number;
multipart?: boolean;
proxy?: string;
agent?: string;
headers?: Object;
auth?: string; // auto | digest | basic (default)
json?: boolean;
// These properties are overwritten by those in the 'headers' field
compressed?: boolean;
cookies?: { [name: string]: any; };
// Overwritten if present in the URI
username?: string;
password?: string;
}
interface ResponseOptions {
decode?: boolean;
parse?: boolean;
output?: any;
}
interface TLSOptions {
pfx?: any;
key?: any;
passphrase?: string;
cert?: any;
ca?: any;
ciphers?: any;
rejectUnauthorized?: boolean;
secureProtocol?: any;
}
interface NeedleStatic {
defaults(options?: any): void;
head(url: string): ReadableStream;
head(url: string, callback?: Callback): ReadableStream;
head(url: string, options?: RequestOptions, callback?: Callback): ReadableStream;
get(url: string): ReadableStream;
get(url: string, callback?: Callback): ReadableStream;
get(url: string, options?: RequestOptions, callback?: Callback): ReadableStream;
post(url: string, data: any): ReadableStream;
post(url: string, data: any, callback?: Callback): ReadableStream;
post(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
put(url: string, data: any): ReadableStream;
put(url: string, data: any, callback?: Callback): ReadableStream;
put(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
delete(url: string, data: any): ReadableStream;
delete(url: string, data: any, callback?: Callback): ReadableStream;
delete(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
request(method: string, url: string, data: any): ReadableStream;
request(method: string, url: string, data: any, callback?: Callback): ReadableStream;
request(method: string, url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
}
}
interface RequestOptions {
timeout?: number;
follow?: number;
follow_max?: number;
multipart?: boolean;
proxy?: string;
agent?: string;
headers?: HttpHeaderOptions;
auth?: string; // auto | digest | basic (default)
json?: boolean;
// These properties are overwritten by those in the 'headers' field
compressed?: boolean;
cookies?: { [name: string]: any; };
// Overwritten if present in the URI
username?: string;
password?: string;
}
interface ResponseOptions {
decode?: boolean;
parse?: boolean;
output?: any;
}
interface HttpHeaderOptions {
cookies?: { [name: string]: any; };
compressed?: boolean;
accept?: string;
connection?: string;
user_agent?: string;
// Overwritten if present in the URI
username?: string;
password?: string;
}
interface TLSOptions {
pfx?: any;
key?: any;
passphrase?: string;
cert?: any;
ca?: any;
ciphers?: any;
rejectUnauthorized?: boolean;
secureProtocol?: any;
}
interface NeedleOptions extends RequestOptions, ResponseOptions, HttpHeaderOptions, TLSOptions {
}
interface NeedleStatic {
defaults(options?: any): void;
head(url: string): ReadableStream;
head(url: string, callback?: Callback): ReadableStream;
head(url: string, options?: RequestOptions, callback?: Callback): ReadableStream;
get(url: string): ReadableStream;
get(url: string, callback?: Callback): ReadableStream;
get(url: string, options?: RequestOptions, callback?: Callback): ReadableStream;
post(url: string, data: any): ReadableStream;
post(url: string, data: any, callback?: Callback): ReadableStream;
post(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
put(url: string, data: any): ReadableStream;
put(url: string, data: any, callback?: Callback): ReadableStream;
put(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
delete(url: string, data: any): ReadableStream;
delete(url: string, data: any, callback?: Callback): ReadableStream;
delete(url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
request(method: string, url: string, data: any): ReadableStream;
request(method: string, url: string, data: any, callback?: Callback): ReadableStream;
request(method: string, url: string, data: any, options?: RequestOptions, callback?: Callback): ReadableStream;
}
}
var needle: Needle.NeedleStatic;
export = needle;
}
-2
View File
@@ -1,5 +1,3 @@
import needle = require("needle");
function Usage() {
+1 -1
View File
@@ -237,7 +237,7 @@ declare module 'angular' {
template: string;
controller?: string| any[] | any;
controllerAs?: string;
bindToController?: boolean;
bindToController?: boolean;
/**
* Scope object that will be passed to dialog. If you use controller with separate $scope service this object will be passed to $scope.$parent param.
+14
View File
@@ -91,6 +91,20 @@ declare module 'angular' {
*/
ngfValidateForce?: boolean;
}
interface ResizeIfFunction {
(width: number, height: number): boolean;
}
interface FileResizeOptions {
centerCrop?: boolean;
height?: number;
ratio?: number;
resizeIf?: ResizeIfFunction;
restoreExif?: boolean;
quality?: number;
width?: number;
}
interface ResizeIfFunction {
(width: number, height: number): boolean;
+1 -1
View File
@@ -85,7 +85,7 @@ class UploadController {
ratio: 0.9,
centerCrop: true,
restoreExif: true,
resizeIf: (width, height) => {
resizeIf: (width: number, height: number) => {
return true;
}
})
+2 -2
View File
@@ -22,13 +22,13 @@ interface Options {
linefeed?: string;
omitSourceMapUrl?: boolean;
outFile?: string;
outputStyle?: "compact" | "compressed" | "expanded" | "nested";
outputStyle?: "compact" | "compressed" | "expanded" | "nested";
precision?: number;
sourceComments?: boolean;
sourceMap?: boolean | string;
sourceMapContents?: boolean;
sourceMapEmbed?: boolean;
sourceMapRoot?: string;
sourceMapRoot?: string;
}
interface SassError extends Error {
-1
View File
@@ -1,4 +1,3 @@
import * as sass from 'node-sass';
sass.render({
file: '/path/to/myFile.scss',
+1 -1
View File
@@ -1539,7 +1539,7 @@ declare module "child_process" {
disconnect(): void;
unref(): void;
ref(): void;
/**
* events.EventEmitter
* 1. close
+5 -5
View File
@@ -9,7 +9,7 @@ interface Source1 {
}
interface Result extends Target, Source1 {
}
interface Source2 {
@@ -17,7 +17,7 @@ interface Source2 {
}
interface Result2 extends Result, Source2 {
}
interface Source3 {
@@ -25,7 +25,7 @@ interface Source3 {
}
interface Result3 extends Result2, Source3 {
}
interface Source4 {
@@ -33,7 +33,7 @@ interface Source4 {
}
interface Result4 extends Result3, Source4 {
}
interface Source5 {
@@ -41,7 +41,7 @@ interface Source5 {
}
interface Result5 extends Result4, Source5 {
}
function assign1(): Result {
+1435 -1221
View File
File diff suppressed because it is too large Load Diff
+416
View File
@@ -0,0 +1,416 @@
// Type definitions for plugapi
// Project: https://www.npmjs.com/package/plugapi
// Definitions by: Brice Theurillat <https://github.com/BNedry/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace PlugAPI {
export interface PlugLogin {
email: string;
password: string;
}
export interface Notification {
action: string;
id: number;
timestamp: string;
value: string;
}
export interface RawChatMessage {
cid: string;
message: string;
sub: number;
uid: number;
un: string;
}
export interface Media {
author: string;
format: number;
image: string;
cid: string;
duration: number;
title: string;
id: number;
}
export interface Score {
positive: number;
listeners: number;
grabs: number;
negative: number;
skipped: number;
}
export interface LastPlay {
dj: User.DJ;
media: Media;
score: Score;
}
export interface FollowJoinData {
r: number;
un: string;
id: string;
}
export interface LogObject {
log: () => void;
}
export namespace User {
interface Default {
username: string;
language: string;
avatarID: string;
}
interface Extended extends Default {
status: number;
fans: number;
listenerPoints: number;
id: string;
curatorPoints: number;
djPoints: number;
}
interface Update extends Extended {
dateJoined: string;
}
interface Room extends Default {
sub: number;
level: number;
joined: string;
id: number;
badge: string;
role: number;
gRole: number;
slug: string;
}
interface User extends Room {
silver: boolean;
guest: boolean;
}
interface DJ extends Room {
blurp: any;
grab: boolean;
status: number;
vote: number;
}
interface Audience extends DJ {
ignores: any[];
notifications: Notification[];
pp: number;
pw: number;
xp: number;
}
}
export namespace Enum {
interface RoomRole {
NONE: number;
RESIDENTDJ: number;
BOUNCER: number;
MANAGER: number;
COHOST: number;
HOST: number;
}
interface GlobalRole {
NONE: number;
VOLUNTEER: number;
AMBASSADOR: number;
LEADER: number;
ADMIN: number;
}
interface Status {
OFFLINE: number;
ONLINE: number;
}
interface Ban {
HOUR: "h";
DAY: "d";
PERMA: "f";
}
interface BanReason {
SPAMMING_TROLLING: number;
VERBAL_ABUSE: number;
OFFENSIVE_MEDIA: number;
INAPPROPRIATE_GENRE: number;
NEGATIVE_ATTITUDE: number;
}
interface Mute {
SHORT: "s";
MEDIUM: "m";
LONG: "l";
}
interface MuteReason {
VIOLATING_COMMUNITY_RULES: number;
VERBAL_ABUSE: number;
SPAMMING_TROLLING: number;
OFFENSIVE_LANGUAGE: number;
NEGATIVE_ATTITUDE: number;
}
interface Events {
ADVANCE: "advance";
BAN: "ban";
BOOTH_LOCKED: "boothLocked";
CHAT: "chat";
CHAT_COMMAND: "command";
CHAT_DELETE: "chatDelete";
CHAT_LEVEL_UPDATE: "roomMinChatLevelUpdate";
COMMAND: "command";
DJ_LIST_CYCLE: "djListCycle";
DJ_LIST_UPDATE: "djListUpdate";
DJ_LIST_LOCKED: "djListLocked";
EARN: "earn";
FOLLOW_JOIN: "followJoin";
FLOOD_CHAT: "floodChat";
FRIEND_REQUEST: "friendRequest";
GIFTED: "gifted";
GRAB: "grab";
KILL_SESSION: "killSession";
MAINT_MODE: "plugMaintenance";
MAINT_MODE_ALERT: "plugMaintenanceAlert";
MODERATE_ADD_DJ: "modAddDJ";
MODERATE_ADD_WAITLIST: "modAddWaitList";
MODERATE_AMBASSADOR: "modAmbassador";
MODERATE_BAN: "modBan";
MODERATE_MOVE_DJ: "modMoveDJ";
MODERATE_MUTE: "modMute";
MODERATE_REMOVE_DJ: "modRemoveDJ";
MODERATE_REMOVE_WAITLIST: "modRemoveWaitList";
MODERATE_SKIP: "modSkip";
MODERATE_STAFF: "modStaff";
NOTIFY: "notify";
PDJ_MESSAGE: "pdjMessage";
PDJ_UPDATE: "pdjUpdate";
PING: "ping";
PLAYLIST_CYCLE: "playlistCycle";
REQUEST_DURATION: "requestDuration";
REQUEST_DURATION_RETRY: "requestDurationRetry";
ROOM_CHANGE: "roomChanged";
ROOM_DESCRIPTION_UPDATE: "roomDescriptionUpdate";
ROOM_JOIN: "roomJoin";
ROOM_NAME_UPDATE: "roomNameUpdate";
ROOM_VOTE_SKIP: "roomVoteSkip";
ROOM_WELCOME_UPDATE: "roomWelcomeUpdate";
SESSION_CLOSE: "sessionClose";
SKIP: "skip";
STROBE_TOGGLE: "strobeToggle";
USER_COUNTER_UPDATE: "userCounterUpdate";
USER_FOLLOW: "userFollow";
USER_JOIN: "userJoin";
USER_LEAVE: "userLeave";
USER_UPDATE: "userUpdate";
VOTE: "vote";
}
}
export namespace Event {
interface BoothCycle {
moderator: string;
cycle: boolean;
}
interface BoothLocked {
m: string;
c: boolean;
ml: string;
f: boolean;
}
interface Chat {
raw: RawChatMessage;
id: string;
from: User.User;
message: string;
mentions: any[];
muted: boolean;
type: string;
}
interface ChatDelete {
mi: number;
chatID: string;
}
type Grab = number;
interface Advance {
media: Media;
startTime: string;
historyID: string;
djs: User.DJ[];
currentDJ: User.DJ;
playlistID: number;
lastPlay: LastPlay;
}
interface DJListUpdate {
djs: User.DJ[];
remove: string;
}
interface Emote {
fromID: string;
message: string;
from: string;
type: string;
chatID: string;
}
interface FollowJoin {
data: FollowJoinData;
type: string;
}
interface ModAddDJ {
moderator: string;
username: string;
}
interface ModBan {
moderator: string;
username: string;
duration: number;
ref: string;
reason: string;
}
interface ModMoveDJ {
moderator: string;
index: number;
old: number;
userID: string;
}
interface ModRemoveDJ {
moderator: string;
username: string;
userID: string;
}
interface ModSkip {
mi: number;
m: string;
}
interface RoomMinChatLevelUpdate {
level: number;
id: number;
user: User.User;
}
type RoomJoin = string;
type UserJoin = User.User;
type UserLeave = User.User;
interface UserUpdate {
username: string;
status: number;
fans: number;
listenerPoints: number;
dateJoined: string;
language: string;
avatarID: string;
id: string;
curatorPoints: number;
djPoints: number;
}
interface Vote {
i: number;
v: number;
}
interface Command extends Event.Chat {
command: string;
args: string[];
respond: (...args: any[]) => any;
respondTimeout: (...args: any[]) => any;
havePermission: (...args: any[]) => boolean;
isFrom: (...args: any[]) => boolean;
}
}
export var ROOM_ROLE: Enum.RoomRole;
export var GLOBAL_ROLES: Enum.GlobalRole;
export var STATUS: Enum.Status;
export var BAN: Enum.Ban;
export var BAN_REASON: Enum.BanReason;
export var MUTE: Enum.Mute;
export var MUTE_REASON: Enum.MuteReason;
export var events: Enum.Events;
}
declare class PlugAPI {
constructor(login: PlugAPI.PlugLogin, callback?: (error: Error, bot: PlugAPI) => void);
constructor(login: PlugAPI.PlugLogin, callback?: (bot: PlugAPI) => void);
deleteAllChat: boolean;
multiLine: boolean;
multiLineLimit: number;
connect(room: string): void;
changeDJCycle(enabled: boolean, callback?: () => void): boolean;
changeRoom(room: string, callback?: () => void): void;
close(): void;
getAdmins(): PlugAPI.User.Extended[];
getAmbassadors(): PlugAPI.User.Extended[];
getAudience(): PlugAPI.User.Audience[];
getDJ(): PlugAPI.User.DJ;
getDJs(): PlugAPI.User.DJ[];
getHost(): PlugAPI.User.Extended;
getMedia(): PlugAPI.Media;
getRoomScore(): PlugAPI.Score;
getSelf(): PlugAPI.User.Audience;
getStaff(): PlugAPI.User.Extended[];
getTimeElapsed(): number;
getTimeRemaining(): number;
getUser(userID: number): PlugAPI.User.DJ;
getUsers(): PlugAPI.User.DJ[];
getWaitList(): PlugAPI.User.Extended;
getWaitListPosition(userID: number): number;
havePermission(userID: number, permission: number, global?: boolean): boolean;
joinBooth(callback?: () => void): boolean;
leaveBooth(callback?: () => void): boolean;
selfSkip(callback?: () => void): boolean;
sendChat(msg: string, timeout?: number): void;
setLogger(logObject: PlugAPI.LogObject): boolean;
on(event: "boothCycle", callback: (data: PlugAPI.Event.BoothCycle) => void): void;
on(event: "boothLocked", callback: (data: PlugAPI.Event.BoothLocked) => void): void;
on(event: "chat", callback: (data: PlugAPI.Event.Chat) => void): void;
on(event: "chatDelete", callback: (data: PlugAPI.Event.ChatDelete) => void): void;
on(event: "grab", callback: (data: PlugAPI.Event.Grab) => void): void;
on(event: "advance", callback: (data: PlugAPI.Event.Advance) => void): void;
on(event: "djListUpdate", callback: (data: PlugAPI.Event.DJListUpdate) => void): void;
on(event: "emote", callback: (data: PlugAPI.Event.Emote) => void): void;
on(event: "followJoin", callback: (data: PlugAPI.Event.FollowJoin) => void): void;
on(event: "modAddDJ", callback: (data: PlugAPI.Event.ModAddDJ) => void): void;
on(event: "modBan", callback: (data: PlugAPI.Event.ModBan) => void): void;
on(event: "modMoveDJ", callback: (data: PlugAPI.Event.ModMoveDJ) => void): void;
on(event: "modRemoveDJ", callback: (data: PlugAPI.Event.ModRemoveDJ) => void): void;
on(event: "modSkip", callback: (data: PlugAPI.Event.ModSkip) => void): void;
on(event: "roomMinChatLevelUpdate", callback: (data: PlugAPI.Event.RoomMinChatLevelUpdate) => void): void;
on(event: "roomJoin", callback: (data: PlugAPI.Event.RoomJoin) => void): void;
on(event: "userJoin", callback: (data: PlugAPI.Event.UserJoin) => void): void;
on(event: "userLeave", callback: (data: PlugAPI.Event.UserLeave) => void): void;
on(event: "userUpdate", callback: (data: PlugAPI.Event.UserUpdate) => void): void;
on(event: "vote", callback: (data: PlugAPI.Event.Vote) => void): void;
on(event: "command", callback: (data: PlugAPI.Event.Command) => void): void;
on(event: string, callback: (data: any) => void): void;
}
export = PlugAPI;
+33
View File
@@ -0,0 +1,33 @@
import PlugAPI = require("plugapi");
new PlugAPI({
email: "",
password: ""
}, function (err, bot) {
if (!err) {
const ROOM = "roomslug";
bot.connect(ROOM); // The part after https://plug.dj
bot.on(PlugAPI.events.ROOM_JOIN, function (room) {
console.log("Joined " + room);
});
bot.on("chat", function (data) {
if (data.type == "emote") {
console.log(data.from + data.message);
} else {
console.log(data.from + "> " + data.message);
}
});
bot.on("error", function () {
bot.connect(ROOM);
});
bot.deleteAllChat = false;
bot.multiLine = true;
bot.multiLineLimit = 5;
} else {
console.log("Error initializing plugAPI: " + err);
}
});
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"plugapi-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+21 -20
View File
@@ -3,28 +3,29 @@
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "query-string" {
type value = string | boolean | number;
interface StringifyOptions { strict?: boolean; encode?: boolean; }
/**
* Parse a query string into an object.
* Leading ? or # are ignored, so you can pass location.search or location.hash directly.
* @param str
*/
export declare function parse(str: string): { [key: string]: string | string[] };
/**
* Parse a query string into an object.
* Leading ? or # are ignored, so you can pass location.search or location.hash directly.
* @param str
*/
export function parse(str: string): { [key: string]: string | string[] };
/**
* Stringify an object into a query string, sorting the keys.
*
* @param obj
*/
export declare function stringify(obj: { [key: string]: value | value[] }, options?: StringifyOptions): string;
/**
* Stringify an object into a query string, sorting the keys.
*
* @param obj
*/
export function stringify(obj: { [key: string]: value | value[] }, options?: StringifyOptions): string;
/**
* Extract a query string from a URL that can be passed into .parse().
*
* @param str
*/
export declare function extract(str: string): string;
/**
* Extract a query string from a URL that can be passed into .parse().
*
* @param str
*/
export function extract(str: string): string;
}
+1 -1
View File
@@ -27,7 +27,7 @@ declare namespace Quill {
placeholder?: string,
readOnly?: boolean,
theme?: string,
formats?: string[]
formats?: string[]
}
export interface BoundsStatic {
+1 -3
View File
@@ -1,5 +1,3 @@
QUnit.test("assert.async() test", function (assert) {
var done = assert.async();
var input = [];
@@ -1666,4 +1664,4 @@ QUnit.extend(QUnit.assert, {
var expected = "String matching /" + regex.toString() + "/";
this.push(success, actual, expected, message);
}
});
});
+1 -1
View File
@@ -551,4 +551,4 @@ QUnit.module( "module", {
});
QUnit.test( "test with beforeEach and afterEach", function( assert ) {
assert.expect( 2 );
});
});
+1 -1
View File
@@ -16,4 +16,4 @@
"index.d.ts",
"qunit-tests.ts"
]
}
}
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for random-seed 0.3.0
// Project: https://github.com/skratchdot/random-seed/
// Definitions by: Endel Dreyer <https://github.com/endel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface RandomSeed {
range (range: number): number;
random (): number;
floatBetween (min: number, max: number): number;
intBetween (min: number, max: number): number;
string (count: number): string;
seed (seed: string): void;
cleanString (inStr: string): string;
hashString (inStr: string): string;
addEntropy (...args: any[]): void;
initState (): void;
done (): void;
}
export function create (seed?: string): RandomSeed;
+17
View File
@@ -0,0 +1,17 @@
import { RandomSeed, create } from "random-seed";
// these generators produce different numbers
let rand1: RandomSeed = create(); // method 1
// these generators will produce
// the same sequence of numbers
let seed = 'My Secret String Value';
let rand2 = create(seed);
// API
rand1.addEntropy();
rand1.random();
rand1.range(100);
rand1.intBetween(0, 10);
rand1.floatBetween(0, 1);
rand1.seed("new seed");
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"random-seed-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+2
View File
@@ -47,6 +47,8 @@ Raven.setUserContext({
Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
Raven.showReportDialog(options);
Raven.setTagsContext({ key: "value" });
Raven.setExtraContext({ foo: "bar" });
+1 -1
View File
@@ -121,8 +121,8 @@ export interface BootstrapTableProps extends Props<BootstrapTable> {
headerStyle?: any;
bodyStyle?: any;
ignoreSinglePage?: boolean;
}
export type SelectRowMode = 'none' | 'radio' | 'checkbox';
export interface SelectRow {
+1 -1
View File
@@ -17,4 +17,4 @@
"index.d.ts",
"react-native-sortable-list-tests.tsx"
]
}
}
+3
View File
@@ -385,6 +385,9 @@ export interface RedisClient extends NodeJS.EventEmitter {
hscan(args: any[], callback?: ResCallbackT<any>): boolean;
zscan(...args: any[]): boolean;
zscan(args: any[], callback?: ResCallbackT<any>): boolean;
// Extras
duplicate(options?:any[], callback?:ResCallbackT<any>): RedisClient;
}
export interface Multi {
+3 -1
View File
@@ -110,4 +110,6 @@ client.multi(commandArr).exec();
client.monitor(resCallback);
// Send command
client.send_command(str, args, resCallback);
client.send_command(str, args, resCallback);
// Duplicate
client.duplicate();
+10
View File
@@ -44,6 +44,11 @@ declare namespace ReduxActions {
metaCreator: (...args: any[]) => Meta
): (...args: any[]) => ActionMeta<Payload, Meta>;
export function handleAction<StateAndPayload>(
actionType: { toString: () => string },
reducer: Reducer<StateAndPayload, StateAndPayload> | ReducerMap<StateAndPayload, StateAndPayload>
): Reducer<StateAndPayload, StateAndPayload>;
export function handleAction<State, Payload>(
actionType: { toString(): string },
reducer: Reducer<State, Payload> | ReducerMap<State, Payload>
@@ -54,6 +59,11 @@ declare namespace ReduxActions {
reducer: ReducerMeta<State, Payload, Meta> | ReducerMap<State, Payload>
): Reducer<State, Payload>;
export function handleActions<StateAndPayload>(
reducerMap: ReducerMap<StateAndPayload, StateAndPayload>,
initialState?: StateAndPayload
): Reducer<StateAndPayload, StateAndPayload>;
export function handleActions<State, Payload>(
reducerMap: ReducerMap<State, Payload>,
initialState?: State
+1 -1
View File
@@ -9,7 +9,7 @@
import * as React from 'react';
import { GenericStoreEnhancer } from 'redux';
interface IDevTools {
export interface IDevTools {
new (): JSX.ElementClass;
instrument(): GenericStoreEnhancer
}
+2
View File
@@ -84,6 +84,8 @@ declare namespace request {
aws?: AWSOptions;
hawk?: HawkOptions;
qs?: any;
qsStringifyOptions?: any;
qsParseOptions?: any;
json?: any;
multipart?: RequestPart[] | Multipart;
agent?: http.Agent | https.Agent;
+9
View File
@@ -93,6 +93,15 @@ declare namespace restangular {
extendModel(route: string, extender: (model: IElement) => any): void;
extendCollection(route: string, extender: (collection: ICollection) => any): void;
}
interface IScopedService extends IService {
one(id: number): IElement;
one(id: string): IElement;
post(elementToPost: any, queryParams?: any, headers?: any): IPromise<any>;
post<T>(elementToPost: T, queryParams?: any, headers?: any): IPromise<T>;
getList(queryParams?: any, headers?: any): ICollectionPromise<any>;
getList<T>(queryParams?: any, headers?: any): ICollectionPromise<T>;
}
interface IScopedService extends IService {
one(id: number): IElement;
+12 -12
View File
@@ -468,22 +468,22 @@ interface ClientOptions {
}
interface Client {
get: (opts: string | { path?: string;[name: string]: any }, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
head: (opts: string | { path?: string;[name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any;
post: (opts: string | { path?: string;[name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
put: (opts: string | { path?: string;[name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
patch: (opts: string | { path?: string;[name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
del: (opts: string | { path?: string;[name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any;
get: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
head: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any;
post: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
put: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
patch: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
del: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any;
basicAuth: (username: string, password: string) => any;
}
interface HttpClient extends Client {
get: (opts?: string | { path?: string;[name: string]: any }, callback?: Function) => any;
head: (opts?: string | { path?: string;[name: string]: any }, callback?: Function) => any;
post: (opts?: string | { path?: string;[name: string]: any }, callback?: Function) => any;
put: (opts?: string | { path?: string;[name: string]: any }, callback?: Function) => any;
patch: (opts?: string | { path?: string;[name: string]: any }, callback?: Function) => any;
del: (opts?: string | { path?: string;[name: string]: any }, callback?: Function) => any;
get: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
head: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
post: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
put: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
patch: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
del: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
}
interface ThrottleOptions {
+502 -226
View File
@@ -1,240 +1,516 @@
// Type definitions for Rethinkdb 1.10.0
// Type definitions for RethinkDB 2.3
// Project: http://rethinkdb.com/
// Definitions by: Sean Hess <https://seanhess.github.io/>
// Definitions by: Alex Gorbatchev <https://github.com/alexgorbatchev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Reference: http://www.rethinkdb.com/api/#js
// TODO: Document manipulation and below
//
// Reference: https://rethinkdb.com/api/javascript/
//
// Notes:
// - Currently missing control structures and geospatial commands. Please help out!
//
// Testing:
// $ tsc --noImplicitAny --module commonjs -p rethinkdb/
///<reference types="bluebird"/>
/// <reference types="node"/>
export declare function connect(host: ConnectionOptions, cb?: (err: Error, conn: Connection) => void): Promise<Connection>;
/**
* https://rethinkdb.com/api/javascript/
*/
declare module "rethinkdb" {
/**
* Create a new connection to the database server.
*
* See: https://rethinkdb.com/api/javascript/connect/
*/
export function connect(opts: ConnectionOptions, cb: (err: ReqlDriverError, conn: Connection) => void): void;
export function connect(host: string, cb: (err: ReqlDriverError, conn: Connection) => void): void;
export function connect(opts: ConnectionOptions): Promise<Connection>;
export function connect(host: string): Promise<Connection>;
export declare function dbCreate(name: string): Operation<CreateResult>;
export declare function dbDrop(name: string): Operation<DropResult>;
export declare function dbList(): Operation<string[]>;
export function dbCreate(name: string): Operation<CreateResult>;
export function dbDrop(name: string): Operation<DropResult>;
export function dbList(): Operation<string[]>;
export declare function db(name: string): Db;
export declare function table(name: string, options?: { useOutdated: boolean }): Table;
export function db(name: string): Db;
export function table(name: string, options?: { useOutdated: boolean }): Table;
export declare function asc(property: string): Sort;
export declare function desc(property: string): Sort;
export function asc(property: string): Sort;
export function desc(property: string): Sort;
export declare var count: Aggregator;
export declare function sum(prop: string): Aggregator;
export declare function avg(prop: string): Aggregator;
export var count: Aggregator;
export function sum(prop: string): Aggregator;
export function avg(prop: string): Aggregator;
export declare function row(name: string): Expression<any>;
export declare function expr(stuff: any): Expression<any>;
export const row: Row;
export function expr(stuff: any): Expression<any>;
export declare function now(): Time;
export function now(): Expression<Time>;
// Control Structures
export declare function branch(test: Expression<boolean>, trueBranch: Expression<any>, falseBranch: Expression<any>): Expression<any>;
// Control Structures
export function branch(test: Expression<boolean>, trueBranch: Expression<any>, falseBranch: Expression<any>): Expression<any>;
/**
* Create a javascript expression.
*
* @param {Number} timeout - The number of seconds before `r.js` times out. The default value is `5` seconds.
*/
export function js(jsString: string, opts?: { timeout: number }): Operation<any>;
export declare class Cursor {
hasNext(): boolean;
each(cb: (err: Error, row: any) => void, done?: () => void): void;
each<T>(cb: (err: Error, row: T) => void, done?: () => void): void;
each(cb: (err: Error, row: any) => boolean, done?: () => void): void; // returning false stops iteration
each<T>(cb: (err: Error, row: T) => boolean, done?: () => void): void; // returning false stops iteration
next(cb: (err: Error, row: any) => void): void;
next<T>(cb: (err: Error, row: T) => void): void;
toArray(cb: (err: Error, rows: any[]) => void): void;
toArray<T>(cb: (err: Error, rows: T[]) => void): void;
toArray(): Promise<any[]>;
toArray<T>(): Promise<T[]>;
close(cb: (err: Error) => void): void;
close(): void;
/**
* Return a UUID (universally unique identifier), a string that can be used as a unique ID. If a string is passed to uuid as an argument, the UUID will be deterministic, derived from the string’s SHA-1 hash.
*
* RethinkDB’s UUIDs are standards-compliant. Without the optional argument, a version 4 random UUID will be generated; with that argument, a version 5 UUID will be generated, using a fixed namespace UUID of 91461c99-f89d-49d2-af96-d8e2e14e9b58.
*/
export function uuid(input?: string): Operation<string>;
export class Cursor {
hasNext(): boolean;
each(cb: (err: Error, row: any) => void, done?: () => void): void;
each<T>(cb: (err: Error, row: T) => void, done?: () => void): void;
each(cb: (err: Error, row: any) => boolean, done?: () => void): void; // returning false stops iteration
each<T>(cb: (err: Error, row: T) => boolean, done?: () => void): void; // returning false stops iteration
next(cb: (err: Error, row: any) => void): void;
next<T>(cb: (err: Error, row: T) => void): void;
toArray(cb: (err: Error, rows: any[]) => void): void;
toArray<T>(cb: (err: Error, rows: T[]) => void): void;
toArray(): Promise<any[]>;
toArray<T>(): Promise<T[]>;
close(cb: (err: Error) => void): void;
close(): Promise<void>;
}
interface Row extends Expression<any> {
(name: string): Expression<any>;
}
/**
* Connection options.
*
* See: https://rethinkdb.com/api/javascript/connect/
*/
interface ConnectionOptions {
/** The host to connect to (default `localhost`) */
host?: string;
/** The port to connect on (default `28015`) */
port?: number;
/** The default database (default `test`) */
db?: string;
/** The user account to connect as (default `admin`) */
user?: string;
/** The password for the user account to connect as (default `''`, empty) */
password?: string;
/** Timeout period in seconds for the connection to be opened (default `20`) */
timeout?: number;
/**
* A hash of options to support SSL connections (default `null`). Currently,
* there is only one option available, and if the `ssl` option is specified,
* this key is required.
*/
ssl?: {
/** A list of Node.js `Buffer` objects containing SSL CA certificates */
ca: Buffer[];
};
}
interface NoReplyWait {
noreplyWait: boolean;
}
interface Connection {
open: boolean;
close(cb: (err: Error) => void): void;
close(opts: NoReplyWait, cb: (err: Error) => void): void;
close(): Promise<void>;
close(opts: NoReplyWait): Promise<void>;
reconnect(cb: (err: Error, conn: Connection) => void): void;
reconnect(opts: NoReplyWait, cb: (err: Error, conn: Connection) => void): void;
reconnect(opts?: NoReplyWait): Promise<Connection>;
use(dbName: string): void;
addListener(event: string, cb: Function): void;
on(event: string, cb: Function): void;
}
interface Db {
tableCreate(name: string, options?: TableOptions): Operation<CreateResult>;
tableDrop(name: string): Operation<DropResult>;
tableList(): Operation<string[]>;
table(name: string, options?: GetTableOptions): Table;
}
interface TableOptions {
primary_key?: string; // 'id'
durability?: string; // 'soft'
cache_size?: number;
datacenter?: string;
}
interface GetTableOptions {
useOutdated: boolean;
}
interface Writeable {
update(obj: Object, options?: UpdateOptions): Operation<WriteResult>;
replace(obj: Object, options?: UpdateOptions): Operation<WriteResult>;
replace(expr: ExpressionFunction<any>): Operation<WriteResult>;
delete(options?: UpdateOptions): Operation<WriteResult>;
}
/**
* See: https://rethinkdb.com/api/javascript/changes/
*/
interface ChangesOptions {
/**
* Controls how change notifications are batched. Acceptable values are `true`, `false` and a numeric value:
*
* * `true`: When multiple changes to the same document occur before a batch of notifications is sent, the changes are “squashed” into one change. The client receives a notification that will bring it fully up to date with the server.
* * `false`: All changes will be sent to the client verbatim. This is the default.
* * `n`: A numeric value (floating point). Similar to `true`, but the server will wait `n` seconds to respond in order to squash as many changes together as possible, reducing network traffic. The first batch will always be returned immediately.
*/
squash: boolean | number;
/**
* The number of changes the server will buffer between client reads before it starts dropping changes and generates an error (default: 100,000).
*/
changefeedQueueSize: number;
/**
* If `true`, the changefeed stream will begin with the current contents of the table or selection being monitored. These initial results will have `new_val` fields, but no `old_val` fields. The initial results may be intermixed with actual changes, as long as an initial result for the changed document has already been given. If an initial result for a document has been sent and a change is made to that document that would move it to the unsent part of the result set (e.g., a changefeed monitors the top 100 posters, the first 50 have been sent, and poster 48 has become poster 52), an “uninitial” notification will be sent, with an `old_val` field but no `new_val` field.
*/
includeInitial: boolean;
/**
* If `true`, the changefeed stream will include special status documents consisting of the field `state` and a string indicating a change in the feed’s state. These documents can occur at any point in the feed between the notification documents described below. If `includeStates` is `false` (the default), the status documents will not be sent.
*/
includeStates: boolean;
/**
* If `true`, a changefeed stream on an `orderBy.limit` changefeed will include `old_offset` and `new_offset` fields in status documents that include `old_val` and `new_val`. This allows applications to maintain ordered lists of the stream’s result set. If `old_offset` is set and not `null`, the element at `old_offset` is being deleted; if `new_offset` is set and not `null`, then `new_val` is being inserted at `new_offset`. Setting `includeOffsets` to `true` on a changefeed that does not support it will raise an error.
*/
includeOffsets: boolean;
/**
* If `true`, every result on a changefeed will include a `type` field with a string that indicates the kind of change the result represents: `add`, `remove`, `change`, `initial`, `uninitial`, `state`. Defaults to `false`.
*/
includeTypes: boolean;
}
interface HasFields<T> {
/**
* Test if an object has one or more fields. An object has a field if it has that key and the key has a non-null value.
*
* `hasFields` lets you test for nested fields in objects. If the value of a field is itself a set of key/value pairs, you can test for the presence of specific keys.
*
* See: https://rethinkdb.com/api/javascript/has_fields/
*/
hasFields(selector: BooleanMap): T;
/**
* Test if an object has one or more fields. An object has a field if it has that key and the key has a non-null value. For instance, the object `{'a': 1,'b': 2,'c': null}` has the fields `a` and `b`.
*
* When applied to a single object, `hasFields` returns `true` if the object has the fields and `false` if it does not. When applied to a sequence, it will return a new sequence (an array or stream) containing the elements that have the specified fields.
*
* See: https://rethinkdb.com/api/javascript/has_fields/
*/
hasFields(...fields: string[]): T;
}
interface Table extends Sequence, HasFields<Sequence> {
indexCreate(name: string, index?: ExpressionFunction<any>): Operation<CreateResult>;
indexDrop(name: string): Operation<DropResult>;
indexList(): Operation<string[]>;
insert(obj: any[], options?: InsertOptions): Operation<WriteResult>;
insert(obj: any, options?: InsertOptions): Operation<WriteResult>;
get(key: string): Sequence; // primary key
getAll(key: string, index?: Index): Sequence; // without index defaults to primary key
getAll(...keys: string[]): Sequence;
/**
* Turn a query into a changefeed, an infinite stream of objects representing
* changes to the query’s results as they occur. A changefeed may return changes
* to a table or an individual document (a “point” changefeed). Commands such as
* filter or `map` may be used before the changes command to transform or filter
* the output, and many commands that operate on sequences can be chained after
* `changes`.
*
* See: https://rethinkdb.com/api/javascript/changes/
*/
changes(opts?: ChangesOptions): Sequence;
}
interface Sequence extends Operation<Cursor>, Writeable {
between(lower: any, upper: any, index?: Index): Sequence;
filter(rql: ExpressionFunction<boolean>): Sequence;
filter(rql: Expression<boolean>): Sequence;
filter(obj: { [key: string]: any }): Sequence;
// Join
// these return left, right
innerJoin(sequence: Sequence, join: JoinFunction<boolean>): Sequence;
outerJoin(sequence: Sequence, join: JoinFunction<boolean>): Sequence;
eqJoin(leftAttribute: string, rightSequence: Sequence, index?: Index): Sequence;
eqJoin(leftAttribute: ExpressionFunction<any>, rightSequence: Sequence, index?: Index): Sequence;
zip(): Sequence;
// Transform
map(transform: ExpressionFunction<any>): Sequence;
withFields(...selectors: any[]): Sequence;
concatMap(transform: ExpressionFunction<any>): Sequence;
orderBy(...keys: string[]): Sequence;
orderBy(...sorts: Sort[]): Sequence;
skip(n: number): Sequence;
limit(n: number): Sequence;
slice(start: number, end?: number): Sequence;
nth(n: number): Expression<any>;
indexesOf(obj: any): Sequence;
isEmpty(): Expression<boolean>;
union(sequence: Sequence): Sequence;
sample(n: number): Sequence;
// Aggregate
reduce(r: ReduceFunction<any>, base?: any): Expression<any>;
count(): Expression<number>;
distinct(): Sequence;
groupedMapReduce(group: ExpressionFunction<any>, map: ExpressionFunction<any>, reduce: ReduceFunction<any>, base?: any): Sequence;
groupBy(...aggregators: Aggregator[]): Expression<Object>; // TODO: reduction object
contains(prop: string): Expression<boolean>;
// Manipulation
pluck(...props: string[]): Sequence;
without(...props: string[]): Sequence;
}
interface ExpressionFunction<U> {
(doc: Expression<any>): Expression<U>;
}
interface JoinFunction<U> {
(left: Expression<any>, right: Expression<any>): Expression<U>;
}
interface ReduceFunction<U> {
(acc: Expression<any>, val: Expression<any>): Expression<U>;
}
interface InsertOptions {
upsert: boolean; // true
durability: string; // 'soft'
return_vals: boolean; // false
}
interface UpdateOptions {
non_atomic: boolean;
durability: string; // 'soft'
return_vals: boolean; // false
}
interface WriteResult {
inserted: number;
replaced: number;
unchanged: number;
errors: number;
deleted: number;
skipped: number;
first_error: Error;
generated_keys: string[]; // only for insert
}
interface JoinResult {
left: any;
right: any;
}
interface CreateResult {
created: number;
}
interface DropResult {
dropped: number;
}
interface Index {
index: string;
left_bound?: string; // 'closed'
right_bound?: string; // 'open'
}
interface BooleanMap {
[ key: string ]: Boolean | BooleanMap;
}
interface Expression<T> extends Writeable, Operation<T>, HasFields<Expression<number>> {
(prop: string): Expression<any>;
merge(query: Expression<Object>): Expression<Object>;
append(prop: string): Expression<Object>;
contains(prop: string): Expression<boolean>;
and(b: boolean | Expression<boolean>): Expression<boolean>;
or(b: boolean | Expression<boolean>): Expression<boolean>;
eq(v: any | Expression<any>): Expression<boolean>;
ne(v: any | Expression<any>): Expression<boolean>;
not(): Expression<boolean>;
gt(value: T): Expression<boolean>;
ge(value: T): Expression<boolean>;
lt(value: T): Expression<boolean>;
le(value: T): Expression<boolean>;
add(n: number): Expression<number>;
/**
* Subtract two numbers.
*
* See: https://rethinkdb.com/api/javascript/sub/
*
* Example:
*
* r.expr(2).sub(2).run(conn, callback)
*/
sub(n: number, ...numbers: number[]): Expression<number>;
/**
* Retrieve how many seconds elapsed between today and `date`.
*
* See: https://rethinkdb.com/api/javascript/sub/
*
* Example:
*
* r.now().sub(365 * 24 * 60 * 60)
*/
sub(date: Time): Expression<number>;
mul(n: number): Expression<number>;
div(n: number): Expression<number>;
mod(n: number): Expression<number>;
default(value: T): Expression<T>;
}
interface OperationOptions {
/**
* One of three possible values affecting the consistency guarantee for the query (default: 'single').
*
* * 'single' (the default) returns values that are in memory (but not necessarily written to disk) on the primary replica.
* * 'majority' will only return values that are safely committed on disk on a majority of replicas. This requires sending a message to every replica on each read, so it is the slowest but most consistent.
* * 'outdated' will return values that are in memory on an arbitrarily-selected replica. This is the fastest but least consistent.
*/
readMode: "single" | "majority" | "outdated";
/**
* What format to return times in (default: 'native'). Set this to 'raw' if you want times returned as JSON objects for exporting.
*/
timeFormat: "native" | "raw";
/**
* Whether or not to return a profile of the query’s execution (default: false).
*/
profile: boolean;
/**
* Possible values are 'hard' and 'soft'. In soft durability mode RethinkDB will acknowledge the write immediately after receiving it, but before the write has been committed to disk.
*/
durability: "hard" | "soft";
/**
* What format to return `grouped_data` and `grouped_streams` in (default: 'native'). Set this to 'raw' if you want the raw pseudotype.
*/
groupFormat: "native" | "raw";
/**
* Set to `true` to not receive the result object or cursor and return immediately.
*/
noreply: boolean;
/**
* The database to run this query against as a string. The default is the database specified in the db parameter to connect (which defaults to test). The database may also be specified with the db command.
*/
db: string;
/**
* The maximum numbers of array elements that can be returned by a query (default: 100,000). This affects all ReQL commands that return arrays. Note that it has no effect on the size of arrays being written to the database; those always have an upper limit of 100,000 elements.
*/
arrayLimit: number;
/**
* What format to return binary data in (default: 'native'). Set this to 'raw' if you want the raw pseudotype.
*/
binaryFormat: "native" | "raw";
/**
* Minimum number of rows to wait for before batching a result set (default: 8). This is an integer.
*/
minBatchRows: number;
/**
* Maximum number of rows to wait for before batching a result set (default: unlimited). This is an integer.
*/
maxBatchRows: number;
/**
* Maximum number of bytes to wait for before batching a result set (default: 1MB). This is an integer.
*/
maxBatchBytes: number;
/**
* Maximum number of seconds to wait before batching a result set (default: 0.5). This is a float (not an integer) and may be specified to the microsecond.
*/
maxBatchSeconds: number;
/**
* Factor to scale the other parameters down by on the first batch (default: 4). For example, with this set to 8 and maxBatchRows set to 80, on the first batch maxBatchRows will be adjusted to 10 (80 / 8). This allows the first batch to return faster.
*/
firstBatchScaledownFactor: number;
}
interface Operation<T> {
/**
* Run a query on a connection. The callback will get either an error, a single JSON result, or a cursor, depending on the query.
*
* See: https://rethinkdb.com/api/javascript/run/
*/
run(conn: Connection, opts: OperationOptions, cb: (err: Error, result: T) => void): void;
run(conn: Connection, cb: (err: Error, result: T) => void): void;
run(conn: Connection, opts: OperationOptions): Promise<T>;
run(conn: Connection): Promise<T>;
}
interface Aggregator { }
interface Sort { }
interface ReqlType {
$reql_type$: string;
}
interface Time extends ReqlType {
$reql_type$: "TIME";
epoch_time: number;
timezone: string;
}
interface Binary extends ReqlType {
$reql_type$: "BINARY";
data: string;
}
interface ReqlError extends Error {}
/**
* An error has occurred within the driver. This may be a driver bug, or it may
* be an unfulfillable command, such as an unserializable query.
*
* See https://www.rethinkdb.com/docs/error-types/
*/
interface ReqlDriverError extends ReqlError {}
}
interface ConnectionOptions {
host: string;
port: number;
db?: string;
authKey?: string;
}
interface Connection {
close(cb: (err: Error) => void): void;
close(opts: { noreplyWait: boolean }, cb: (err: Error) => void): void;
close(): void;
close(opts: { noreplyWait: boolean }): Promise<void>;
reconnect(cb?: (err: Error, conn: Connection) => void): Promise<Connection>;
use(dbName: string): void;
addListener(event: string, cb: Function): void;
on(event: string, cb: Function): void;
}
interface Db {
tableCreate(name: string, options?: TableOptions): Operation<CreateResult>;
tableDrop(name: string): Operation<DropResult>;
tableList(): Operation<string[]>;
table(name: string, options?: GetTableOptions): Table;
}
interface TableOptions {
primary_key?: string; // 'id'
durability?: string; // 'soft'
cache_size?: number;
datacenter?: string;
}
interface GetTableOptions {
useOutdated: boolean;
}
interface Writeable {
update(obj: Object, options?: UpdateOptions): Operation<WriteResult>;
replace(obj: Object, options?: UpdateOptions): Operation<WriteResult>;
replace(expr: ExpressionFunction<any>): Operation<WriteResult>;
delete(options?: UpdateOptions): Operation<WriteResult>;
}
interface Table extends Sequence {
indexCreate(name: string, index?: ExpressionFunction<any>): Operation<CreateResult>;
indexDrop(name: string): Operation<DropResult>;
indexList(): Operation<string[]>;
insert(obj: any[], options?: InsertOptions): Operation<WriteResult>;
insert(obj: any, options?: InsertOptions): Operation<WriteResult>;
get(key: string): Sequence; // primary key
getAll(key: string, index?: Index): Sequence; // without index defaults to primary key
getAll(...keys: string[]): Sequence;
}
interface Sequence extends Operation<Cursor>, Writeable {
between(lower: any, upper: any, index?: Index): Sequence;
filter(rql: ExpressionFunction<boolean>): Sequence;
filter(rql: Expression<boolean>): Sequence;
filter(obj: { [key: string]: any }): Sequence;
// Join
// these return left, right
innerJoin(sequence: Sequence, join: JoinFunction<boolean>): Sequence;
outerJoin(sequence: Sequence, join: JoinFunction<boolean>): Sequence;
eqJoin(leftAttribute: string, rightSequence: Sequence, index?: Index): Sequence;
eqJoin(leftAttribute: ExpressionFunction<any>, rightSequence: Sequence, index?: Index): Sequence;
zip(): Sequence;
// Transform
map(transform: ExpressionFunction<any>): Sequence;
withFields(...selectors: any[]): Sequence;
concatMap(transform: ExpressionFunction<any>): Sequence;
orderBy(...keys: string[]): Sequence;
orderBy(...sorts: Sort[]): Sequence;
skip(n: number): Sequence;
limit(n: number): Sequence;
slice(start: number, end?: number): Sequence;
nth(n: number): Expression<any>;
indexesOf(obj: any): Sequence;
isEmpty(): Expression<boolean>;
union(sequence: Sequence): Sequence;
sample(n: number): Sequence;
// Aggregate
reduce(r: ReduceFunction<any>, base?: any): Expression<any>;
count(): Expression<number>;
distinct(): Sequence;
groupedMapReduce(group: ExpressionFunction<any>, map: ExpressionFunction<any>, reduce: ReduceFunction<any>, base?: any): Sequence;
groupBy(...aggregators: Aggregator[]): Expression<Object>; // TODO: reduction object
contains(prop: string): Expression<boolean>;
// Manipulation
pluck(...props: string[]): Sequence;
without(...props: string[]): Sequence;
}
interface ExpressionFunction<U> {
(doc: Expression<any>): Expression<U>;
}
interface JoinFunction<U> {
(left: Expression<any>, right: Expression<any>): Expression<U>;
}
interface ReduceFunction<U> {
(acc: Expression<any>, val: Expression<any>): Expression<U>;
}
interface InsertOptions {
upsert: boolean; // true
durability: string; // 'soft'
return_vals: boolean; // false
}
interface UpdateOptions {
non_atomic: boolean;
durability: string; // 'soft'
return_vals: boolean; // false
}
interface WriteResult {
inserted: number;
replaced: number;
unchanged: number;
errors: number;
deleted: number;
skipped: number;
first_error: Error;
generated_keys: string[]; // only for insert
}
interface JoinResult {
left: any;
right: any;
}
interface CreateResult {
created: number;
}
interface DropResult {
dropped: number;
}
interface Index {
index: string;
left_bound?: string; // 'closed'
right_bound?: string; // 'open'
}
interface Expression<T> extends Writeable, Operation<T> {
(prop: string): Expression<any>;
merge(query: Expression<Object>): Expression<Object>;
append(prop: string): Expression<Object>;
contains(prop: string): Expression<boolean>;
and(b: boolean): Expression<boolean>;
or(b: boolean): Expression<boolean>;
eq(v: any): Expression<boolean>;
ne(v: any): Expression<boolean>;
not(): Expression<boolean>;
gt(value: T): Expression<boolean>;
ge(value: T): Expression<boolean>;
lt(value: T): Expression<boolean>;
le(value: T): Expression<boolean>;
add(n: number): Expression<number>;
sub(n: number): Expression<number>;
mul(n: number): Expression<number>;
div(n: number): Expression<number>;
mod(n: number): Expression<number>;
hasFields(...fields: string[]): Expression<boolean>;
default(value: T): Expression<T>;
}
interface Operation<T> {
run(conn: Connection, cb?: (err: Error, result: T) => void): Promise<T>;
}
interface Aggregator { }
interface Sort { }
interface Time { }
+63 -24
View File
@@ -1,43 +1,82 @@
import * as r from "rethinkdb";
import r = require("rethinkdb")
function errorAndCursorCallback(err: Error, cursor: r.Cursor): void {}
function cursorCallback(cursor: r.Cursor): void {}
r.connect({host:"localhost", port: 28015}, function(err, conn) {
console.log("HI", err, conn)
var testDb = r.db('test')
testDb.tableCreate('users').run(conn, function(err, stuff) {
var users = testDb.table('users')
r.connect({ host: "localhost", port: 28015 }, function(err: Error, conn: r.Connection) {
console.log("HI", err, conn);
users.insert({name: "bob"}).run(conn, function() {})
const testDb = r.db("test");
r.table("players").hasFields("games_won").run(conn, errorAndCursorCallback);
r.table("players").hasFields({ "games_won": { "championships": true } }).run(conn, errorAndCursorCallback);
r.table("players").filter(r.row.hasFields("games_won").not()).run(conn, errorAndCursorCallback);
r.table("players").filter(r.row.hasFields({ "games_won": { "championships": true } }).not()).run(conn, errorAndCursorCallback);
r.table("players").filter(
r.row.hasFields("games_won").not()
.or(r.row("games_won").not().eq(true))
.and(true)
)
.run(conn, errorAndCursorCallback);
testDb.tableCreate("users").run(conn, function(err, stuff) {
const users = testDb.table("users");
users.insert({ name: "bob" }).run(conn, function() {
});
users.hasFields("foo_bar").run(conn, () => {});
users.filter(function(doc?) {
return doc("henry").eq("bob")
return doc("henry").eq("bob");
})
.filter(r.row("updatedAt").default(0).lt(r.now().sub(1000)))
.between("james", "beth")
.limit(4)
.run(conn, function(err, cursor) {
cursor.toArray().then(rows => {
console.log(rows);
cursor.toArray<string>((err, strings) => {
console.log(strings);
});
})
});
});
})
})
r.js("'str1' + 'str2'").run(conn, function (err, value) {});
r.uuid().run(conn, function (err, uuid) {});
r.uuid("input value").run(conn, function (err, uuid) {});
r.table("games").changes().run(conn, function(err, cursor) {
cursor.each(console.log);
});
});
// use promises instead of callbacks
r.connect({host:"localhost", port: 28015}).then(function(conn) {
console.log("HI", conn)
var testDb = r.db('test')
testDb.tableCreate('users').run(conn).then(function(stuff) {
var users = testDb.table('users')
r.connect({ host: "localhost", port: 28015 }).then(function(conn: r.Connection) {
console.log("HI", conn);
users.insert({name: "bob"}).run(conn, function() {})
const testDb = r.db("test");
r.table("players").hasFields("games_won").run(conn).then(cursorCallback);
r.table("players").hasFields({ "games_won": { "championships": true } }).run(conn).then(cursorCallback);
r.table("players").filter(r.row.hasFields("games_won").not()).run(conn).then(cursorCallback);
r.table("players").filter(r.row.hasFields({ "games_won": { "championships": true } }).not()).run(conn).then(cursorCallback);
testDb.tableCreate("users").run(conn).then(function() {
const users = testDb.table("users");
users.insert({ name: "bob" }).run(conn, function() {
});
users.filter(function(doc?) {
return doc("henry").eq("bob")
return doc("henry").eq("bob");
})
.between("james", "beth")
.limit(4)
.run(conn);
})
})
.run(conn)
.then((cursor: r.Cursor) => {
cursor.toArray().then((rows: any[]) => {
console.log(rows);
});
});
});
});
+1 -1
View File
@@ -16,4 +16,4 @@
"index.d.ts",
"rethinkdb-tests.ts"
]
}
}
+2 -2
View File
@@ -261,8 +261,8 @@ declare namespace Rx {
mergeObservable(): Observable<T>; // alias for mergeAll
skipUntil<T2>(other: Observable<T2>): Observable<T>;
skipUntil<T2>(other: IPromise<T2>): Observable<T>;
switch(): Observable<T>;
switchLatest(): Observable<T>; // alias for switch
switch(): T;
switchLatest(): T; // alias for switch
takeUntil<T2>(other: Observable<T2>): Observable<T>;
takeUntil<T2>(other: IPromise<T2>): Observable<T>;
zip<T2>(second: Observable<T2>|IPromise<T2>): Observable<[T, T2]>;
+1 -1
View File
@@ -16,7 +16,7 @@ class SatTest{
console.log("perp: v3 - " + v3.x.toString() + v3.y.toString());
}
}
let test = new SatTest;
+2 -3
View File
@@ -508,7 +508,6 @@ export declare function tempdir(): string;
*/
export declare function error(): string;
export declare function touch(...files: string[]): void;
export declare function touch(files: string[]): void;
@@ -518,8 +517,8 @@ export declare function touch(options: TouchOptionsLiteral, ...files: string[]):
export declare function touch(options: TouchOptionsLiteral, files: string[]): void;
/**
* Update the access and modification times of each FILE to the current time. A FILE argument that does not exist is created empty, unless -c is supplied
*/
* Update the access and modification times of each FILE to the current time. A FILE argument that does not exist is created empty, unless -c is supplied
*/
type touchOptionsArray = {
'-d'?: string;
'-r'?: string;
+256 -180
View File
@@ -1,4 +1,4 @@
// Type definitions for shopify-buy
// Type definitions for shopify-buy 0.4.2
// Project: http://shopify.github.io/js-buy-sdk/api/
// Definitions by: Martin Köhn <https://github.com/openminder>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,39 +7,54 @@
* The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website.
* It is based on Shopify’s API and provides the ability to retrieve products and collections from your shop,
* add products to a cart, and checkout.
* It can render data on the client side or server. This will allow you to add ecommerce functionality to any
* website or javascript application. This is helpful if you already have a website and need to add ecommerce
* or only need a simple buy button on your site.
*/
declare namespace ShopifyBuy {
/**
* Create a ShopClient. This is the main entry point to the SDK.
*/
export function buildClient(configAttrs : Shopify.Config) : Shopify.ShopClient
export function buildClient(configAttrs: Shopify.Config): Shopify.ShopClient
/**
* Internal Image description
*/
interface Image {
id : string|number
src : string
position : number
product_id : string
variant_ids : Array<string>
created_at : string
updated_at : string
id: string | number
created_at: string
position: number
updated_at: string
product_id: string
src: string
variant_ids: Array<string>
}
interface ImageVariant {
name: string,
dimensions: string,
src: string
}
interface OptionValue {
name: string,
option_id: string | number,
value: any
}
/**
* Internal BaseModel class
*/
class BaseModel {
constructor( attrs: any, metaAttrs: any )
constructor(attrs: any, metaAttrs: any)
attrs : any
attrs: any
serializer: any
adapter: any
shopClient: any
}
var NO_IMAGE_URI : string;
var NO_IMAGE_URI: string;
/**
* This namespace contains all globally accessible classes
@@ -49,89 +64,31 @@ declare namespace ShopifyBuy {
/**
* Base Shopify Client config object
*/
interface Config
{
interface Config {
/**
* Your api client's public token.
* An API Key for your store. Documentation how to get an API Key:
* https://help.shopify.com/api/sdks/js-buy-sdk/getting-started#api-key
*/
apiKey: string
/** The app whose listings the client will be using.
* If you are just modifying a buy button, the buy-button's app id is.
* Otherwise, obtain the app id of the app you're modifying or extending.
/**
* Typically will be 6 which is the Buy Button App Id. For more info on App Id see:
* https://help.shopify.com/api/sdks/js-buy-sdk/getting-started#app-id
*/
appId: string
/** You shop's myshopify.com domain. */
myShopifyDomain: string
/**
* Your shop's full myshopify.com domain. For example: embeds.myshopify.com
*/
domain: string
}
/**
* Cart item, that should be added to the card
*/
interface CartModelItem {
variant : Shopify.ProductVariantModel
quantity : number
}
class CartLineItem extends BaseModel {
constructor()
/**
* Line item unique ID
*/
id : string|number
/**
* Images associated with product.
*/
image : Image
/**
* Product title
*/
title: string
/**
* ID of selected variant
*/
variant_id: string|number
/**
* Title of selected variant
*/
variant_title: string
/**
* Number of selected items
*/
quantity : number
/**
* Variant weight in grams
*/
grams: number
/**
* ID of selected product
*/
product_id: string|number
/**
* Price of variant, formatted as currency
*/
price: string
/**
* Compare at price for variant formatted as currency.
*/
compare_at_price: string
/**
* Calculated price for the number of variant in card
*/
line_price: string
variant: Shopify.ProductVariantModel
quantity: number
}
/**
@@ -142,95 +99,53 @@ declare namespace ShopifyBuy {
/**
* Config data to be used throughout all API interaction
*/
constructor( config? : Config )
constructor(config?: Config)
/**
* Creates a CartModel instance, optionally including attrs.
* Creates a CartModel instance.
*/
createCart(attrs? : any) : Promise<CartModel>
createCart(): Promise<CartModel>
/**
* Updates an existing CartModel instance and persists it to localStorage.
* This function will return an Array of collections from your store
*/
updateCart(attrs? : any) : Promise<CartModel>
fetchAllCollections(): Promise<Array<any>>
/**
* This function will return an Array of products from your store
*/
fetchAllProducts(): Promise<Array<ProductModel>>
/**
* Retrieve a previously created cart by its key.
*/
fetchCart(id : string) : Promise<CartModel>
fetchCart(id: string): Promise<CartModel>
/**
* Fetch one collection by its ID.
*/
fetchCollection(id : string|number) : Promise<any> //TODO: Find declaration for Collection
fetchCollection(id: string | number): Promise<any>
/**
* Fetch one product by its ID.
*/
fetchProduct(id: string|number) : Promise<ProductModel>
fetchProduct(id: string | number): Promise<ProductModel>
/**
* Fetches a list of collections matching a specified query.
*/
fetchQueryCollections(query? : any) : Promise<Array<any>>
fetchQueryCollections(query?: any): Promise<Array<any>>
/**
* Fetches a list of products matching a specified query.
*/
fetchQueryProducts(query? : any) : Promise<Array<ProductModel>>
}
/**
* Class for cart model
*/
class CartModel extends BaseModel {
constructor()
fetchQueryProducts(query?: any): Promise<Array<ProductModel>>
/**
* Get checkout URL for current cart
* This method looks up a reference in localStorage to the most recent cart.
* If one is not found, creates one. If the cart the reference points to doesn't exist,
* create one and store the new reference.
*/
checkoutUrl : string
/**
* get ID for current cart
*/
id : string|number
/**
* Get current line items for cart
*/
lineItems : Array<CartLineItem>
/**
* Get current subtotal price for all line items
*/
subtotal: string
/**
* Gets the sum quantity of each line item
*/
lineItemCount : number
/**
* Add items to cart. Updates cart's lineItems
*/
addVariants(item : CartModelItem, nextItem? : Array<CartModelItem>) : Promise<CartModel>
/**
* Remove all line items from cart
*/
clearLineItems() : Promise<CartModel>
/**
* Remove line item from cart
*/
removeLineItem(id : string|number) : Promise<CartModel>
/**
* Update line item quantity
*/
updateLineItem(id : string|number, quantitiy : number ) : Promise<CartModel>
fetchRecentCart(): Promise<CartModel>
}
@@ -241,20 +156,20 @@ declare namespace ShopifyBuy {
constructor()
/**
* A product description.
*/
description: string
/**
* Product unique ID
*/
id : string|number
id: string | number
/**
* All images associated with product.
* An Array of Objects that contain meta data about an image including src of the images.
*/
images : Array<Image>
/**
* Product title
*/
title: string
images: Array<Image>
/**
* All variants of a product.
@@ -262,24 +177,34 @@ declare namespace ShopifyBuy {
variants: Array<ProductVariantModel>
/**
* Get array of options with nested values. Useful for creating UI for selecting options.
* Get an array of ProductOptionModels. ProductOptionModels can be used to define
* the currently selectedVariant from which you can get a checkout url (ProductVariantModel.checkoutUrl)
* or can be added to a cart (CartModel.createLineItemsFromVariants).
*/
options : Array<Option>
options: Array<ProductOptionModel>
/**
* Retrieve variant for currently selected options
* Retrieve variant for currently selected options. By default the first value in each option is selected
* which means selectedVariant will never be null. With a selectedVariant you can
* create checkout url (ProductVariantModel.checkoutUrl) or
* it can be added to a cart (CartModel.createLineItemsFromVariants).
*/
selectedVariant : ProductVariantModel
selectedVariant: ProductVariantModel
/**
* Retrieve image for currently selected variantImage
* Retrieve image for currently selected variantImage.
*/
selectedVariantImage : Image
selectedVariantImage: Image
/**
* Retrieve currently selected option values.
* A read only Array of Strings represented currently selected option values. eg. ["Large", "Red"]
*/
selections : Option
selections: Array<string>
/**
* The product title
*/
title: string
}
/**
@@ -290,49 +215,67 @@ declare namespace ShopifyBuy {
constructor()
/*
* Checkout URL for purchasing variant with quantity.
* Get a checkout url for a specific product variant.
* You can optionally pass a quantity.
* If no quantity is passed then quantity will default to 1.
*/
checkoutUrl( quantitiy : number ) : string
checkoutUrl(quantitiy: number): string
/**
* Compare at price for variant formatted as currency.
* Variant in stock. Always true if inventory tracking is disabled.
*/
compareAtPrice : string
available: boolean
/**
* Variant weight in grams
* Compare at price for variant. The compareAtPrice would be the price of the
* product previously before the product went on sale.
*/
grams : number
compareAtPrice: string
/**
* Price of variant, formatted according to shop currency format string. For instance "$10.00"
*/
formattedPrice: string
/**
* Variant weight in grams. If no weight is defined grams will be 0.
*/
grams: number
/**
* Variant unique ID
*/
id : string|number
id: string | number
/**
* Image for variant
*/
image : Image
image: Image
/**
* Image variants available for a variant.
*/
imageVariant: Array<ImageVariant>
/**
* Option values associated with this variant, ex {name: "color", value: "Blue"}
*/
optionValues : Array<Option>
optionValues: Array<OptionValue>
/**
* Price of variant, formatted as currency
* Price of the variant. The price will be in the following form: "10.00"
*/
price : string
price: string
/**
* ID of product variant belongs to
*/
productId : string|number
productId: string | number
/**
* Title of product variant belongs to
*/
productTitle : string
productTitle: string
/**
* Title of variant
@@ -343,7 +286,7 @@ declare namespace ShopifyBuy {
/**
* Class for product option
*/
class Option extends BaseModel {
class ProductOptionModel extends BaseModel {
constructor()
@@ -353,16 +296,149 @@ declare namespace ShopifyBuy {
name: string
/**
* get/set selected option value (ex. "Large").
* Setting this will update the selected value on the model.
* Throws {Error} if setting selected to value that does not exist for option
* get/set the currently selected option value with one of the values from the ProductOptionModel/values array.
* For instance if the option values array had the following ["Large", "Medium", "Small"] setting selected to be
* "Large", "Medium", or "Small" would be valid any other value would throw an Error.
*/
selected : string
selected: string
/**
* possible values for selection
* an Array possible values for option. For instance if this option
* is a "Size" option an example value for values could be: ["Large", "Medium", "Small"]
*/
values : Array<any>
values: Array<any>
}
/**
* Class for cart model
*/
class CartModel extends BaseModel {
constructor()
/**
* Remove all line items from cart
*/
clearLineItems(): Promise<CartModel>
/**
* Add items to cart. Updates cart's lineItems
*/
addVariants(item: CartModelItem, nextItem?: Array<CartModelItem>): Promise<CartModel>
/**
* Add items to the cart. Updates cart's lineItems based on variants passed in.
*/
createLineItemsFromVariants(...items: CartModelItem[] ): Promise<CartModel>
/**
* Remove a line item from cart based on line item id
*/
removeLineItem(id: string | number): Promise<CartModel>
/**
* Update a line item quantity based on line item id
*/
updateLineItem(id: string | number, quantitiy: number): Promise<CartModel>
/**
* Force update of cart model on server. This function will only be used in advanced
* situations and does not need to be called explicitly to update line items.
* It is automatically called after createLineItemsFromVariants, updateLineItem,
* removeLineItem, and removeLineItem
*/
updateModel(): Promise<CartModel>
/**
* Get checkout URL for current cart
*/
checkoutUrl: string
/**
* get ID for current cart
*/
id: string | number
/**
* Gets the total quantity of all line items. Example: you've added two variants
* with quantities 3 and 2. lineItemCount will be 5.
*/
lineItemCount: number
/**
* Get an Array of CartLineItemModel's
*/
lineItems: Array<CartLineItemModel>
/**
* Get current subtotal price for all line items.
* Example: two items have been added to the cart that cost $1.25 then the subtotal will be 2.50
*/
subtotal: string
}
class CartLineItemModel extends BaseModel {
constructor()
/**
* Compare at price for variant. The compareAtPrice would be the price of the product
* previously before the product went on sale.
* If no compareAtPrice is set then this value will be null. An example value: "5.00".
*/
compare_at_price: string
/**
* Variant's weight in grams. If no weight is set then 0 is returned.
*/
grams: number
/**
* A line item ID.
*/
id: string | number
/**
* Variant's image.
*/
image: Image
/**
* The total price for this line item. For instance if the variant costs 1.50 and you have a
* quantity of 2 then line_price will be 3.00.
*/
line_price: string
/**
* Price of the variant. For example: "5.00".
*/
price: string
/**
* ID of variant's product.
*/
product_id: string | number
/**
* Count of variants to order.
*/
quantity: number
/**
* Product title of variant's parent product.
*/
title: string
/**
* ID of line item variant.
*/
variant_id: string | number
/**
* Title of variant.
*/
variant_title: string
}
@@ -370,6 +446,6 @@ declare namespace ShopifyBuy {
}
declare module "ShopifyBuy" {
declare module "shopify-buy" {
export = ShopifyBuy
}
+12 -12
View File
@@ -4,7 +4,7 @@
============================================================ */
let client = ShopifyBuy.buildClient({
apiKey: 'bf081e860bc9dc1ce0654fdfbc20892d',
myShopifyDomain: 'embeds',
domain: 'embeds',
appId: '6'
});
@@ -33,7 +33,7 @@ client.fetchProduct('3614436099').then(function (fetchedProduct : ShopifyBuy.Sho
product = fetchedProduct;
var selectedVariant : ShopifyBuy.Shopify.ProductVariantModel = product.selectedVariant;
var selectedVariantImage : any = product.selectedVariantImage;
var currentOptions : ShopifyBuy.Shopify.Option[] = product.options;
var currentOptions : ShopifyBuy.Shopify.ProductOptionModel[] = product.options;
var variantSelectors = generateSelectors(product);
$('.variant-selectors').html(""+variantSelectors);
@@ -50,7 +50,7 @@ client.fetchProduct('3614436099').then(function (fetchedProduct : ShopifyBuy.Sho
/* Generate DOM elements for variant selectors
============================================================ */
function generateSelectors(product : ShopifyBuy.Shopify.ProductModel) {
var elements = product.options.map(function(option : ShopifyBuy.Shopify.Option) {
var elements = product.options.map(function(option : ShopifyBuy.Shopify.ProductOptionModel) {
var optionsHtml = option.values.map(function(value : any) {
return '<option value="' + value + '">' + value + '</option>';
});
@@ -126,7 +126,7 @@ function attachOnVariantSelectListeners(product : ShopifyBuy.Shopify.ProductMode
var $element : any = $(event.target);
var name : string = $element.attr('name');
var value : string = $element.val();
product.options.filter(function(option : ShopifyBuy.Shopify.Option) {
product.options.filter(function(option : ShopifyBuy.Shopify.ProductOptionModel) {
return option.name === name;
})[0].selected = value;
@@ -171,7 +171,7 @@ function buyButtonClickHandler(evt : any) {
evt.preventDefault();
var id : string | number = product.selectedVariant.id;
var quantity : number;
var cartLineItem : ShopifyBuy.Shopify.CartLineItem = findCartItemByVariantId(id);
var cartLineItem : ShopifyBuy.Shopify.CartLineItemModel = findCartItemByVariantId(id);
quantity = cartLineItem ? cartLineItem.quantity + 1 : 1;
@@ -187,7 +187,7 @@ function updateQuantity(fn : Function, variantId : string | number) {
return (variant.id === variantId);
})[0];
var quantity : number;
var cartLineItem : ShopifyBuy.Shopify.CartLineItem = findCartItemByVariantId(variant.id);
var cartLineItem : ShopifyBuy.Shopify.CartLineItemModel = findCartItemByVariantId(variant.id);
if (cartLineItem) {
quantity = fn(cartLineItem.quantity);
updateVariantInCart(cartLineItem, quantity);
@@ -217,7 +217,7 @@ function fieldQuantityHandler(evt : any) {
var variant : ShopifyBuy.Shopify.ProductVariantModel = product.variants.filter(function (variant : ShopifyBuy.Shopify.ProductVariantModel) {
return (variant.id === variantId);
})[0];
var cartLineItem : ShopifyBuy.Shopify.CartLineItem = findCartItemByVariantId(variant.id);
var cartLineItem : ShopifyBuy.Shopify.CartLineItemModel = findCartItemByVariantId(variant.id);
var quantity : number = evt.target.value;
if (cartLineItem) {
updateVariantInCart(cartLineItem, quantity);
@@ -266,7 +266,7 @@ function findCartItemByVariantId(variantId : string | number) {
============================================================ */
function addOrUpdateVariant(variant : ShopifyBuy.Shopify.ProductVariantModel, quantity : number) {
openCart();
var cartLineItem : ShopifyBuy.Shopify.CartLineItem = findCartItemByVariantId(variant.id);
var cartLineItem : ShopifyBuy.Shopify.CartLineItemModel = findCartItemByVariantId(variant.id);
if (cartLineItem) {
updateVariantInCart(cartLineItem, quantity);
@@ -279,7 +279,7 @@ function addOrUpdateVariant(variant : ShopifyBuy.Shopify.ProductVariantModel, qu
/* Update details for item already in cart. Remove if necessary
============================================================ */
function updateVariantInCart(cartLineItem : ShopifyBuy.Shopify.CartLineItem, quantity : number) {
function updateVariantInCart(cartLineItem : ShopifyBuy.Shopify.CartLineItemModel, quantity : number) {
var variantId : string | number = cartLineItem.variant_id;
var cartLength : number = cart.lineItems.length;
cart.updateLineItem(cartLineItem.id, quantity).then(function(updatedCart : ShopifyBuy.Shopify.CartModel) {
@@ -310,7 +310,7 @@ function addVariantToCart(variant : ShopifyBuy.Shopify.ProductVariantModel, quan
openCart();
cart.addVariants({ variant: variant, quantity: quantity }).then(function() {
var cartItem : ShopifyBuy.Shopify.CartLineItem = cart.lineItems.filter(function (item : ShopifyBuy.Shopify.CartLineItem ) {
var cartItem : ShopifyBuy.Shopify.CartLineItemModel = cart.lineItems.filter(function (item : ShopifyBuy.Shopify.CartLineItemModel ) {
return (item.variant_id === variant.id);
})[0];
var $cartItem = renderCartItem(cartItem);
@@ -331,7 +331,7 @@ function addVariantToCart(variant : ShopifyBuy.Shopify.ProductVariantModel, quan
/* Return required markup for single item rendering
============================================================ */
function renderCartItem(lineItem : ShopifyBuy.Shopify.CartLineItem) {
function renderCartItem(lineItem : ShopifyBuy.Shopify.CartLineItemModel) {
var lineItemEmptyTemplate = $('#CartItemTemplate').html();
var $lineItemTemplate = $(lineItemEmptyTemplate);
var itemImage = lineItem.image.src;
@@ -400,6 +400,6 @@ function updateCartTabButton() {
/* Set previously focused item for escape handler
============================================================ */
function setPreviousFocusItem(item : ShopifyBuy.Shopify.CartLineItem) {
function setPreviousFocusItem(item : ShopifyBuy.Shopify.CartLineItemModel) {
previousFocusItem = item;
}
+2 -1
View File
@@ -45,9 +45,10 @@ interface JQuerySlickOptions {
/**
* Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object)
* `false` will prevent arrows from being created/appended
* Default: $(element)
*/
appendArrows?: Element | Element[] | JQuery | string;
appendArrows?: Element | Element[] | JQuery | string | boolean;
/**
* Change where the navigation dots are attached (Selector, htmlString, Array, Element, jQuery object)
+3 -1
View File
@@ -177,7 +177,9 @@ $('.single-item-rtl').slick({
rtl: true
});
$('.no-arrows-slide').slick({
appendArrows: false
})
// --------------------------------------------------------
// ---------------- TEST DEFAULT OPTIONS ------------------
+1 -1
View File
@@ -21,7 +21,7 @@ declare namespace supertest {
url: string;
serverAddress(app: any, path: string): string;
expect(status: number, callback?: CallbackHandler): this;
expect(status: number, body: string, callback?: CallbackHandler): this;
expect(status: number, body: any, callback?: CallbackHandler): this;
expect(body: string, callback?: CallbackHandler): this;
expect(body: RegExp, callback?: CallbackHandler): this;
expect(body: Object, callback?: CallbackHandler): this;
+13 -5
View File
@@ -2,7 +2,7 @@
import * as supertest from 'supertest';
import * as express from 'express';
var app = express();
const app = express();
supertest(app)
.get('/user')
@@ -14,15 +14,15 @@ supertest(app)
});
// cookie scenario
var request = supertest(app);
var agent = supertest.agent();
const request = supertest(app);
const agent = supertest.agent();
request
.post('/login')
.end((err: any, res: supertest.Response) => {
if (err) throw err;
agent.saveCookies(res);
var req = request.get('/admin');
const req = request.get('/admin');
agent.attachCookies(req);
req.expect(200, (err: any, res: supertest.Response) => {
if (err) throw err;
@@ -30,7 +30,7 @@ request
});
// cookie scenario, new version
var client = supertest.agent(app);
const client = supertest.agent(app);
client
.post('/login')
.end((err: any, res: supertest.Response) => {
@@ -54,3 +54,11 @@ function hasPreviousAndNextKeys(res: supertest.Response) {
if (!('next' in res.body)) return "missing next key";
if (!('prev' in res.body)) throw new Error("missing prev key");
}
// object expect
supertest(app)
.get('/')
.expect(200, { foo: 'bar' })
.end((err: any, res: supertest.Response) => {
if (err) throw err;
});
+125 -63
View File
@@ -1,97 +1,158 @@
// Type definitions for svg-pan-zoom v2.3.9
// Type definitions for svg-pan-zoom v3.3.0
// Project: https://github.com/ariutta/svg-pan-zoom
// Definitions by: Chintan Shah <https://github.com/Promact>
// Definitions by: César Vidril <https://github.com/Yimiprod>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace SvgPanZoom {
interface OptionConfig {
interface Options {
viewportSelector?: string|HTMLElement|SVGElement; // can be querySelector string or SVGElement (default enabled)
panEnabled?: boolean; // enable or disable panning (default enabled)
controlIconsEnabled?: boolean; // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled)
zoomEnabled?: boolean; // enable or disable zooming (default enabled)
dblClickZoomEnabled?: boolean; // enable or disable zooming by double clicking (default enabled)
zoomScaleSensitivity?: number; // Zoom sensitivity
minZoom?: number; // Minimum Zoom level
maxZoom?: number; // Maximum Zoom level
mouseWheelZoomEnabled?: boolean; // (default enabled)
preventMouseEventsDefault?: boolean; // (default enabled)
zoomScaleSensitivity?: number; // Zoom sensitivity (Default 0.2)
minZoom?: number; // Minimum Zoom level (Default 0.5)
maxZoom?: number; // Maximum Zoom level (Default 10)
fit?: boolean; // enable or disable viewport fit in SVG (default true)
contain?: boolean; // (default true)
center?: boolean; // enable or disable viewport centering in SVG (default true)
beforeZoom?: (scale:number) => void;
onZoom?: (scale:number) => void;
beforePan?: (point:IPoint) => void;
onPan?: (x:number, y:number) => void;
refreshRate?: any; // in hz
refreshRate?: number | 'auto'; // (default 'auto')
beforeZoom?: (oldScale:number, newScale:number) => boolean;
onZoom?: (newScale:number) => void;
beforePan?: (oldPan:Point, newPan:Point) => boolean | PointModifier;
onPan?: (newPan:Point) => void;
customEventsHandler?: CustomEventHandler; // (default null)
eventsListenerElement?: SVGElement; // (default null)
}
interface IPoint {
interface CustomEventHandler {
haltEventListeners: string[],
init: (options: CustomEventOptions) => void,
destroy: Function
}
interface CustomEventOptions {
svgElement: SVGSVGElement,
instance: Instance
}
interface Point {
x: number;
y: number;
}
interface ISvgPanZoom {
interface PointModifier {
x: number|boolean;
y: number|boolean;
}
interface Instance {
/**
* Creates a new SvgPanZoom instance with given element selector.
*
* @param svg selector of the tag on which it is to be applied.
* @param options provides customization options at the initialization of the object.
* @param {string|HTMLElement|SVGElement} svg selector of the tag on which it is to be applied.
* @param {Object} options provides customization options at the initialization of the object.
* @return {Instance} Current instance
*/
(svg:any, options?:OptionConfig): ISvgPanZoom;
(svg:string|HTMLElement|SVGElement, options?:Options): Instance;
/**
* Enables Panning on svg element
* @return {Instance} Current instance
*/
enablePan(): void;
enablePan(): Instance;
/**
* Disables panning on svg element
* @return {Instance} Current instance
*/
disablePan(): void;
disablePan(): Instance;
/**
* Checks if Panning is enabled or not
* @return true or false based on panning settings
* @return {Boolean} true or false based on panning settings
*/
isPanEnabled(): boolean;
setBeforePan(fn: (point:Point)=> void): Instance;
setBeforePan(fn: (point:IPoint)=> void): void;
setOnPan(fn: (x:number, y:number)=> void): Instance;
setOnPan(fn: (x:number, y:number)=> void): void;
/**
* Pan to a rendered position
*
* @param {Object} point {x: 0, y: 0}
* @return {Instance} Current instance
*/
pan(point: Point): Instance;
enableZoom(): void;
/**
* Relatively pan the graph by a specified rendered position vector
*
* @param {Object} point {x: 0, y: 0}
* @return {Instance} Current instance
*/
panBy(point: Point): Instance;
disableZoom(): void;
/**
* Get pan vector
*
* @return {Object} {x: 0, y: 0}
* @return {Instance} Current instance
*/
getPan(): Point;
resetPan(): Instance;
enableZoom(): Instance;
disableZoom(): Instance;
isZoomEnabled(): boolean;
enableControlIcons(): void;
enableControlIcons(): Instance;
disableControlIcons(): void;
disableControlIcons(): Instance;
isControlIconsEnabled(): boolean;
enableDblClickZoom(): void;
enableDblClickZoom(): Instance;
disableDblClickZoom(): void;
disableDblClickZoom(): Instance;
setZoomScaleSensitivity(scale: number): void;
isDblClickZoomEnabled(): boolean;
setMinZoom(zoom: number): void;
enableMouseWheelZoom(): Instance;
setMaxZoom(zoom: number): void;
disableMouseWheelZoom(): Instance;
setBeforeZoom(fn: (scale: number) => void): void;
isMouseWheelZoomEnabled(): boolean;
setOnZoom(fn: (scale: number) => void): void;
setZoomScaleSensitivity(scale: number): Instance;
setMinZoom(zoom: number): Instance;
setMaxZoom(zoom: number): Instance;
setBeforeZoom(fn: (scale: number) => void): Instance;
setOnZoom(fn: (scale: number) => void): Instance;
zoom(scale: number):void;
zoomIn(): void;
zoomIn(): Instance;
zoomOut(): void;
zoomOut(): Instance;
zoomBy(scale: number): void;
zoomBy(scale: number): Instance;
resetZoom(): void;
zoomAtPoint(scale:number, point:Point): Instance;
zoomAtPointBy(scale:number, point:Point): Instance;
resetZoom(): Instance;
/**
* Get zoom scale/level
@@ -104,48 +165,49 @@ declare namespace SvgPanZoom {
* Adjust viewport size (only) so it will fit in SVG
* Does not center image
*
* @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false
* @return {Instance} Current instance
*/
fit(dropCache?: boolean): void;
fit(): Instance;
/**
* Adjust viewport size (only) so it will contain in SVG
* Does not center image
*
* @return {Instance} Current instance
*/
contain(): Instance;
/**
* Adjust viewport pan (only) so it will be centered in SVG
* Does not zoom/fit image
*
* @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false
* @return {Instance} Current instance
*/
center(dropCache?: boolean): void;
center(): Instance;
/**
* Recalculates cached svg dimensions and controls position
*
* @return {Instance} Current instance
*/
resize(): void;
resize(): Instance;
reset(): Instance;
/**
* Pan to a rendered position
* Update content cached BorderBox
* Use when viewport contents change
*
* @param {object} point {x: 0, y: 0}
* @return {Instance} Current instance
*/
pan(point: IPoint): void;
updateBBox(): Instance;
/**
* Relatively pan the graph by a specified rendered position vector
*
* @param {object} point {x: 0, y: 0}
*/
panBy(point: IPoint): void;
/**
* Get pan vector
*
* @return {object} {x: 0, y: 0}
*/
getPan(): IPoint;
zoomAtPoint(scale:number, point:IPoint): boolean;
zoomAtPointBy(scale:number, point:IPoint): boolean;
destroy(): void;
}
}
declare var svgPanZoom:SvgPanZoom.ISvgPanZoom;
declare const svgPanZoom:SvgPanZoom.Instance;
declare module 'svg-pan-zoom' {
export = svgPanZoom;
}
+151
View File
@@ -0,0 +1,151 @@
// Type definitions for svg-pan-zoom v2.3.9
// Project: https://github.com/ariutta/svg-pan-zoom
// Definitions by: Chintan Shah <https://github.com/Promact>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace SvgPanZoom {
interface OptionConfig {
panEnabled?: boolean; // enable or disable panning (default enabled)
controlIconsEnabled?: boolean; // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled)
zoomEnabled?: boolean; // enable or disable zooming (default enabled)
dblClickZoomEnabled?: boolean; // enable or disable zooming by double clicking (default enabled)
zoomScaleSensitivity?: number; // Zoom sensitivity
minZoom?: number; // Minimum Zoom level
maxZoom?: number; // Maximum Zoom level
fit?: boolean; // enable or disable viewport fit in SVG (default true)
center?: boolean; // enable or disable viewport centering in SVG (default true)
beforeZoom?: (scale:number) => void;
onZoom?: (scale:number) => void;
beforePan?: (point:IPoint) => void;
onPan?: (x:number, y:number) => void;
refreshRate?: any; // in hz
}
interface IPoint {
x: number;
y: number;
}
interface ISvgPanZoom {
/**
* Creates a new SvgPanZoom instance with given element selector.
*
* @param svg selector of the tag on which it is to be applied.
* @param options provides customization options at the initialization of the object.
*/
(svg:any, options?:OptionConfig): ISvgPanZoom;
/**
* Enables Panning on svg element
*/
enablePan(): void;
/**
* Disables panning on svg element
*/
disablePan(): void;
/**
* Checks if Panning is enabled or not
* @return true or false based on panning settings
*/
isPanEnabled(): boolean;
setBeforePan(fn: (point:IPoint)=> void): void;
setOnPan(fn: (x:number, y:number)=> void): void;
enableZoom(): void;
disableZoom(): void;
isZoomEnabled(): boolean;
enableControlIcons(): void;
disableControlIcons(): void;
isControlIconsEnabled(): boolean;
enableDblClickZoom(): void;
disableDblClickZoom(): void;
setZoomScaleSensitivity(scale: number): void;
setMinZoom(zoom: number): void;
setMaxZoom(zoom: number): void;
setBeforeZoom(fn: (scale: number) => void): void;
setOnZoom(fn: (scale: number) => void): void;
zoom(scale: number):void;
zoomIn(): void;
zoomOut(): void;
zoomBy(scale: number): void;
resetZoom(): void;
/**
* Get zoom scale/level
*
* @return {float} zoom scale
*/
getZoom(): number;
/**
* Adjust viewport size (only) so it will fit in SVG
* Does not center image
*
* @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false
*/
fit(dropCache?: boolean): void;
/**
* Adjust viewport pan (only) so it will be centered in SVG
* Does not zoom/fit image
*
* @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false
*/
center(dropCache?: boolean): void;
/**
* Recalculates cached svg dimensions and controls position
*/
resize(): void;
/**
* Pan to a rendered position
*
* @param {object} point {x: 0, y: 0}
*/
pan(point: IPoint): void;
/**
* Relatively pan the graph by a specified rendered position vector
*
* @param {object} point {x: 0, y: 0}
*/
panBy(point: IPoint): void;
/**
* Get pan vector
*
* @return {object} {x: 0, y: 0}
*/
getPan(): IPoint;
zoomAtPoint(scale:number, point:IPoint): boolean;
zoomAtPointBy(scale:number, point:IPoint): boolean;
}
}
declare var svgPanZoom:SvgPanZoom.ISvgPanZoom;
+53 -13
View File
@@ -1,6 +1,6 @@
var svgPanZoomOptions : SvgPanZoom.OptionConfig = {
var svgPanZoomOptions : SvgPanZoom.Options = {
panEnabled: true // enable or disable panning (default enabled)
, controlIconsEnabled: false // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled)
, zoomEnabled: true // enable or disable zooming (default enabled)
@@ -17,9 +17,9 @@ var svgPanZoomOptions : SvgPanZoom.OptionConfig = {
, refreshRate: 60 // in hz
};
var panZoomTiger: SvgPanZoom.ISvgPanZoom = svgPanZoom('#demo-tiger');
var panZoomTiger: SvgPanZoom.Instance = svgPanZoom('#demo-tiger');
var svgElement = document.querySelector('#demo-tiger');
var svgElement = <SVGElement>document.querySelector('#demo-tiger');
panZoomTiger = svgPanZoom(svgElement);
panZoomTiger = svgPanZoom('#demo-tiger', {
@@ -27,24 +27,43 @@ panZoomTiger = svgPanZoom('#demo-tiger', {
, controlIconsEnabled: false
, zoomEnabled: true
, dblClickZoomEnabled: true
, mouseWheelZoomEnabled: true
, preventMouseEventsDefault: true
, zoomScaleSensitivity: 0.2
, minZoom: 0.5
, maxZoom: 10
, fit: true
, contain: false
, center: true
, refreshRate: 'auto'
, beforeZoom: function(){}
, onZoom: function(){}
, beforePan: function(){}
, onPan: function(){}
, beforeZoom: function(oldScale, newScale){ return true; }
, onZoom: function(newScale){}
, beforePan: function(oldPan, newPan){ return {x: true, y: true}; }
, customEventsHandler: null
, eventsListenerElement: null
});
/**
* PAN
*/
// Pan to rendered point x = 50, y = 50
panZoomTiger.pan({x: 50, y: 50});
// Pan by x = 50, y = 50 of rendered pixels
panZoomTiger.panBy({x: 50, y: 50});
panZoomTiger.getPan();
panZoomTiger.resetPan();
panZoomTiger.enablePan();
panZoomTiger.disablePan();
panZoomTiger.isPanEnabled();
/**
* ZOOM
*/
// Set zoom level to 2
panZoomTiger.zoom(2);
@@ -59,19 +78,40 @@ panZoomTiger.zoomAtPointBy(1.3, {x: 50, y: 50});
panZoomTiger.zoomIn();
panZoomTiger.zoomOut();
panZoomTiger.resetZoom();
panZoomTiger.enablePan();
panZoomTiger.disablePan();
panZoomTiger.getZoom();
panZoomTiger.resetZoom();
panZoomTiger.enableZoom();
panZoomTiger.disableZoom();
panZoomTiger.fit();
panZoomTiger.isZoomEnabled();
/**
* controls
*/
panZoomTiger.enableControlIcons();
panZoomTiger.disableControlIcons();
panZoomTiger.isControlIconsEnabled();
panZoomTiger.enableDblClickZoom();
panZoomTiger.disableDblClickZoom();
panZoomTiger.isDblClickZoomEnabled();
panZoomTiger.enableMouseWheelZoom();
panZoomTiger.disableMouseWheelZoom();
panZoomTiger.isMouseWheelZoomEnabled();
panZoomTiger.center();
panZoomTiger.fit();
panZoomTiger.contain();
panZoomTiger.resize(); // update SVG cached size and controls positions
panZoomTiger.fit(true); // dropCache and fit
panZoomTiger.center(true); // dropCache and center
panZoomTiger.updateBBox();
panZoomTiger.fit().center(); // can chain method
panZoomTiger.destroy(); // destroy instance
delete panZoomTiger;

Some files were not shown because too many files have changed in this diff Show More