mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge remote-tracking branch 'DefinitelyTyped/master'
This commit is contained in:
commit
f4af4e83a4
@ -695,7 +695,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](heap/heap.d.ts) [heap](https://github.com/qiao/heap.js) by [Ryan McNamara](https://github.com/ryan10132)
|
||||
* [:link:](heatmap.js/heatmap.d.ts) [heatmap.js](https://github.com/pa7/heatmap.js) by [Yang Guan](https://github.com/lookuptable)
|
||||
* [:link:](hellojs/hellojs.d.ts) [hello.js](http://adodson.com/hello.js) by [Pavel Zika](https://github.com/PavelPZ)
|
||||
* [:link:](helmet/helmet.d.ts) [helmet](https://github.com/helmetjs/helmet) by [Cyril Schumacher](https://github.com/cyrilschumacher)
|
||||
* [:link:](helmet/helmet.d.ts) [helmet](https://github.com/helmetjs/helmet) by [Cyril Schumacher](https://github.com/cyrilschumacher), [Evan Hahn](https://github.com/EvanHahn)
|
||||
* [:link:](highcharts/highcharts.d.ts) [Highcharts](http://www.highcharts.com) by [Damiano Gambarotto](http://github.com/damianog), [Dan Lewi Harkestad](http://github.com/baltie)
|
||||
* [:link:](highcharts-ng/highcharts-ng.d.ts) [highcharts-ng](https://github.com/pablojim/highcharts-ng) by [Scott Hatcher](https://github.com/scatcher)
|
||||
* [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
|
||||
9
CybozuLabs-md5/CybozuLabs-md5-tests.ts
Normal file
9
CybozuLabs-md5/CybozuLabs-md5-tests.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path="CybozuLabs-md5.d.ts" />
|
||||
|
||||
var hash: string;
|
||||
hash = CybozuLabs.MD5.calc("abc");
|
||||
hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_ASCII);
|
||||
hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_UTF16);
|
||||
|
||||
var version: string;
|
||||
version = CybozuLabs.MD5.VERSION;
|
||||
11
CybozuLabs-md5/CybozuLabs-md5.d.ts
vendored
Normal file
11
CybozuLabs-md5/CybozuLabs-md5.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Type definitions for CybozuLabs.MD5
|
||||
// Project: http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html
|
||||
// Definitions by: MIZUNE Pine <https://github.com/pine613>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace CybozuLabs.MD5 {
|
||||
var VERSION: string;
|
||||
var BY_ASCII: number;
|
||||
var BY_UTF16: number;
|
||||
function calc(str: string, option?: number): string;
|
||||
}
|
||||
@ -32,7 +32,7 @@ Please see the [contribution guide](http://definitelytyped.org/guides/contributi
|
||||
|
||||
## Requested definitions
|
||||
|
||||
Here is are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@ -12,4 +12,12 @@ var config : adal.Config = {
|
||||
|
||||
var auth = new AuthenticationContext(config);
|
||||
|
||||
Logging.log = (message: string) => {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
Logging.level = 4;
|
||||
|
||||
auth.info("Logging message");
|
||||
|
||||
var userName: string = auth.getCachedUser().userName;
|
||||
15
adal-angular/adal.d.ts
vendored
15
adal-angular/adal.d.ts
vendored
@ -4,9 +4,10 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var AuthenticationContext: adal.AuthenticationContextStatic;
|
||||
declare var Logging: adal.Logging;
|
||||
|
||||
declare module 'adal' {
|
||||
export = AuthenticationContext;
|
||||
export = { AuthenticationContext, Logging };
|
||||
}
|
||||
|
||||
declare namespace adal {
|
||||
@ -36,6 +37,18 @@ declare namespace adal {
|
||||
stateResponse: string,
|
||||
requestType: string
|
||||
}
|
||||
|
||||
interface Logging {
|
||||
log: (message: string) => void;
|
||||
level: LoggingLevel;
|
||||
}
|
||||
|
||||
enum LoggingLevel {
|
||||
ERROR = 0,
|
||||
WARNING = 1,
|
||||
INFO = 2,
|
||||
VERBOSE = 3
|
||||
}
|
||||
|
||||
interface AuthenticationContextStatic {
|
||||
new (config: Config): AuthenticationContext;
|
||||
|
||||
@ -56,6 +56,15 @@ declare namespace angular.local.storage {
|
||||
* @param val
|
||||
*/
|
||||
set(key:string, val:string):boolean;
|
||||
/**
|
||||
* Directly adds a value to cookies with an expiration.
|
||||
* Note: Typically used as a fallback if local storage is not supported.
|
||||
* Returns: Boolean
|
||||
* @param key
|
||||
* @param val
|
||||
* @param daysToExpiry
|
||||
*/
|
||||
set(key:string, val:string, daysToExpiry:number):boolean;
|
||||
/**
|
||||
* Directly get a value from a cookie.
|
||||
* Returns: value from local storage
|
||||
|
||||
@ -55,6 +55,18 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
|
||||
$scope['confirmDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.confirm().htmlContent('<span>Confirm!</span>'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().textContent('Prompt!'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().htmlContent('<span>Prompt!</span>'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().cancel('Prompt "Cancel" button text'));
|
||||
};
|
||||
$scope['promptDialog'] = () => {
|
||||
$mdDialog.show($mdDialog.prompt().placeholder('Prompt input placeholder text'));
|
||||
};
|
||||
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
|
||||
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
|
||||
});
|
||||
|
||||
12
angular-material/angular-material.d.ts
vendored
12
angular-material/angular-material.d.ts
vendored
@ -4,6 +4,12 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module 'angular-material' {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare namespace angular.material {
|
||||
|
||||
interface IBottomSheetOptions {
|
||||
@ -59,6 +65,11 @@ declare namespace angular.material {
|
||||
interface IConfirmDialog extends IPresetDialog<IConfirmDialog> {
|
||||
cancel(cancel: string): IConfirmDialog;
|
||||
}
|
||||
|
||||
interface IPromptDialog extends IPresetDialog<IPromptDialog> {
|
||||
cancel(cancel: string): IPromptDialog;
|
||||
placeholder(placeholder: string): IPromptDialog;
|
||||
}
|
||||
|
||||
interface IDialogOptions {
|
||||
templateUrl?: string;
|
||||
@ -91,6 +102,7 @@ declare namespace angular.material {
|
||||
show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise<any>;
|
||||
confirm(): IConfirmDialog;
|
||||
alert(): IAlertDialog;
|
||||
prompt(): IPromptDialog;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
2
angular-translate/angular-translate.d.ts
vendored
2
angular-translate/angular-translate.d.ts
vendored
@ -72,7 +72,7 @@ declare namespace angular.translate {
|
||||
}
|
||||
|
||||
interface ITranslateProvider extends angular.IServiceProvider {
|
||||
translations(): ITranslationTable;
|
||||
translations(key?: string): ITranslationTable;
|
||||
translations(key: string, translationTable: ITranslationTable): ITranslateProvider;
|
||||
cloakClassName(): string;
|
||||
cloakClassName(name: string): ITranslateProvider;
|
||||
|
||||
@ -387,6 +387,12 @@ declare namespace angular.ui.bootstrap {
|
||||
* @default 'model-open'
|
||||
*/
|
||||
openedClass?: string;
|
||||
|
||||
/**
|
||||
* CSS class(es) to be added to the top modal window.
|
||||
*/
|
||||
|
||||
windowTopClass?: string;
|
||||
}
|
||||
|
||||
interface IModalStackService {
|
||||
|
||||
6
angular-ui-router/angular-ui-router.d.ts
vendored
6
angular-ui-router/angular-ui-router.d.ts
vendored
@ -35,7 +35,7 @@ declare namespace angular.ui {
|
||||
/**
|
||||
* String HTML content, or function that returns an HTML string
|
||||
*/
|
||||
template?: string | {(): string};
|
||||
template?: string | {(params: IStateParamsService): string};
|
||||
/**
|
||||
* String URL path to template file OR Function, returns URL path string
|
||||
*/
|
||||
@ -229,9 +229,9 @@ declare namespace angular.ui {
|
||||
*/
|
||||
notify?: boolean;
|
||||
/**
|
||||
* {boolean=false}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.
|
||||
* {boolean=false|string|IState}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params.
|
||||
*/
|
||||
reload?: boolean;
|
||||
reload?: boolean | string | IState;
|
||||
}
|
||||
|
||||
interface IHrefOptions {
|
||||
|
||||
16
angularjs/angular-animate.d.ts
vendored
16
angularjs/angular-animate.d.ts
vendored
@ -19,14 +19,14 @@ declare namespace angular.animate {
|
||||
}
|
||||
|
||||
interface IAnimateCallbackObject {
|
||||
eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
eventFn?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
setClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
addClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
removeClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
enter?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
leave?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
move?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
animate?: (element: JQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
|
||||
}
|
||||
|
||||
interface IAnimationPromise extends IPromise<void> {}
|
||||
|
||||
51
angularjs/angular-component-router.d.ts
vendored
51
angularjs/angular-component-router.d.ts
vendored
@ -428,4 +428,55 @@ declare namespace angular {
|
||||
interface OnReuse {
|
||||
$routerOnReuse(next?: angular.ComponentInstruction, prev?: angular.ComponentInstruction): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
}
|
||||
|
||||
/**
|
||||
* `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
|
||||
*
|
||||
* Supported keys:
|
||||
* - `path` or `aux` (requires exactly one of these)
|
||||
* - `component`, `loader`, `redirectTo` (requires exactly one of these)
|
||||
* - `name` or `as` (optional) (requires exactly one of these)
|
||||
* - `data` (optional)
|
||||
*
|
||||
* See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
|
||||
*/
|
||||
interface RouteDefinition {
|
||||
path?: string;
|
||||
aux?: string;
|
||||
component?: Type | ComponentDefinition | string;
|
||||
loader?: Function;
|
||||
redirectTo?: any[];
|
||||
as?: string;
|
||||
name?: string;
|
||||
data?: any;
|
||||
useAsDefault?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents either a component type (`type` is `component`) or a loader function
|
||||
* (`type` is `loader`).
|
||||
*
|
||||
* See also {@link RouteDefinition}.
|
||||
*/
|
||||
interface ComponentDefinition {
|
||||
type: string;
|
||||
loader?: Function;
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
// Supplement IComponentOptions from angular.d.ts with router-specific
|
||||
// fields.
|
||||
interface IComponentOptions {
|
||||
$canActivate?: () => boolean;
|
||||
$routeConfig?: RouteDefinition[];
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,15 +137,19 @@ requestHandler = httpBackendService.expect('GET', /test.local/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -163,17 +167,21 @@ requestHandler = httpBackendService.expect('GET', (url: string) => { return true
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectDELETE((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET('http://test.local');
|
||||
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectGET((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectHEAD((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.expectJSONP(/test.local/);
|
||||
requestHandler = httpBackendService.expectJSONP(/test.local\/(\d+)/, ['id']);
|
||||
requestHandler = httpBackendService.expectJSONP((url: string) => { return true; });
|
||||
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local');
|
||||
@ -188,12 +196,15 @@ requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'val
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -216,12 +227,15 @@ requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'valu
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -244,12 +258,16 @@ requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -276,16 +294,24 @@ requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'val
|
||||
requestHandler = httpBackendService.when('GET', /test.local/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, 'response data', function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, /response data/, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local\/(\d+)/, { key: 'value' }, function (headers: Object): boolean { return true; }, ['id']);
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -303,17 +329,21 @@ requestHandler = httpBackendService.when('GET', (url: string) => { return true;
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenDELETE((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET('http://test.local');
|
||||
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenGET((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD(/test.local\/(\d+)/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenHEAD((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.whenJSONP(/test.local/);
|
||||
requestHandler = httpBackendService.whenJSONP(/test.local\/(\d+)/, ['id']);
|
||||
requestHandler = httpBackendService.whenJSONP((url: string) => { return true; });
|
||||
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local');
|
||||
@ -328,12 +358,16 @@ requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -356,12 +390,16 @@ requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value'
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -384,12 +422,16 @@ requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value'
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, 'response data', { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, /response data/, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, function (data: string): boolean { return true; }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local\/(\d+)/, { key: 'value' }, { header: 'value' }, ['id']);
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
@ -410,6 +452,13 @@ requestHandler.passThrough().passThrough();
|
||||
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']);
|
||||
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({});
|
||||
requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; });
|
||||
requestHandler.respond((method, url, data, headers, params) => {
|
||||
if(params.id === 1) {
|
||||
return [200, { key: 'value'}, { header: 'value'}, 'responseText'];
|
||||
} else {
|
||||
return [404, { key: 'value' }, { header: 'value' }, 'responseText'];
|
||||
}
|
||||
});
|
||||
requestHandler.respond('data');
|
||||
requestHandler.respond('data').respond({});
|
||||
requestHandler.respond(expectedData);
|
||||
|
||||
58
angularjs/angular-mocks.d.ts
vendored
58
angularjs/angular-mocks.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module)
|
||||
// Type definitions for Angular JS 1.5 (ngMock, ngMockE2E module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -157,8 +157,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler;
|
||||
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]) :mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for DELETE requests.
|
||||
@ -166,8 +167,9 @@ declare namespace angular {
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for GET requests.
|
||||
@ -175,8 +177,9 @@ declare namespace angular {
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for HEAD requests.
|
||||
@ -184,16 +187,19 @@ declare namespace angular {
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for JSONP requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
*/
|
||||
expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PATCH requests.
|
||||
@ -202,8 +208,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for POST requests.
|
||||
@ -212,8 +219,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PUT requests.
|
||||
@ -222,8 +230,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition.
|
||||
@ -232,40 +241,46 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for DELETE requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for GET requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in request url described above
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for HEAD requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for JSONP requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
|
||||
whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PATCH requests.
|
||||
@ -273,8 +288,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for POST requests.
|
||||
@ -282,8 +298,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PUT requests.
|
||||
@ -291,8 +308,9 @@ declare namespace angular {
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
}
|
||||
|
||||
export module mock {
|
||||
@ -302,9 +320,9 @@ declare namespace angular {
|
||||
/**
|
||||
* Controls the response for a matched request using a function to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
|
||||
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text.
|
||||
*/
|
||||
respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
|
||||
respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using supplied static data to construct the response.
|
||||
|
||||
4
angularjs/angular-resource.d.ts
vendored
4
angularjs/angular-resource.d.ts
vendored
@ -95,7 +95,7 @@ declare namespace angular.resource {
|
||||
(params: Object, data: Object, success?: Function, error?: Function): IResourceArray<T>;
|
||||
}
|
||||
|
||||
// Baseclass for everyresource with default actions.
|
||||
// Baseclass for every resource with default actions.
|
||||
// If you define your new actions for the resource, you will need
|
||||
// to extend this interface and typecast the ResourceClass to it.
|
||||
//
|
||||
@ -113,7 +113,7 @@ declare namespace angular.resource {
|
||||
// Also, static calls always return the IResource (or IResourceArray) retrieved
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
interface IResourceClass<T> {
|
||||
new(dataOrParams? : any) : T;
|
||||
new(dataOrParams? : any) : T & IResource<T>;
|
||||
get: IResourceMethod<T>;
|
||||
|
||||
query: IResourceArrayMethod<T>;
|
||||
|
||||
@ -476,6 +476,8 @@ function test_angular_forEach() {
|
||||
var element = angular.element("div.myApp");
|
||||
var scope: ng.IScope = element.scope();
|
||||
var isolateScope: ng.IScope = element.isolateScope();
|
||||
isolateScope = element.find('div.foo').isolateScope();
|
||||
isolateScope = element.children().isolateScope();
|
||||
|
||||
|
||||
// $timeout signature tests
|
||||
@ -867,7 +869,7 @@ angular.module('docsTabsExample', [])
|
||||
|
||||
angular.module('componentExample', [])
|
||||
.component('counter', {
|
||||
require: ['^ctrl'],
|
||||
require: {'ctrl': '^ctrl'},
|
||||
bindings: {
|
||||
count: '='
|
||||
},
|
||||
|
||||
219
angularjs/angular.d.ts
vendored
219
angularjs/angular.d.ts
vendored
@ -81,7 +81,7 @@ declare namespace angular {
|
||||
*
|
||||
* If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite."
|
||||
*/
|
||||
element: IAugmentedJQueryStatic;
|
||||
element: JQueryStatic;
|
||||
equals(value1: any, value2: any): boolean;
|
||||
extend(destination: any, ...sources: any[]): any;
|
||||
|
||||
@ -156,7 +156,7 @@ declare namespace angular {
|
||||
|
||||
noop(...args: any[]): void;
|
||||
reloadWithDebugInfo(): void;
|
||||
toJson(obj: any, pretty?: boolean): string;
|
||||
toJson(obj: any, pretty?: boolean | number): string;
|
||||
uppercase(str: string): string;
|
||||
version: {
|
||||
full: string;
|
||||
@ -389,9 +389,9 @@ declare namespace angular {
|
||||
$submitted: boolean;
|
||||
$error: any;
|
||||
$pending: any;
|
||||
$addControl(control: INgModelController): void;
|
||||
$removeControl(control: INgModelController): void;
|
||||
$setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void;
|
||||
$addControl(control: INgModelController | IFormController): void;
|
||||
$removeControl(control: INgModelController | IFormController): void;
|
||||
$setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void;
|
||||
$setDirty(): void;
|
||||
$setPristine(): void;
|
||||
$commitViewValue(): void;
|
||||
@ -883,6 +883,24 @@ declare namespace angular {
|
||||
|
||||
unwrapPromises(): boolean;
|
||||
unwrapPromises(value: boolean): IParseProvider;
|
||||
|
||||
/**
|
||||
* Configure $parse service to add literal values that will be present as literal at expressions.
|
||||
*
|
||||
* @param literalName Token for the literal value. The literal name value must be a valid literal name.
|
||||
* @param literalValue Value for this literal. All literal values must be primitives or `undefined`.
|
||||
**/
|
||||
addLiteral(literalName: string, literalValue: any): void;
|
||||
|
||||
/**
|
||||
* Allows defining the set of characters that are allowed in Angular expressions. The function identifierStart will get called to know if a given character is a valid character to be the first character for an identifier. The function identifierContinue will get called to know if a given character is a valid character to be a follow-up identifier character. The functions identifierStart and identifierContinue will receive as arguments the single character to be identifier and the character code point. These arguments will be string and numeric. Keep in mind that the string parameter can be two characters long depending on the character representation. It is expected for the function to return true or false, whether that character is allowed or not.
|
||||
* Since this function will be called extensivelly, keep the implementation of these functions fast, as the performance of these functions have a direct impact on the expressions parsing speed.
|
||||
*
|
||||
* @param identifierStart The function that will decide whether the given character is a valid identifier start character.
|
||||
* @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
|
||||
**/
|
||||
setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
|
||||
identifierContinue?: (character: string, codePoint: number) => boolean): void;
|
||||
}
|
||||
|
||||
interface ICompiledExpression {
|
||||
@ -968,7 +986,7 @@ declare namespace angular {
|
||||
// DocumentService
|
||||
// see http://docs.angularjs.org/api/ng.$document
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IDocumentService extends IAugmentedJQuery {}
|
||||
interface IDocumentService extends JQuery {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
@ -1231,15 +1249,15 @@ declare namespace angular {
|
||||
|
||||
// This corresponds to the "publicLinkFn" returned by $compile.
|
||||
interface ITemplateLinkingFunction {
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction): JQuery;
|
||||
}
|
||||
|
||||
// This corresponds to $transclude (and also the transclude function passed to link).
|
||||
interface ITranscludeFunction {
|
||||
// If the scope is provided, then the cloneAttachFn must be as well.
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction): JQuery;
|
||||
// If one argument is provided, then it's assumed to be the cloneAttachFn.
|
||||
(cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
|
||||
(cloneAttachFn?: ICloneAttachFunction): JQuery;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -1656,50 +1674,6 @@ declare namespace angular {
|
||||
// see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html
|
||||
// and http://toddmotto.com/exploring-the-angular-1-5-component-method/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
}
|
||||
|
||||
/**
|
||||
* `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
|
||||
*
|
||||
* Supported keys:
|
||||
* - `path` or `aux` (requires exactly one of these)
|
||||
* - `component`, `loader`, `redirectTo` (requires exactly one of these)
|
||||
* - `name` or `as` (optional) (requires exactly one of these)
|
||||
* - `data` (optional)
|
||||
*
|
||||
* See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
|
||||
*/
|
||||
interface RouteDefinition {
|
||||
path?: string;
|
||||
aux?: string;
|
||||
component?: Type | ComponentDefinition | string;
|
||||
loader?: Function;
|
||||
redirectTo?: any[];
|
||||
as?: string;
|
||||
name?: string;
|
||||
data?: any;
|
||||
useAsDefault?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents either a component type (`type` is `component`) or a loader function
|
||||
* (`type` is `loader`).
|
||||
*
|
||||
* See also {@link RouteDefinition}.
|
||||
*/
|
||||
interface ComponentDefinition {
|
||||
type: string;
|
||||
loader?: Function;
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component definition object (a simplified directive definition object)
|
||||
*/
|
||||
@ -1709,7 +1683,7 @@ declare namespace angular {
|
||||
* controller if passed as a string. Empty function by default.
|
||||
* Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
|
||||
*/
|
||||
controller?: string | Function | (string | Function)[];
|
||||
controller?: string | Function | (string | Function)[] | IComponentController;
|
||||
/**
|
||||
* An identifier name for a reference to the controller. If present, the controller will be published to scope under
|
||||
* the controllerAs name. If not present, this will default to be the same as the component name.
|
||||
@ -1742,11 +1716,52 @@ declare namespace angular {
|
||||
* Whether transclusion is enabled. Enabled by default.
|
||||
*/
|
||||
transclude?: boolean | string | {[slot: string]: string};
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
require?: {[controller: string]: string};
|
||||
}
|
||||
|
||||
interface IComponentTemplateFn {
|
||||
( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string;
|
||||
( $element?: JQuery, $attrs?: IAttributes ): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Components have a well-defined lifecycle Each component can implement "lifecycle hooks". These are methods that
|
||||
* will be called at certain points in the life of the component.
|
||||
* @url https://docs.angularjs.org/guide/component
|
||||
*/
|
||||
interface IComponentController {
|
||||
/**
|
||||
* Called on each controller after all the controllers on an element have been constructed and had their bindings
|
||||
* initialized (and before the pre & post linking functions for the directives on this element). This is a good
|
||||
* place to put initialization code for your controller.
|
||||
*/
|
||||
$onInit?(): void;
|
||||
/**
|
||||
* Called whenever one-way bindings are updated. The changesObj is a hash whose keys are the names of the bound
|
||||
* properties that have changed, and the values are an {@link IChangesObject} object of the form
|
||||
* { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
|
||||
* cloning the bound value to prevent accidental mutation of the outer value.
|
||||
*/
|
||||
$onChanges?(changesObj: {[property:string]: IChangesObject}): void;
|
||||
/**
|
||||
* Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
|
||||
* watches and event handlers.
|
||||
*/
|
||||
$onDestroy?(): void;
|
||||
/**
|
||||
* Called after this controller's element and its children have been linked. Similar to the post-link function this
|
||||
* hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain
|
||||
* templateUrl directives will not have been compiled and linked since they are waiting for their template to load
|
||||
* asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered
|
||||
* analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather
|
||||
* different in Angular 1 there is no direct mapping and care should be taken when upgrading.
|
||||
*/
|
||||
$postInit?(): void;
|
||||
}
|
||||
|
||||
interface IChangesObject {
|
||||
currentValue: any;
|
||||
previousValue: any;
|
||||
isFirstChange(): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -1762,7 +1777,7 @@ declare namespace angular {
|
||||
interface IDirectiveLinkFn {
|
||||
(
|
||||
scope: IScope,
|
||||
instanceElement: IAugmentedJQuery,
|
||||
instanceElement: JQuery,
|
||||
instanceAttributes: IAttributes,
|
||||
controller: {},
|
||||
transclude: ITranscludeFunction
|
||||
@ -1776,7 +1791,7 @@ declare namespace angular {
|
||||
|
||||
interface IDirectiveCompileFn {
|
||||
(
|
||||
templateElement: IAugmentedJQuery,
|
||||
templateElement: JQuery,
|
||||
templateAttributes: IAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
@ -1818,44 +1833,14 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
/**
|
||||
* angular.element
|
||||
* when calling angular.element, angular returns a jQuery object,
|
||||
* augmented with additional methods like e.g. scope.
|
||||
* see: http://docs.angularjs.org/api/angular.element
|
||||
* These interfaces are kept for compatibility with older versions of these type definitions.
|
||||
* Actually, Angular doesn't create a special subclass of jQuery objects. It extends jQuery.prototype
|
||||
* like jQuery plugins do, that's why all jQuery objects have these Angular-specific methods, not
|
||||
* only those returned from angular.element.
|
||||
* See: http://docs.angularjs.org/api/angular.element
|
||||
*/
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {
|
||||
(selector: string, context?: any): IAugmentedJQuery;
|
||||
(element: Element): IAugmentedJQuery;
|
||||
(object: {}): IAugmentedJQuery;
|
||||
(elementArray: Element[]): IAugmentedJQuery;
|
||||
(object: JQuery): IAugmentedJQuery;
|
||||
(func: Function): IAugmentedJQuery;
|
||||
(array: any[]): IAugmentedJQuery;
|
||||
(): IAugmentedJQuery;
|
||||
}
|
||||
|
||||
interface IAugmentedJQuery extends JQuery {
|
||||
// TODO: events, how to define?
|
||||
//$destroy
|
||||
|
||||
find(selector: string): IAugmentedJQuery;
|
||||
find(element: any): IAugmentedJQuery;
|
||||
find(obj: JQuery): IAugmentedJQuery;
|
||||
controller(): any;
|
||||
controller(name: string): any;
|
||||
injector(): any;
|
||||
scope(): IScope;
|
||||
|
||||
/**
|
||||
* Overload for custom scope interfaces
|
||||
*/
|
||||
scope<T extends IScope>(): T;
|
||||
isolateScope(): IScope;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {}
|
||||
interface IAugmentedJQuery extends JQuery {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AUTO module (angular.js)
|
||||
@ -1870,6 +1855,33 @@ declare namespace angular {
|
||||
annotate(fn: Function, strictDi?: boolean): string[];
|
||||
annotate(inlineAnnotatedFunction: any[]): string[];
|
||||
get<T>(name: string, caller?: string): T;
|
||||
get(name: '$anchorScroll'): IAnchorScrollService
|
||||
get(name: '$cacheFactory'): ICacheFactoryService
|
||||
get(name: '$compile'): ICompileService
|
||||
get(name: '$controller'): IControllerService
|
||||
get(name: '$document'): IDocumentService
|
||||
get(name: '$exceptionHandler'): IExceptionHandlerService
|
||||
get(name: '$filter'): IFilterService
|
||||
get(name: '$http'): IHttpService
|
||||
get(name: '$httpBackend'): IHttpBackendService
|
||||
get(name: '$httpParamSerializer'): IHttpParamSerializer
|
||||
get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer
|
||||
get(name: '$interpolate'): IInterpolateService
|
||||
get(name: '$interval'): IIntervalService
|
||||
get(name: '$locale'): ILocaleService
|
||||
get(name: '$location'): ILocationService
|
||||
get(name: '$log'): ILogService
|
||||
get(name: '$parse'): IParseService
|
||||
get(name: '$q'): IQService
|
||||
get(name: '$rootElement'): IRootElementService
|
||||
get(name: '$rootScope'): IRootScopeService
|
||||
get(name: '$sce'): ISCEService
|
||||
get(name: '$sceDelegate'): ISCEDelegateService
|
||||
get(name: '$templateCache'): ITemplateCacheService
|
||||
get(name: '$templateRequest'): ITemplateRequestService
|
||||
get(name: '$timeout'): ITimeoutService
|
||||
get(name: '$window'): IWindowService
|
||||
get<T>(name: '$xhrFactory'): IXhrFactory<T>
|
||||
has(name: string): boolean;
|
||||
instantiate<T>(typeConstructor: Function, locals?: any): T;
|
||||
invoke(inlineAnnotatedFunction: any[]): any;
|
||||
@ -1930,3 +1942,20 @@ declare namespace angular {
|
||||
(obj: Object): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
// TODO: events, how to define?
|
||||
//$destroy
|
||||
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
controller(name?: string): any;
|
||||
injector(): ng.auto.IInjectorService;
|
||||
/** It's declared generic for custom scope interfaces */
|
||||
scope<T extends ng.IScope>(): T;
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
|
||||
403
angularjs/legacy/angular-mocks-1.3-tests.ts
Normal file
403
angularjs/legacy/angular-mocks-1.3-tests.ts
Normal file
@ -0,0 +1,403 @@
|
||||
/// <reference path="angular-mocks-1.3.d.ts" />
|
||||
|
||||
///////////////////////////////////////
|
||||
// IAngularStatic
|
||||
///////////////////////////////////////
|
||||
var angular: ng.IAngularStatic;
|
||||
var mock: ng.IMockStatic;
|
||||
|
||||
mock = angular.mock;
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IMockStatic
|
||||
///////////////////////////////////////
|
||||
var date: Date;
|
||||
|
||||
mock.dump({ key: 'value' });
|
||||
|
||||
mock.inject(
|
||||
function () { return 1; },
|
||||
function () { return 2; }
|
||||
);
|
||||
|
||||
mock.inject(
|
||||
['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }]);
|
||||
|
||||
// This overload is not documented on the website, but flows from
|
||||
// how the injector works.
|
||||
mock.inject(
|
||||
['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }],
|
||||
['$rootScope', function ($rootScope: ng.IRootScopeService) { return 2; }]);
|
||||
|
||||
mock.module('module1', 'module2');
|
||||
mock.module(
|
||||
function () { return 1; },
|
||||
function () { return 2; }
|
||||
);
|
||||
mock.module({ module1: function () { return 1; } });
|
||||
|
||||
date = mock.TzDate(-7, '2013-1-1T15:00:00Z');
|
||||
date = mock.TzDate(-8, 12345678);
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IExceptionHandlerProvider
|
||||
///////////////////////////////////////
|
||||
var exceptionHandlerProvider: ng.IExceptionHandlerProvider;
|
||||
|
||||
exceptionHandlerProvider.mode('log');
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// ITimeoutService
|
||||
///////////////////////////////////////
|
||||
var timeoutService: ng.ITimeoutService;
|
||||
|
||||
timeoutService.flush();
|
||||
timeoutService.flush(1234);
|
||||
timeoutService.flushNext();
|
||||
timeoutService.flushNext(1234);
|
||||
timeoutService.verifyNoPendingTasks();
|
||||
|
||||
////////////////////////////////////////
|
||||
// IIntervalService
|
||||
////////////////////////////////////////
|
||||
var intervalService: ng.IIntervalService;
|
||||
var intervalServiceTimeActuallyAdvanced: number;
|
||||
|
||||
intervalServiceTimeActuallyAdvanced = intervalService.flush();
|
||||
intervalServiceTimeActuallyAdvanced = intervalService.flush(1234);
|
||||
|
||||
///////////////////////////////////////
|
||||
// ILogService, ILogCall
|
||||
///////////////////////////////////////
|
||||
var logService: ng.ILogService;
|
||||
var logCall: ng.ILogCall;
|
||||
var logs: string[];
|
||||
|
||||
logService.assertEmpty();
|
||||
logService.reset();
|
||||
|
||||
logCall = logService.debug;
|
||||
logCall = logService.error;
|
||||
logCall = logService.info;
|
||||
logCall = logService.log;
|
||||
logCall = logService.warn;
|
||||
|
||||
logs = logCall.logs;
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IHttpBackendService
|
||||
///////////////////////////////////////
|
||||
var httpBackendService: ng.IHttpBackendService;
|
||||
var requestHandler: ng.mock.IRequestHandler;
|
||||
|
||||
httpBackendService.flush();
|
||||
httpBackendService.flush(1234);
|
||||
httpBackendService.resetExpectations();
|
||||
httpBackendService.verifyNoOutstandingExpectation();
|
||||
httpBackendService.verifyNoOutstandingRequest();
|
||||
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local');
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', (url: string) => { return true; }, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET('http://test.local');
|
||||
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.expectJSONP(/test.local/);
|
||||
requestHandler = httpBackendService.expectJSONP((url: string) => { return true; });
|
||||
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local');
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local');
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local');
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local');
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', (url: string) => { return true; }, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET('http://test.local');
|
||||
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD((url: string) => { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.whenJSONP(/test.local/);
|
||||
requestHandler = httpBackendService.whenJSONP((url: string) => { return true; });
|
||||
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local');
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local');
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local');
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, /response data/);
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT((url: string) => { return true; }, { key: 'value' }, { header: 'value' });
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IRequestHandler
|
||||
///////////////////////////////////////
|
||||
var expectedData = { key: 'value'};
|
||||
requestHandler.passThrough();
|
||||
requestHandler.passThrough().passThrough();
|
||||
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']);
|
||||
requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({});
|
||||
requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; });
|
||||
requestHandler.respond('data');
|
||||
requestHandler.respond('data').respond({});
|
||||
requestHandler.respond(expectedData);
|
||||
requestHandler.respond({ key: 'value' });
|
||||
requestHandler.respond({ key: 'value' }, { header: 'value' });
|
||||
requestHandler.respond({ key: 'value' }, { header: 'value' }, 'responseText');
|
||||
requestHandler.respond(404, 'data');
|
||||
requestHandler.respond(404, 'data').respond({});
|
||||
requestHandler.respond(404, { key: 'value' });
|
||||
requestHandler.respond(404, { key: 'value' }, { header: 'value' });
|
||||
requestHandler.respond(404, { key: 'value' }, { header: 'value' }, 'responseText');
|
||||
318
angularjs/legacy/angular-mocks-1.3.d.ts
vendored
Normal file
318
angularjs/legacy/angular-mocks-1.3.d.ts
vendored
Normal file
@ -0,0 +1,318 @@
|
||||
// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular-1.4.d.ts" />
|
||||
|
||||
declare module "angular-mocks/ngMock" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngMockE2E" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngAnimateMock" {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngMock module (angular-mocks.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module angular {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularStatic
|
||||
// We reopen it to add the MockStatic definition
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAngularStatic {
|
||||
mock: IMockStatic;
|
||||
}
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
|
||||
interface IInjectStatic {
|
||||
(...fns: Function[]): any;
|
||||
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
strictDi(val?: boolean): void;
|
||||
}
|
||||
|
||||
interface IMockStatic {
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
|
||||
dump(obj: any): string;
|
||||
|
||||
inject: IInjectStatic
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
|
||||
module(...modules: any[]): any;
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
|
||||
TzDate(offset: number, timestamp: number): Date;
|
||||
TzDate(offset: number, timestamp: string): Date;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler
|
||||
// see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IExceptionHandlerProvider extends IServiceProvider {
|
||||
mode(mode: string): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// TimeoutService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$timeout
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
flush(delay?: number): void;
|
||||
flushNext(expectedDelay?: number): void;
|
||||
verifyNoPendingTasks(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IntervalService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$interval
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IIntervalService {
|
||||
flush(millis?: number): number;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LogService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$log
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ILogService {
|
||||
assertEmpty(): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface ILogCall {
|
||||
logs: string[];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// HttpBackendService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IHttpBackendService {
|
||||
/**
|
||||
* Flushes all pending requests using the trained responses.
|
||||
* @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed.
|
||||
*/
|
||||
flush(count?: number): void;
|
||||
|
||||
/**
|
||||
* Resets all request expectations, but preserves all backend definitions.
|
||||
*/
|
||||
resetExpectations(): void;
|
||||
|
||||
/**
|
||||
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
|
||||
*/
|
||||
verifyNoOutstandingExpectation(): void;
|
||||
|
||||
/**
|
||||
* Verifies that there are no outstanding requests that need to be flushed.
|
||||
*/
|
||||
verifyNoOutstandingRequest(): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for DELETE requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
*/
|
||||
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for GET requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
*/
|
||||
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for HEAD requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
*/
|
||||
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for JSONP requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
*/
|
||||
expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PATCH requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for POST requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PUT requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for DELETE requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for GET requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for HEAD requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for JSONP requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PATCH requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for POST requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PUT requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
*/
|
||||
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
|
||||
}
|
||||
|
||||
export module mock {
|
||||
// returned interface by the the mocked HttpBackendService expect/when methods
|
||||
interface IRequestHandler {
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using a function to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
|
||||
*/
|
||||
respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param status HTTP status code to add to the response.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
// Available when ngMockE2E is loaded
|
||||
/**
|
||||
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
|
||||
*/
|
||||
passThrough(): IRequestHandler;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// functions attached to global object (window)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
|
||||
//declare var module: (...modules: any[]) => any;
|
||||
declare var inject: angular.IInjectStatic;
|
||||
115
applicationinsights-js/applicationinsights-js-tests.ts
Normal file
115
applicationinsights-js/applicationinsights-js-tests.ts
Normal file
@ -0,0 +1,115 @@
|
||||
///<reference path='applicationinsights-js.d.ts' />
|
||||
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
|
||||
|
||||
var config: Microsoft.ApplicationInsights.IConfig = {
|
||||
instrumentationKey: "<your iKey>",
|
||||
endpointUrl: "endpointUrl",
|
||||
emitLineDelimitedJson: false,
|
||||
accountId: "accountId",
|
||||
sessionRenewalMs: 30,
|
||||
sessionExpirationMs: 24 * 60 * 60 * 1000,
|
||||
maxBatchSizeInBytes: 100 * 1024,
|
||||
maxBatchInterval: 15,
|
||||
enableDebug: false,
|
||||
disableTelemetry: false,
|
||||
verboseLogging: false,
|
||||
diagnosticLogInterval: 10,
|
||||
samplingPercentage: 100,
|
||||
autoTrackPageVisitTime: true,
|
||||
disableExceptionTracking: false,
|
||||
disableAjaxTracking: false,
|
||||
overridePageViewDuration: false,
|
||||
maxAjaxCallsPerView: -1,
|
||||
disableDataLossAnalysis: true,
|
||||
disableCorrelationHeaders: true,
|
||||
disableFlushOnBeforeUnload: false,
|
||||
enableSessionStorageBuffer: false,
|
||||
cookieDomain: ""
|
||||
};
|
||||
|
||||
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
|
||||
config: config,
|
||||
context: null,
|
||||
queue: null,
|
||||
|
||||
startTrackPage(name?: string) { return null; },
|
||||
stopTrackPage(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
|
||||
trackPageView(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, duration?: number) { return null; },
|
||||
startTrackEvent(name: string) { return null },
|
||||
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null },
|
||||
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null },
|
||||
trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string) { return null },
|
||||
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null },
|
||||
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null },
|
||||
trackTrace(message: string, properties?: { [name: string]: string; }) { return null },
|
||||
flush() { return null },
|
||||
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null },
|
||||
clearAuthenticatedUserContext() { return null },
|
||||
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error) { return null }
|
||||
};
|
||||
|
||||
// trackPageView
|
||||
appInsights.trackPageView("page1");
|
||||
appInsights.trackPageView("page2", "http://example.com", null, null, 1000);
|
||||
|
||||
// startTrackPage
|
||||
appInsights.startTrackPage("page");
|
||||
|
||||
// stopTrackPage
|
||||
appInsights.stopTrackPage("page");
|
||||
appInsights.stopTrackPage("page", "http://example.com", null, null);
|
||||
|
||||
// trackEvent
|
||||
appInsights.trackEvent("page1");
|
||||
appInsights.trackEvent("page1", null, null);
|
||||
|
||||
// trackMetric
|
||||
appInsights.trackMetric("page1", 999);
|
||||
appInsights.trackMetric("page1", 999, 1, 1, 2, null);
|
||||
|
||||
// trackException
|
||||
appInsights.trackException(new Error("sample error"));
|
||||
appInsights.trackException(new Error("sample error"), "handledAt", null, null);
|
||||
|
||||
// trackTrace
|
||||
appInsights.trackTrace("message");
|
||||
appInsights.trackTrace("message", null);
|
||||
|
||||
// flush
|
||||
appInsights.flush();
|
||||
|
||||
// setAuthenticatedUserContext
|
||||
appInsights.setAuthenticatedUserContext("userId");
|
||||
appInsights.setAuthenticatedUserContext("userId", "accountId");
|
||||
|
||||
// set config dynamically
|
||||
appInsights.config.instrumentationKey = "<new key>";
|
||||
|
||||
|
||||
// TelementryContext
|
||||
var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
|
||||
|
||||
context.application.ver = "v0.0.0";
|
||||
context.application.build = "1.1.1";
|
||||
|
||||
context.device.type = "sampleDevice";
|
||||
context.device.locale = "en-US";
|
||||
|
||||
context.user.id = "userId";
|
||||
context.user.authenticatedId = "authId";
|
||||
|
||||
context.session.id = "sessionId";
|
||||
context.session.isFirst = true;
|
||||
|
||||
context.location.ip = "127.0.0.1";
|
||||
|
||||
context.operation.id = "1";
|
||||
context.operation.syntheticSource = "testAgent";
|
||||
|
||||
// track
|
||||
var data = new Microsoft.Telemetry.Base();
|
||||
var envelope = new Microsoft.Telemetry.Envelope();
|
||||
|
||||
context.track(envelope);
|
||||
|
||||
context.addTelemetryInitializer((envelope) => false);
|
||||
408
applicationinsights-js/applicationinsights-js.d.ts
vendored
Normal file
408
applicationinsights-js/applicationinsights-js.d.ts
vendored
Normal file
@ -0,0 +1,408 @@
|
||||
// Type definitions for ApplicationInsights-JS v0.22.14
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-JS
|
||||
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module AI {
|
||||
enum SeverityLevel {
|
||||
Verbose = 0,
|
||||
Information = 1,
|
||||
Warning = 2,
|
||||
Error = 3,
|
||||
Critical = 4,
|
||||
}
|
||||
}
|
||||
|
||||
declare module Microsoft.ApplicationInsights.Context {
|
||||
interface IApplication {
|
||||
/**
|
||||
* The application version.
|
||||
*/
|
||||
ver: string;
|
||||
/**
|
||||
* The application build version.
|
||||
*/
|
||||
build: string;
|
||||
}
|
||||
|
||||
interface IDevice {
|
||||
/**
|
||||
* The type for the current device.
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* A device unique ID.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The device OEM for the current device.
|
||||
*/
|
||||
oemName: string;
|
||||
/**
|
||||
* The device model for the current device.
|
||||
*/
|
||||
model: string;
|
||||
/**
|
||||
* The IANA interface type for the internet connected network adapter.
|
||||
*/
|
||||
network: number;
|
||||
/**
|
||||
* The application screen resolution.
|
||||
*/
|
||||
resolution: string;
|
||||
/**
|
||||
* The current display language of the operating system.
|
||||
*/
|
||||
locale: string;
|
||||
/**
|
||||
* The IP address.
|
||||
*/
|
||||
ip: string;
|
||||
/**
|
||||
* The device language.
|
||||
*/
|
||||
language: string;
|
||||
/**
|
||||
* The OS name.
|
||||
*/
|
||||
os: string;
|
||||
/**
|
||||
* The OS version.
|
||||
*/
|
||||
osversion: string;
|
||||
}
|
||||
|
||||
interface ILocation {
|
||||
/**
|
||||
* Client IP address for reverse lookup
|
||||
*/
|
||||
ip: string;
|
||||
}
|
||||
|
||||
interface IInternal {
|
||||
/**
|
||||
* The SDK version used to create this telemetry item.
|
||||
*/
|
||||
sdkVersion: string;
|
||||
/**
|
||||
* The SDK agent version.
|
||||
*/
|
||||
agentVersion: string;
|
||||
}
|
||||
|
||||
interface ISample {
|
||||
/**
|
||||
* Sample rate
|
||||
*/
|
||||
sampleRate: number;
|
||||
}
|
||||
|
||||
interface ISession {
|
||||
/**
|
||||
* The session ID.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The true if this is the first session
|
||||
*/
|
||||
isFirst: boolean;
|
||||
/**
|
||||
* The date at which this guid was genereated.
|
||||
* Per the spec the ID will be regenerated if more than acquisitionSpan milliseconds ellapse from this time.
|
||||
*/
|
||||
acquisitionDate: number;
|
||||
/**
|
||||
* The date at which this session ID was last reported.
|
||||
* This value should be updated whenever telemetry is sent using this ID.
|
||||
* Per the spec the ID will be regenerated if more than renewalSpan milliseconds elapse from this time with no activity.
|
||||
*/
|
||||
renewalDate: number;
|
||||
}
|
||||
|
||||
interface IOperation {
|
||||
/**
|
||||
* Operation id
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Operation name
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Parent operation id
|
||||
*/
|
||||
parentId: string;
|
||||
/**
|
||||
* Root operation id
|
||||
*/
|
||||
rootId: string;
|
||||
/**
|
||||
* Synthetic source of the operation
|
||||
*/
|
||||
syntheticSource: string;
|
||||
}
|
||||
|
||||
interface IUser {
|
||||
/**
|
||||
* The telemetry configuration.
|
||||
*/
|
||||
config: any;
|
||||
/**
|
||||
* The user ID.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Authenticated user id
|
||||
*/
|
||||
authenticatedId: string;
|
||||
/**
|
||||
* The account ID.
|
||||
*/
|
||||
accountId: string;
|
||||
/**
|
||||
* The account acquisition date.
|
||||
*/
|
||||
accountAcquisitionDate: string;
|
||||
/**
|
||||
* The user agent string.
|
||||
*/
|
||||
agent: string;
|
||||
/**
|
||||
* The store region.
|
||||
*/
|
||||
storeRegion: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module Microsoft.Telemetry {
|
||||
class Base {
|
||||
baseType: string;
|
||||
constructor();
|
||||
}
|
||||
|
||||
class Envelope {
|
||||
ver: number;
|
||||
name: string;
|
||||
time: string;
|
||||
sampleRate: number;
|
||||
seq: string;
|
||||
iKey: string;
|
||||
flags: number;
|
||||
deviceId: string;
|
||||
os: string;
|
||||
osVer: string;
|
||||
appId: string;
|
||||
appVer: string;
|
||||
userId: string;
|
||||
tags: any;
|
||||
data: Base;
|
||||
constructor();
|
||||
}
|
||||
}
|
||||
|
||||
declare module Microsoft.ApplicationInsights {
|
||||
interface IConfig {
|
||||
instrumentationKey?: string;
|
||||
endpointUrl?: string;
|
||||
emitLineDelimitedJson?: boolean;
|
||||
accountId?: string;
|
||||
sessionRenewalMs?: number;
|
||||
sessionExpirationMs?: number;
|
||||
maxBatchSizeInBytes?: number;
|
||||
maxBatchInterval?: number;
|
||||
enableDebug?: boolean;
|
||||
disableExceptionTracking?: boolean;
|
||||
disableTelemetry?: boolean;
|
||||
verboseLogging?: boolean;
|
||||
diagnosticLogInterval?: number;
|
||||
samplingPercentage?: number;
|
||||
autoTrackPageVisitTime?: boolean;
|
||||
disableAjaxTracking?: boolean;
|
||||
overridePageViewDuration?: boolean;
|
||||
maxAjaxCallsPerView?: number;
|
||||
disableDataLossAnalysis?: boolean;
|
||||
disableCorrelationHeaders?: boolean;
|
||||
disableFlushOnBeforeUnload?: boolean;
|
||||
enableSessionStorageBuffer?: boolean;
|
||||
cookieDomain?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface ITelemetryContext {
|
||||
/**
|
||||
* The object describing a component tracked by this object.
|
||||
*/
|
||||
application: Context.IApplication;
|
||||
/**
|
||||
* The object describing a device tracked by this object.
|
||||
*/
|
||||
device: Context.IDevice;
|
||||
/**
|
||||
* The object describing internal settings.
|
||||
*/
|
||||
internal: Context.IInternal;
|
||||
/**
|
||||
* The object describing a location tracked by this object.
|
||||
*/
|
||||
location: Context.ILocation;
|
||||
/**
|
||||
* The object describing a operation tracked by this object.
|
||||
*/
|
||||
operation: Context.IOperation;
|
||||
/**
|
||||
* The object describing sampling settings.
|
||||
*/
|
||||
sample: Context.ISample;
|
||||
/**
|
||||
* The object describing a user tracked by this object.
|
||||
*/
|
||||
user: Context.IUser;
|
||||
/**
|
||||
* The object describing a session tracked by this object.
|
||||
*/
|
||||
session: Context.ISession;
|
||||
/**
|
||||
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
|
||||
* before telemetry item is pushed for sending and in the order they were added.
|
||||
*/
|
||||
addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.Telemetry.Envelope) => boolean): any;
|
||||
/**
|
||||
* Tracks telemetry object.
|
||||
*/
|
||||
track(envelope: Microsoft.Telemetry.Envelope): any;
|
||||
}
|
||||
|
||||
interface IAppInsights {
|
||||
config: IConfig;
|
||||
context: ITelemetryContext;
|
||||
queue: (() => void)[];
|
||||
/**
|
||||
* Starts timing how long the user views a page or other item. Call this when the page opens.
|
||||
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
|
||||
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
|
||||
*/
|
||||
startTrackPage(name?: string): any;
|
||||
/**
|
||||
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
stopTrackPage(name?: string, url?: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}): any;
|
||||
/**
|
||||
* Logs that a page or other item was viewed.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
* @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
|
||||
*/
|
||||
trackPageView(name?: string, url?: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}, duration?: number): any;
|
||||
/**
|
||||
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
|
||||
* @param name A string that identifies this event uniquely within the document.
|
||||
*/
|
||||
startTrackEvent(name: string): any;
|
||||
/**
|
||||
* Log an extended event that you started timing with {@link startTrackEvent}.
|
||||
* @param name The string you used to identify this event in startTrackEvent.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
stopTrackEvent(name: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}): any;
|
||||
/**
|
||||
* Log a user action or other occurrence.
|
||||
* @param name A string to identify this event in the portal.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackEvent(name: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}): any;
|
||||
/**
|
||||
* Log an AJAX request
|
||||
* @param id Event id
|
||||
* @param absoluteUrl Full url
|
||||
* @param pathName Leave this parameter blank
|
||||
* @param totalTime Total time it took for AJAX request to complete
|
||||
* @param success Whether AJAX request succeeded or failed
|
||||
* @param resultCode Result code returned from AJAX call
|
||||
* @param method HTTP verb that was used (GET, POST)
|
||||
*/
|
||||
trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string): any;
|
||||
/**
|
||||
* Log an exception you have caught.
|
||||
* @param exception An Error from a catch clause, or the string error message.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
* @param severityLevel AI.SeverityLevel - severity level
|
||||
*/
|
||||
trackException(exception: Error, handledAt?: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}, severityLevel?: AI.SeverityLevel): any;
|
||||
/**
|
||||
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
|
||||
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
|
||||
* telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
|
||||
* @param name A string that identifies the metric.
|
||||
* @param average Number representing either a single measurement, or the average of several measurements.
|
||||
* @param sampleCount The number of measurements represented by the average. Defaults to 1.
|
||||
* @param min The smallest measurement in the sample. Defaults to the average.
|
||||
* @param max The largest measurement in the sample. Defaults to the average.
|
||||
*/
|
||||
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
|
||||
[name: string]: string;
|
||||
}): any;
|
||||
/**
|
||||
* Log a diagnostic message.
|
||||
* @param message A message string
|
||||
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
|
||||
*/
|
||||
trackTrace(message: string, properties?: {
|
||||
[name: string]: string;
|
||||
}): any;
|
||||
/**
|
||||
* Immediately send all queued telemetry.
|
||||
*/
|
||||
flush(): any;
|
||||
/**
|
||||
* Sets the autheticated user id and the account id in this session.
|
||||
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
|
||||
*
|
||||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
|
||||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
|
||||
*/
|
||||
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
|
||||
/**
|
||||
* Clears the authenticated user id and the account id from the user context.
|
||||
*/
|
||||
clearAuthenticatedUserContext(): any;
|
||||
downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): void;
|
||||
/**
|
||||
* The custom error handler for Application Insights
|
||||
* @param {string} message - The error message
|
||||
* @param {string} url - The url where the error was raised
|
||||
* @param {number} lineNumber - The line number where the error was raised
|
||||
* @param {number} columnNumber - The column number for the line where the error was raised
|
||||
* @param {Error} error - The Error object
|
||||
*/
|
||||
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
|
||||
}
|
||||
}
|
||||
15
argv/argv-tests.ts
Normal file
15
argv/argv-tests.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="argv.d.ts" />
|
||||
import argv = require('argv');
|
||||
argv.version( 'v1.0' );
|
||||
argv.info( 'Special script info' );
|
||||
argv.clear()
|
||||
.option({
|
||||
name: 'option',
|
||||
short: 'o',
|
||||
type: 'string',
|
||||
description: 'Defines an option for your script',
|
||||
example: "'script --opiton=value' or 'script -o value'"
|
||||
})
|
||||
.run([ '--option=123', '-o', '123' ]);
|
||||
argv.run();
|
||||
argv.help();
|
||||
59
argv/argv.d.ts
vendored
Normal file
59
argv/argv.d.ts
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
// Type definitions for argv
|
||||
// Project: https://www.npmjs.com/package/argv
|
||||
// Definitions by: Hookclaw <https://github.com/hookclaw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module "argv" {
|
||||
// argv module
|
||||
type args = {
|
||||
targets:string[],
|
||||
options:{[key:string]:any}
|
||||
};
|
||||
|
||||
type helpOption = {
|
||||
name: string,
|
||||
type: string,
|
||||
short?: string,
|
||||
description?: string,
|
||||
example?: string
|
||||
};
|
||||
|
||||
type module = {
|
||||
mod: string,
|
||||
description: string,
|
||||
options: {[key:string]:helpOption}
|
||||
};
|
||||
|
||||
type typeFunction = (value:any, ...arglist:any[]) => any;
|
||||
|
||||
type argv = {
|
||||
|
||||
// Runs the arguments parser
|
||||
run: ( argv?:string[] ) => args,
|
||||
|
||||
// Adding options to definitions list
|
||||
option: ( mod:helpOption|helpOption[] ) => argv,
|
||||
|
||||
// Creating module
|
||||
mod: ( object:module|module[] ) => argv,
|
||||
|
||||
// Creates custom type function
|
||||
type: ( name:string|{[key:string]:typeFunction}, callback?:typeFunction ) => any,
|
||||
|
||||
// Setting version number, and auto setting version option
|
||||
version: ( v:string ) => argv,
|
||||
|
||||
// Description setup
|
||||
info: ( mod:string, description?:module ) => argv,
|
||||
|
||||
// Cleans out current options
|
||||
clear: () => argv,
|
||||
|
||||
// Prints out the help doc
|
||||
help: ( mod?:string ) => argv
|
||||
|
||||
};
|
||||
|
||||
var argv:argv;
|
||||
|
||||
export = argv;
|
||||
}
|
||||
@ -378,6 +378,7 @@ async.auto({
|
||||
|
||||
async.retry(3, function (callback, results) { }, function (err, result) { });
|
||||
async.retry({ times: 3, interval: 200 }, function (callback, results) { }, function (err, result) { });
|
||||
async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }, function (callback, results) { }, function (err, result) { });
|
||||
|
||||
|
||||
async.parallel([
|
||||
|
||||
4
async/async.d.ts
vendored
4
async/async.d.ts
vendored
@ -12,7 +12,7 @@ interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): v
|
||||
|
||||
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, 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: (err: string, truthValue: boolean) => void): void; }
|
||||
@ -136,7 +136,7 @@ interface Async {
|
||||
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
|
||||
auto(tasks: any, callback?: (error: Error, results: any) => void): void;
|
||||
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: (error: Error, results: any) => void): void;
|
||||
retry<T>(opts: { times: number, interval: number }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: (error: Error, results: any) => void): void;
|
||||
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: (error: Error, results: any) => void): void;
|
||||
iterator(tasks: Function[]): Function;
|
||||
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
|
||||
nextTick(callback: Function): void;
|
||||
|
||||
5
atmosphere/atmosphere.d.ts
vendored
5
atmosphere/atmosphere.d.ts
vendored
@ -102,5 +102,6 @@ declare namespace Atmosphere {
|
||||
}
|
||||
|
||||
declare var atmosphere:Atmosphere.Atmosphere;
|
||||
|
||||
|
||||
declare module 'atmosphere' {
|
||||
export = atmosphere;
|
||||
}
|
||||
|
||||
2
autobahn/autobahn.d.ts
vendored
2
autobahn/autobahn.d.ts
vendored
@ -181,7 +181,7 @@ declare namespace autobahn {
|
||||
|
||||
open(): void;
|
||||
|
||||
close(reason: string, message: string): void;
|
||||
close(reason?: string, message?: string): void;
|
||||
|
||||
onopen: (session: Session, details: any) => void;
|
||||
onclose: (reason: string, details: any) => boolean;
|
||||
|
||||
@ -11,6 +11,32 @@ creds = new AWS.Credentials(str, str, str);
|
||||
str = creds.accessKeyId;
|
||||
|
||||
|
||||
/*
|
||||
* ECS
|
||||
*/
|
||||
var ecs:AWS.ECS
|
||||
|
||||
ecs = new AWS.ECS();
|
||||
ecs = new AWS.ECS({apiVersion: '2012-11-05'});
|
||||
|
||||
ecs.describeClusters({
|
||||
clusters: ['STRING_VALUE', 'STRING_VALUE']
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
ecs.describeTasks({
|
||||
cluster: 'STRING_VALUE',
|
||||
tasks: ['STRING_VALUE', 'STRING_VALUE']
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* SQS
|
||||
*/
|
||||
@ -253,4 +279,107 @@ sqs.setQueueAttributes({
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
|
||||
|
||||
var dynamoDBDocClient:AWS.DynamoDB.DocumentClient;
|
||||
dynamoDBDocClient = new AWS.DynamoDB.DocumentClient();
|
||||
dynamoDBDocClient = new AWS.DynamoDB.DocumentClient({});
|
||||
dynamoDBDocClient.createSet([1, 2, 3], { validate: true });
|
||||
dynamoDBDocClient.get(
|
||||
{
|
||||
TableName: 'TABLE_NAME',
|
||||
Key: { userId: 'abc123', email: 'abc123@abc123.com' }
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
dynamoDBDocClient.put(
|
||||
{
|
||||
TableName: 'TABLE_NAME',
|
||||
Item: {
|
||||
userId: 'abc123',
|
||||
email: 'abc123@abc123.com',
|
||||
firstName: 'Matt',
|
||||
lastName: 'Forrester the ' + new Date().getTime()
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
dynamoDBDocClient.delete(
|
||||
{
|
||||
TableName: 'TABLE_NAME',
|
||||
Key: {
|
||||
userId: 'abc123',
|
||||
email: 'abc123@abc123.com'
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
dynamoDBDocClient.update(
|
||||
{
|
||||
TableName: 'TABLE_NAME',
|
||||
Key: {
|
||||
userId: 'abc123',
|
||||
email: 'abc123@abc123.com'
|
||||
},
|
||||
AttributeUpdates: {
|
||||
thingsWithWheels: {
|
||||
Action: 'PUT',
|
||||
Value: dynamoDBDocClient.createSet(
|
||||
[
|
||||
'SkateBoard',
|
||||
'Skates',
|
||||
'Mountain Bike',
|
||||
'Evolve Electric Skateboard'
|
||||
],
|
||||
{ validate: true }
|
||||
)
|
||||
},
|
||||
age: {
|
||||
Action: 'PUT',
|
||||
Value: 35
|
||||
}
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
dynamoDBDocClient.scan(
|
||||
{
|
||||
TableName: 'TABLE_NAME',
|
||||
KeyConditions: {
|
||||
age: {
|
||||
ComparisonOperator: 'EQ',
|
||||
AttributeValueList: [35]
|
||||
}
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
dynamoDBDocClient.query(
|
||||
{
|
||||
TableName: 'TABLE_NAME',
|
||||
KeyConditions: {
|
||||
userId: {
|
||||
ComparisonOperator: 'EQ',
|
||||
AttributeValueList: ['abc123']
|
||||
}
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
}
|
||||
);
|
||||
|
||||
147
aws-sdk/aws-sdk.d.ts
vendored
147
aws-sdk/aws-sdk.d.ts
vendored
@ -154,11 +154,33 @@ declare module "aws-sdk" {
|
||||
|
||||
export class ECS {
|
||||
constructor(options?: any);
|
||||
|
||||
/**
|
||||
* Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount, Amazon ECS spawns another instantiation of the task in the specified cluster. To update an existing service, see UpdateService.
|
||||
*/
|
||||
createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void;
|
||||
/**
|
||||
* Describes one or more of your clusters.
|
||||
*/
|
||||
describeClusters(params: ecs.DescribeClustersParams, callback: (err: any, data: any) => void): void;
|
||||
/**
|
||||
* Describes the specified services running in your cluster.
|
||||
*/
|
||||
describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void;
|
||||
/**
|
||||
* Describes a specified task or tasks.
|
||||
*/
|
||||
describeTasks(params: ecs.DescribeTasksParams, callback: (err: any, data: any) => void): void;
|
||||
/**
|
||||
* Describes a task definition. You can specify a family and revision to find information about a specific task definition, or you can simply specify the family to find the latest ACTIVE revision in that family.
|
||||
*/
|
||||
describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void;
|
||||
/**
|
||||
* Registers a new task definition from the supplied family and containerDefinitions. Optionally, you can add data volumes to your containers with the volumes parameter. For more information about task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide.
|
||||
*/
|
||||
registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void;
|
||||
/**
|
||||
* Modifies the desired count, deployment configuration, or task definition used in a service.
|
||||
*/
|
||||
updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
@ -166,12 +188,106 @@ declare module "aws-sdk" {
|
||||
constructor(options?: any);
|
||||
}
|
||||
|
||||
// ==========================================================
|
||||
|
||||
export module DynamoDB {
|
||||
|
||||
interface _DDBDC_Generic {
|
||||
TableName: string;
|
||||
ExpressionAttributeNames?: string[];
|
||||
ReturnConsumedCapacity?: "INDEXES" | "TOTAL" | "NONE";
|
||||
}
|
||||
|
||||
type _DDBDC_ComparisonOperator = "EQ" | "NE" | "IN" | "LE" | "LT" | "GE" | "GT" | "BETWEEN" | "NOT_NULL" | "NULL" | "CONTAINS" | "NOT_CONTAINS" | "BEGINS_WITH"
|
||||
type _DDBDC_Keys = { [someKey: string]: any };
|
||||
type _DDBDC_KeyComparison = {
|
||||
[someKey: string]: {
|
||||
AttributeValueList: any[];
|
||||
ComparisonOperator: _DDBDC_ComparisonOperator;
|
||||
}
|
||||
};
|
||||
|
||||
interface _DDBDC_Reader extends _DDBDC_Generic {
|
||||
ConsistentRead?: boolean;
|
||||
ProjectionExpression?: string;
|
||||
AttributesToGet?: string[];
|
||||
}
|
||||
|
||||
interface _DDBDC_Writer extends _DDBDC_Generic {
|
||||
ExpressionAttributeValues?: _DDBDC_Keys;
|
||||
ReturnItemCollectionMetrics?: "SIZE" | "NONE";
|
||||
ReturnValues?: "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW";
|
||||
ConditionExpression?: string;
|
||||
ConditionalOperator?: "AND" | "OR";
|
||||
Expected?: {
|
||||
[someKey: string]: {
|
||||
AttributeValueList: any[];
|
||||
ComparisonOperator: _DDBDC_ComparisonOperator;
|
||||
Exists: boolean;
|
||||
Value: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface UpdateParam extends _DDBDC_Writer {
|
||||
Key: _DDBDC_Keys;
|
||||
AttributeUpdates: {
|
||||
[someKey: string]: {
|
||||
Action: "PUT" | "ADD" | "DELETE";
|
||||
Value: any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface QueryParam extends _DDBDC_Reader {
|
||||
ConditionalOperator?: "AND" | "OR";
|
||||
ExclusiveStartKey?: _DDBDC_Keys;
|
||||
ExpressionAttributeValues?: _DDBDC_Keys;
|
||||
FilterExpression?: string;
|
||||
IndexName?: string;
|
||||
KeyConditionExpression?: string;
|
||||
KeyConditions?: _DDBDC_KeyComparison;
|
||||
Limit?: number;
|
||||
QueryFilter?: _DDBDC_KeyComparison;
|
||||
ScanIndexForward?: boolean;
|
||||
Select?: "ALL_ATTRIBUTES" | "ALL_PROJECTED_ATTRIBUTES" | "SPECIFIC_ATTRIBUTES" | "COUNT";
|
||||
}
|
||||
|
||||
interface ScanParam extends QueryParam {
|
||||
Segment?: number;
|
||||
ScanFilter?: _DDBDC_KeyComparison;
|
||||
TotalSegments?: number;
|
||||
}
|
||||
|
||||
interface GetParam extends _DDBDC_Reader {
|
||||
Key: _DDBDC_Keys;
|
||||
}
|
||||
|
||||
interface PutParam extends _DDBDC_Writer {
|
||||
Item: _DDBDC_Keys;
|
||||
}
|
||||
|
||||
interface DeleteParam extends _DDBDC_Writer {
|
||||
Key: _DDBDC_Keys;
|
||||
}
|
||||
|
||||
export class DocumentClient {
|
||||
constructor(options?: any);
|
||||
get(params: GetParam, next: (err: any, data: any) => void): void;
|
||||
put(params: PutParam, next: (err: any, data: any) => void): void;
|
||||
delete(params: DeleteParam, next: (err: any, data: any) => void): void;
|
||||
query(params: QueryParam, next: (err: any, data: any) => void): void;
|
||||
scan(params: ScanParam, next: (err: any, data: any) => void): void;
|
||||
update(params: UpdateParam, next: (err: any, data: any) => void): void;
|
||||
createSet(list: any[], options?: { validate?: boolean }): { values: any[], type: string };
|
||||
batchGet(params: any, next: (err: any, data: any) => void): void;
|
||||
batchWrite(params: any, next: (err: any, data: any) => void): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================
|
||||
|
||||
export module SQS {
|
||||
|
||||
export interface SqsOptions {
|
||||
@ -1125,11 +1241,38 @@ declare module "aws-sdk" {
|
||||
}
|
||||
|
||||
export interface DescribeServicesParams {
|
||||
/**
|
||||
* A list of services to describe.
|
||||
*/
|
||||
services: string[];
|
||||
cluster: string;
|
||||
/**
|
||||
* The name of the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed.
|
||||
*/
|
||||
cluster?: string;
|
||||
}
|
||||
|
||||
export interface DescribeClustersParams {
|
||||
/**
|
||||
* A space-separated list of cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed.
|
||||
*/
|
||||
clusters?: string[];
|
||||
}
|
||||
|
||||
export interface DescribeTasksParams {
|
||||
/**
|
||||
* A space-separated list of task IDs or full Amazon Resource Name (ARN) entries.
|
||||
*/
|
||||
tasks: string[];
|
||||
/**
|
||||
* The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to describe. If you do not specify a cluster, the default cluster is assumed.
|
||||
*/
|
||||
cluster?: string;
|
||||
}
|
||||
|
||||
export interface DescribeTaskDefinitionParams {
|
||||
/**
|
||||
* The `family` for the latest `ACTIVE` revision, `family` and `revision` (`family:revision`) for a specific revision in the family, or full Amazon Resource Name (ARN) of the task definition to describe.
|
||||
*/
|
||||
taskDefinition: string;
|
||||
}
|
||||
|
||||
|
||||
@ -101,4 +101,10 @@ function TestGlobalApiAndChannels() {
|
||||
|
||||
Backbone.Radio.reply('auth', 'authenticate', onStart);
|
||||
Backbone.Radio.request('auth', 'authenticate', 'pelle', 42);
|
||||
}
|
||||
}
|
||||
|
||||
import Radio = require('backbone.radio');
|
||||
function TestImport() {
|
||||
var channel: Backbone.Radio.Channel = Radio.channel('channel-name');
|
||||
channel.command('show:view');
|
||||
}
|
||||
|
||||
6
backbone.radio/backbone.radio.d.ts
vendored
6
backbone.radio/backbone.radio.d.ts
vendored
@ -90,3 +90,9 @@ declare namespace Backbone {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'backbone.radio' {
|
||||
import Backbone = require('backbone');
|
||||
|
||||
export = Backbone.Radio;
|
||||
}
|
||||
|
||||
2
backbone/backbone-global.d.ts
vendored
2
backbone/backbone-global.d.ts
vendored
@ -316,7 +316,7 @@ declare namespace Backbone {
|
||||
stop(): void;
|
||||
route(route: string, callback: Function): number;
|
||||
checkUrl(e?: any): void;
|
||||
loadUrl(fragmentOverride: string): boolean;
|
||||
loadUrl(fragmentOverride?: string): boolean;
|
||||
navigate(fragment: string, options?: any): boolean;
|
||||
static started: boolean;
|
||||
options: any;
|
||||
|
||||
@ -166,6 +166,9 @@ function test_collection() {
|
||||
//////////
|
||||
|
||||
Backbone.history.start();
|
||||
Backbone.History.started;
|
||||
Backbone.history.loadUrl();
|
||||
Backbone.history.loadUrl('12345');
|
||||
|
||||
namespace v1Changes {
|
||||
namespace events {
|
||||
|
||||
6
base64-js/base64-js-tests.ts
Normal file
6
base64-js/base64-js-tests.ts
Normal file
@ -0,0 +1,6 @@
|
||||
/// <reference path="base64-js.d.ts" />
|
||||
|
||||
import * as base64js from 'base64-js';
|
||||
|
||||
const bytes: Uint8Array = base64js.toByteArray('shemp');
|
||||
const decoded: string = base64js.fromByteArray(new Uint8Array(0));
|
||||
10
base64-js/base64-js.d.ts
vendored
Normal file
10
base64-js/base64-js.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
// Type definitions for base64-js v1.1.2
|
||||
// Project: https://github.com/beatgammit/base64-js
|
||||
// Definitions by: Peter Safranek <https://github.com/pe8ter>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'base64-js' {
|
||||
|
||||
export function toByteArray(encoded: string): Uint8Array;
|
||||
export function fromByteArray(bytes: Uint8Array): string;
|
||||
}
|
||||
96
bezier-js/bezier-js-tests.ts
Normal file
96
bezier-js/bezier-js-tests.ts
Normal file
@ -0,0 +1,96 @@
|
||||
/// <reference path="./bezier-js.d.ts" />
|
||||
|
||||
function test() {
|
||||
|
||||
var bezierjs: typeof BezierJs;
|
||||
|
||||
var bezier = new bezierjs.Bezier([1,2,3,4]);
|
||||
var cap = new bezierjs.BezierCap([]);
|
||||
var point: BezierJs.Point = { x: 0, y: 0 };
|
||||
var utils = bezier.getUtils();
|
||||
var line: BezierJs.Line = { p1: { x:0, y: 0}, p2: {x:1, y: 1}};
|
||||
var abc: BezierJs.ABC = { A: null, B: null, C: null };
|
||||
var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1 };
|
||||
var bbox: BezierJs.BBox = bezier.bbox();
|
||||
var closest: BezierJs.Closest = { mdist: 1, mpos: 0 };
|
||||
var inflection: BezierJs.Inflection = { values: null, x: [0], y: [0], z:[0] };
|
||||
var minmax: BezierJs.MinMax = { min: 0, max: 0 };
|
||||
var offset: BezierJs.Offset = { x: 0, y: 0, c: point, n: point };
|
||||
var pair: BezierJs.Pair = { left: bezier, right: bezier };
|
||||
var poly: BezierJs.PolyBezier = bezier.outline(1);
|
||||
var projection: BezierJs.Projection = { x: 0, y: 0, t: 9, d: 4 };
|
||||
var shape: BezierJs.Shape = { startcap: cap, endcap: cap, forward: bezier, back: bezier, bbox: bbox };
|
||||
var split: BezierJs.Split = { left: bezier, right: bezier, span: [point] };
|
||||
|
||||
bezier.arcs();
|
||||
bezier.clockwise;
|
||||
bezier.compute(.5);
|
||||
bezier.computedirection();
|
||||
bezier.curveintersects([bezier], [bezier]);
|
||||
bezier.derivative(0);
|
||||
bezier.get(1);
|
||||
bezier.getLUT()[0].x;
|
||||
bezier.hull(0);
|
||||
bezier.extrema();
|
||||
bezier.intersects(bezier);
|
||||
bezier.length();
|
||||
bezier.lineIntersects(line);
|
||||
bezier.normal(0);
|
||||
bezier.offset(1,2);
|
||||
bezier.on(point, 0);
|
||||
bezier.order = 5;
|
||||
bezier.outlineshapes(1,3);
|
||||
bezier.overlaps(bezier);
|
||||
bezier.point(9);
|
||||
bezier.project(point);
|
||||
bezier.raise();
|
||||
bezier.reduce();
|
||||
bezier.scale(4);
|
||||
bezier.selfintersects();
|
||||
bezier.simple();
|
||||
bezier.split(0, 1).clockwise;
|
||||
bezier.split(0.5).left;
|
||||
bezier.toSVG();
|
||||
bezier.update();
|
||||
|
||||
cap.virtual = true;
|
||||
|
||||
poly.addCurve(bezier);
|
||||
poly.bbox();
|
||||
poly.curve(7);
|
||||
poly.curves[0]._3d;
|
||||
poly.length();
|
||||
poly.offset(9).points[0].y;
|
||||
poly.points[0];
|
||||
|
||||
utils.abcratio(0, 1);
|
||||
utils.align([point], line);
|
||||
utils.angle(point, point, point);
|
||||
utils.approximately(5, 7, .001);
|
||||
utils.arcfn(1, function(){});
|
||||
utils.bboxoverlap(bbox, bbox);
|
||||
utils.between(0, 0, 1);
|
||||
utils.closest([point], point);
|
||||
utils.copy({});
|
||||
utils.dist(point, point);
|
||||
utils.droots([9]);
|
||||
utils.expandbox(bbox, bbox);
|
||||
utils.findbbox([bezier]);
|
||||
utils.getccenter(point, point, point);
|
||||
utils.getminmax(bezier, 'x', [0]);
|
||||
utils.length(function(){});
|
||||
utils.lerp(1, point, point);
|
||||
utils.lli(offset, offset);
|
||||
utils.lli4(point, point, point, point);
|
||||
utils.lli8(0, 0, 0, 0, 0, 0, 0, 0);
|
||||
utils.makeline(point, point);
|
||||
utils.makeshape(bezier, bezier);
|
||||
utils.map(0, 0, 0, 0, 0);
|
||||
utils.pairiteration(bezier, bezier);
|
||||
utils.pointsToString([point]);
|
||||
utils.projectionratio(0, 0);
|
||||
utils.roots([point], line);
|
||||
utils.round(.999, .001);
|
||||
utils.shapeintersections(shape, bbox, shape, bbox);
|
||||
|
||||
}
|
||||
198
bezier-js/bezier-js.d.ts
vendored
Normal file
198
bezier-js/bezier-js.d.ts
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
// Type definitions for Bezier.js
|
||||
// Project: https://github.com/Pomax/bezierjs
|
||||
// Definitions by: Dan Marshall <https://github.com/danmarshall>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module BezierJs {
|
||||
interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
z?: number;
|
||||
}
|
||||
interface Projection extends Point {
|
||||
t?: number;
|
||||
d?: number;
|
||||
}
|
||||
interface Inflection {
|
||||
x: number[];
|
||||
y: number[];
|
||||
z?: number[];
|
||||
values: number[];
|
||||
}
|
||||
interface Offset extends Point {
|
||||
c: Point;
|
||||
n: Point;
|
||||
}
|
||||
interface Pair {
|
||||
left: Bezier;
|
||||
right: Bezier;
|
||||
}
|
||||
interface Split extends Pair {
|
||||
span: Point[];
|
||||
_t1?: number;
|
||||
_t2?: number;
|
||||
}
|
||||
interface MinMax {
|
||||
min: number;
|
||||
mid?: number;
|
||||
max: number;
|
||||
size?: number;
|
||||
}
|
||||
interface BBox {
|
||||
x: MinMax;
|
||||
y: MinMax;
|
||||
z?: MinMax;
|
||||
}
|
||||
interface Line {
|
||||
p1: Point;
|
||||
p2: Point;
|
||||
}
|
||||
interface Arc extends Point {
|
||||
e: number;
|
||||
r: number;
|
||||
s: number;
|
||||
}
|
||||
interface Shape {
|
||||
startcap: BezierCap;
|
||||
forward: Bezier;
|
||||
back: Bezier;
|
||||
endcap: BezierCap;
|
||||
bbox: BBox;
|
||||
}
|
||||
interface ABC {
|
||||
A: Point;
|
||||
B: Point;
|
||||
C: Point;
|
||||
}
|
||||
interface Closest {
|
||||
mdist: number;
|
||||
mpos: number;
|
||||
}
|
||||
/**
|
||||
* Bezier curve constructor. The constructor argument can be one of three things:
|
||||
*
|
||||
* 1. array/4 of {x:..., y:..., z:...}, z optional
|
||||
* 2. numerical array/8 ordered x1,y1,x2,y2,x3,y3,x4,y4
|
||||
* 3. numerical array/12 ordered x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4
|
||||
*
|
||||
*/
|
||||
class Bezier {
|
||||
clockwise: boolean;
|
||||
private _linear;
|
||||
_3d: boolean;
|
||||
_t1: number;
|
||||
_t2: number;
|
||||
_lut: Point[];
|
||||
dpoints: Point[][];
|
||||
order: number;
|
||||
points: Point[];
|
||||
dims: string[];
|
||||
dimlen: number;
|
||||
constructor(points: Point[]);
|
||||
constructor(coords: number[]);
|
||||
constructor(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4?: number, y4?: number);
|
||||
constructor(p1: Point, p2: Point, p3: Point, p4?: Point);
|
||||
static fromSVG(svgString: string): Bezier;
|
||||
static getABC(n: number, S: Point, B: Point, E: Point, t: number): ABC;
|
||||
static quadraticFromPoints(p1: Point, p2: Point, p3: Point, t: number): Bezier;
|
||||
static cubicFromPoints(S: Point, B: Point, E: Point, t: number, d1: number): Bezier;
|
||||
static getUtils(): typeof utils;
|
||||
getUtils(): typeof utils;
|
||||
valueOf(): string;
|
||||
toString(): string;
|
||||
toSVG(): string;
|
||||
update(): void;
|
||||
computedirection(): void;
|
||||
length(): number;
|
||||
getLUT(steps?: number): Point[];
|
||||
on(point: Point, error: number): number;
|
||||
project(point: Point): Projection;
|
||||
get(t: number): Point;
|
||||
point(idx: number): Point;
|
||||
compute(t: number): Point;
|
||||
raise(): Bezier;
|
||||
derivative(t: number): Point;
|
||||
inflections(): number[];
|
||||
normal(t: number): Point;
|
||||
private __normal2(t);
|
||||
private __normal3(t);
|
||||
private __normal(t);
|
||||
hull(t: number): Point[];
|
||||
split(t1: number): Split;
|
||||
split(t1: number, t2: number): Bezier;
|
||||
extrema(): Inflection;
|
||||
bbox(): BBox;
|
||||
overlaps(curve: Bezier): boolean;
|
||||
offset(t: number, d?: number): Offset | Bezier[];
|
||||
simple(): boolean;
|
||||
reduce(): any[];
|
||||
scale(d: Function): Bezier;
|
||||
scale(d: number): Bezier;
|
||||
outline(d1: number, d2?: number, d3?: number, d4?: number): PolyBezier;
|
||||
outlineshapes(d1: number, d2: number): Shape[];
|
||||
intersects(curve: Bezier): string[] | number[];
|
||||
intersects(curve: Line): string[] | number[];
|
||||
lineIntersects(line: Line): number[];
|
||||
selfintersects(): string[];
|
||||
curveintersects(c1: Bezier[], c2: Bezier[]): string[];
|
||||
arcs(errorThreshold?: number): Arc[];
|
||||
private _error(pc, np1, s, e);
|
||||
private _iterate(errorThreshold, circles);
|
||||
}
|
||||
class BezierCap extends Bezier {
|
||||
virtual: boolean;
|
||||
}
|
||||
}
|
||||
declare module BezierJs.utils {
|
||||
var Tvalues: number[];
|
||||
var Cvalues: number[];
|
||||
function arcfn(t: number, derivativeFn: Function): number;
|
||||
function between(v: number, m: number, M: number): boolean;
|
||||
function approximately(a: number, b: number, precision?: number): boolean;
|
||||
function length(derivativeFn: Function): number;
|
||||
function map(v: number, ds: number, de: number, ts: number, te: number): number;
|
||||
function lerp(r: number, v1: Point, v2: Point): Point;
|
||||
function pointToString(p: Point): string;
|
||||
function pointsToString(points: Point[]): string;
|
||||
function copy(obj: Object): any;
|
||||
function angle(o: Point, v1: Point, v2: Point): number;
|
||||
function round(v: number, d: number): number;
|
||||
function dist(p1: Point, p2: Point): number;
|
||||
function closest(LUT: Point[], point: Point): Closest;
|
||||
function abcratio(t: number, n: number): number;
|
||||
function projectionratio(t: number, n: number): number;
|
||||
function lli8(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number): Point;
|
||||
function lli4(p1: Point, p2: Point, p3: Point, p4: Point): Point;
|
||||
function lli(v1: Offset, v2: Offset): Point;
|
||||
function makeline(p1: Point, p2: Point): Bezier;
|
||||
function findbbox(sections: Bezier[]): BBox;
|
||||
function shapeintersections(s1: Shape, bbox1: BBox, s2: Shape, bbox2: BBox): string[][] | number[][];
|
||||
function makeshape(forward: Bezier, back: Bezier): Shape;
|
||||
function getminmax(curve: Bezier, d: string, list: number[]): MinMax;
|
||||
function align(points: Point[], line: Line): Point[];
|
||||
function roots(points: Point[], line: Line): number[];
|
||||
function droots(p: number[]): number[];
|
||||
function inflections(points: Point[]): number[];
|
||||
function bboxoverlap(b1: BBox, b2: BBox): boolean;
|
||||
function expandbox(bbox: BBox, _bbox: BBox): void;
|
||||
function pairiteration(c1: Bezier, c2: Bezier): string[];
|
||||
function getccenter(p1: Point, p2: Point, p3: Point): Arc;
|
||||
}
|
||||
declare module BezierJs {
|
||||
/**
|
||||
* Poly Bezier
|
||||
* @param {[type]} curves [description]
|
||||
*/
|
||||
class PolyBezier {
|
||||
curves: Bezier[];
|
||||
private _3d;
|
||||
points: Point[];
|
||||
constructor(curves: Bezier[]);
|
||||
valueOf(): string;
|
||||
toString(): string;
|
||||
addCurve(curve: Bezier): void;
|
||||
length(): number;
|
||||
curve(idx: number): Bezier;
|
||||
bbox(): BBox;
|
||||
offset(d: number): PolyBezier;
|
||||
}
|
||||
}
|
||||
14
bingmaps/Microsoft.Maps.d.ts
vendored
14
bingmaps/Microsoft.Maps.d.ts
vendored
@ -174,6 +174,7 @@ declare namespace Microsoft.Maps {
|
||||
fixedMapPosition?: boolean;
|
||||
height?: number;
|
||||
inertiaIntensity?: number;
|
||||
navigationBarMode?: number;
|
||||
showBreadcrumb?: boolean;
|
||||
showCopyright?: boolean;
|
||||
showDashboard?: boolean;
|
||||
@ -216,6 +217,12 @@ declare namespace Microsoft.Maps {
|
||||
getY(): number;
|
||||
}
|
||||
|
||||
export enum NavigationBarMode {
|
||||
default,
|
||||
compact,
|
||||
minified
|
||||
}
|
||||
|
||||
export enum PixelReference {
|
||||
control,
|
||||
page,
|
||||
@ -301,12 +308,13 @@ declare namespace Microsoft.Maps {
|
||||
getShowPointer(): boolean;
|
||||
getTitle(): string;
|
||||
getTitleAction(): any;
|
||||
getTitleClickHandler(): () => void;
|
||||
getTitleClickHandler(): (mouseEvent?: MouseEvent) => void;
|
||||
getVisible(): boolean;
|
||||
getWidth(): number;
|
||||
getZIndex(): number;
|
||||
setHtmlContent(content: string): void;
|
||||
setLocation(location: Location): void;
|
||||
setMap(map: Map): void;
|
||||
setOptions(options: InfoboxOptions): void;
|
||||
toString(): string;
|
||||
}
|
||||
@ -329,8 +337,8 @@ declare namespace Microsoft.Maps {
|
||||
showPointer?: boolean;
|
||||
pushpin?: Pushpin;
|
||||
title?: string;
|
||||
titleAction?: { label?: string; eventHandler: () => void; };
|
||||
titleClickHandler?: () => void;
|
||||
titleAction?: { label?: string; eventHandler: (mouseEvent?: MouseEvent) => void; };
|
||||
titleClickHandler?: (mouseEvent?: MouseEvent) => void;
|
||||
typeName?: InfoboxType;
|
||||
visible?: boolean;
|
||||
width?: number;
|
||||
|
||||
4
body-parser/body-parser.d.ts
vendored
4
body-parser/body-parser.d.ts
vendored
@ -33,7 +33,7 @@ declare module "body-parser" {
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
reviver?: (key: string, value: any) => any;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
@ -65,7 +65,7 @@ declare module "body-parser" {
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
reviver?: (key: string, value: any) => any;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function raw(options?: {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
90
bookshelf/bookshelf.d.ts
vendored
90
bookshelf/bookshelf.d.ts
vendored
@ -6,23 +6,25 @@
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path='../lodash/lodash-3.10.d.ts' />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
/// <reference path="../create-error/create-error.d.ts" />
|
||||
|
||||
declare module 'bookshelf' {
|
||||
import knex = require('knex');
|
||||
import Promise = require('bluebird');
|
||||
import Lodash = require('lodash');
|
||||
import * as Knex from 'knex';
|
||||
import * as Promise from 'bluebird';
|
||||
import * as Lodash from 'lodash';
|
||||
import * as createError from 'create-error';
|
||||
|
||||
interface Bookshelf extends Bookshelf.Events<any> {
|
||||
VERSION : string;
|
||||
knex : knex;
|
||||
knex : Knex;
|
||||
Model : typeof Bookshelf.Model;
|
||||
Collection : typeof Bookshelf.Collection;
|
||||
|
||||
plugin(name: string | string[] | Function, options?: any) : Bookshelf;
|
||||
transaction<T>(callback : (transaction : knex.Transaction) => T) : Promise<T>;
|
||||
transaction<T>(callback : (transaction : Knex.Transaction) => T) : T;
|
||||
}
|
||||
|
||||
function Bookshelf(knex : knex) : Bookshelf;
|
||||
function Bookshelf(knex : Knex) : Bookshelf;
|
||||
|
||||
namespace Bookshelf {
|
||||
abstract class Events<T> {
|
||||
@ -44,6 +46,13 @@ declare module 'bookshelf' {
|
||||
/** If overriding, must use a getter instead of a plain property. */
|
||||
idAttribute : string;
|
||||
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/base/model.js#L178
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/base/model.js#L213
|
||||
id : any;
|
||||
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/base/model.js#L28
|
||||
attributes : any;
|
||||
|
||||
constructor(attributes? : any, options? : ModelOptions);
|
||||
|
||||
clear() : T;
|
||||
@ -54,7 +63,7 @@ declare module 'bookshelf' {
|
||||
has(attribute : string) : boolean;
|
||||
hasChanged(attribute? : string) : boolean;
|
||||
isNew() : boolean;
|
||||
parse(response : any) : any;
|
||||
parse(response : Object) : Object;
|
||||
previousAttributes() : any;
|
||||
previous(attribute : string) : any;
|
||||
related<R extends Model<any>>(relation : string) : R | Collection<R>;
|
||||
@ -88,7 +97,7 @@ declare module 'bookshelf' {
|
||||
belongsTo<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
belongsToMany<R extends Model<any>>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection<R>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
destroy(options? : SyncOptions) : Promise<T>;
|
||||
destroy(options? : DestroyOptions) : Promise<T>;
|
||||
fetch(options? : FetchOptions) : Promise<T>;
|
||||
fetchAll(options? : FetchAllOptions) : Promise<Collection<T>>;
|
||||
hasMany<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : Collection<R>;
|
||||
@ -98,20 +107,35 @@ declare module 'bookshelf' {
|
||||
morphOne<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : R;
|
||||
morphTo(name : string, columnNames? : string[], ...target : typeof Model[]) : T;
|
||||
morphTo(name : string, ...target : typeof Model[]) : T;
|
||||
|
||||
// Declaration order matters otherwise TypeScript gets confused between query() and query(...query: string[])
|
||||
query() : Knex.QueryBuilder;
|
||||
query(callback : (qb : Knex.QueryBuilder) => void) : T;
|
||||
query(...query : string[]) : T;
|
||||
query(query : {[key : string] : any}) : T;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : T;
|
||||
query() : knex.QueryBuilder;
|
||||
|
||||
refresh(options? : FetchOptions) : Promise<T>;
|
||||
resetQuery() : T;
|
||||
save(key? : string, val? : string, options? : SaveOptions) : Promise<T>;
|
||||
save(key? : string, val? : any, options? : SaveOptions) : Promise<T>;
|
||||
save(attrs? : {[key : string] : any}, options? : SaveOptions) : Promise<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R;
|
||||
where(properties : {[key : string] : any}) : T;
|
||||
where(key : string, operatorOrValue : string|number|boolean, valueIfOperator? : string|number|boolean) : T;
|
||||
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/errors.js
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/model.js#L1280
|
||||
static NotFoundError: createError.Error<Error>;
|
||||
static NoRowsUpdatedError: createError.Error<Error>;
|
||||
static NoRowsDeletedError: createError.Error<Error>;
|
||||
}
|
||||
|
||||
abstract class CollectionBase<T extends Model<any>> extends Events<T> {
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/base/collection.js#L573
|
||||
length : number;
|
||||
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/base/collection.js#L21
|
||||
constructor(models? : T[], options? : CollectionOptions<T>);
|
||||
|
||||
add(models : T[]|{[key : string] : any}[], options? : CollectionAddOptions) : Collection<T>;
|
||||
at(index : number) : T;
|
||||
clone() : Collection<T>;
|
||||
@ -127,11 +151,11 @@ declare module 'bookshelf' {
|
||||
remove(model : T, options? : EventOptions) : T;
|
||||
remove(model : T[], options? : EventOptions) : T[];
|
||||
reset(model : any[], options? : CollectionAddOptions) : T[];
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
serialize(options? : SerializeOptions) : any[];
|
||||
set(models : T[]|{[key : string] : any}[], options? : CollectionSetOptions) : Collection<T>;
|
||||
shift(options? : EventOptions) : void;
|
||||
slice(begin? : number, end? : number) : void;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
toJSON(options? : SerializeOptions) : any[];
|
||||
unshift(model : any, options? : CollectionAddOptions) : void;
|
||||
where(match : {[key : string] : any}, firstOnly : boolean) : T|Collection<T>;
|
||||
|
||||
@ -177,8 +201,13 @@ declare module 'bookshelf' {
|
||||
keys() : string[];
|
||||
last() : T;
|
||||
lastIndexOf(value : any, fromIndex? : number) : number;
|
||||
map(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
map<R extends {}>(predicate? : R) : T[];
|
||||
|
||||
// See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1ec3d51/lodash/lodash-3.10.d.ts#L7119
|
||||
// See https://github.com/Microsoft/TypeScript/blob/v1.8.10/lib/lib.core.es7.d.ts#L1122
|
||||
map<U>(predicate? : Lodash.ListIterator<T, U>|string, thisArg? : any) : U[];
|
||||
map<U>(predicate? : Lodash.DictionaryIterator<T, U>|string, thisArg? : any) : U[];
|
||||
map<U>(predicate? : string) : U[];
|
||||
|
||||
max(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
max<R extends {}>(predicate? : R) : T;
|
||||
min(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
@ -208,20 +237,27 @@ declare module 'bookshelf' {
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
attach(ids : any[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
attach(ids : any|any[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
create(model : {[key : string] : any}, options? : CollectionCreateOptions) : Promise<T>;
|
||||
detach(ids : any[], options? : SyncOptions) : Promise<any>;
|
||||
detach(options? : SyncOptions) : Promise<any>;
|
||||
fetchOne(options? : CollectionFetchOneOptions) : Promise<T>;
|
||||
load(relations : string|string[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
|
||||
// Declaration order matters otherwise TypeScript gets confused between query() and query(...query: string[])
|
||||
query() : Knex.QueryBuilder;
|
||||
query(callback : (qb : Knex.QueryBuilder) => void) : Collection<T>;
|
||||
query(...query : string[]) : Collection<T>;
|
||||
query(query : {[key : string] : any}) : Collection<T>;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : Collection<T>;
|
||||
query() : knex.QueryBuilder;
|
||||
|
||||
resetQuery() : Collection<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : Collection<R>;
|
||||
updatePivot(attributes : any, options? : PivotOptions) : Promise<number>;
|
||||
withPivot(columns : string[]) : Collection<T>;
|
||||
|
||||
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/collection.js#L389
|
||||
static EmptyError: createError.Error<Error>;
|
||||
}
|
||||
|
||||
interface ModelOptions {
|
||||
@ -231,13 +267,17 @@ declare module 'bookshelf' {
|
||||
}
|
||||
|
||||
interface LoadOptions extends SyncOptions {
|
||||
withRelated: string|any|any[];
|
||||
withRelated : (string|WithRelatedQuery)[];
|
||||
}
|
||||
|
||||
interface FetchOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
withRelated? : string|any|any[];
|
||||
withRelated? : (string|WithRelatedQuery)[];
|
||||
}
|
||||
|
||||
interface WithRelatedQuery {
|
||||
[index : string] : (query : Knex.QueryBuilder) => Knex.QueryBuilder;
|
||||
}
|
||||
|
||||
interface FetchAllOptions extends SyncOptions {
|
||||
@ -251,6 +291,10 @@ declare module 'bookshelf' {
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface DestroyOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SerializeOptions {
|
||||
shallow? : boolean;
|
||||
omitPivot? : boolean;
|
||||
@ -265,7 +309,7 @@ declare module 'bookshelf' {
|
||||
}
|
||||
|
||||
interface SyncOptions {
|
||||
transacting? : knex.Transaction;
|
||||
transacting? : Knex.Transaction;
|
||||
debug? : boolean;
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* http://bootstrap-datepicker.readthedocs.org/en/release/options.html
|
||||
*/
|
||||
interface DatepickerOptions {
|
||||
format?: string;
|
||||
format?: string | DatepickerCustomFormatOptions;
|
||||
weekStart?: number;
|
||||
startDate?: any;
|
||||
endDate?: any;
|
||||
@ -38,6 +38,11 @@ interface DatepickerOptions {
|
||||
assumeNearbyYear?: any;
|
||||
}
|
||||
|
||||
interface DatepickerCustomFormatOptions {
|
||||
toDisplay?(date: string, format: any, language: any): string;
|
||||
toValue?(date: string, format: any, language: any): Date;
|
||||
}
|
||||
|
||||
interface DatepickerEventObject extends JQueryEventObject {
|
||||
date: Date;
|
||||
format(format?: string): string;
|
||||
|
||||
@ -44,3 +44,8 @@ $('.typeahead').typeahead({
|
||||
});
|
||||
|
||||
$('#navbar').affix();
|
||||
|
||||
$('.item').emulateTransitionEnd(2000);
|
||||
|
||||
$.support.transition = false;
|
||||
console.log(($.support.transition as TransitionEventNames).end === "transitionend");
|
||||
|
||||
12
bootstrap/bootstrap.d.ts
vendored
12
bootstrap/bootstrap.d.ts
vendored
@ -53,7 +53,7 @@ interface PopoverOptions {
|
||||
}
|
||||
|
||||
interface CollapseOptions {
|
||||
parent?: any;
|
||||
parent?: any;
|
||||
toggle?: boolean;
|
||||
}
|
||||
|
||||
@ -79,6 +79,10 @@ interface AffixOptions {
|
||||
target?: any;
|
||||
}
|
||||
|
||||
interface TransitionEventNames {
|
||||
end: string;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
modal(options?: ModalOptions): JQuery;
|
||||
modal(options?: ModalOptionsBackdropString): JQuery;
|
||||
@ -114,6 +118,12 @@ interface JQuery {
|
||||
typeahead(options?: TypeaheadOptions): JQuery;
|
||||
|
||||
affix(options?: AffixOptions): JQuery;
|
||||
|
||||
emulateTransitionEnd(duration: number): JQuery;
|
||||
}
|
||||
|
||||
interface JQuerySupport {
|
||||
transition: boolean | TransitionEventNames;
|
||||
}
|
||||
|
||||
declare module "bootstrap" {
|
||||
|
||||
33
browser-pack/browser-pack-tests.ts
Normal file
33
browser-pack/browser-pack-tests.ts
Normal file
@ -0,0 +1,33 @@
|
||||
/// <reference path="browser-pack.d.ts" />
|
||||
|
||||
import browserPack = require("browser-pack");
|
||||
|
||||
module BrowserPackTest {
|
||||
|
||||
export function packIt(opts?: BrowserPack.Options) {
|
||||
var packOpts: BrowserPack.Options = {
|
||||
basedir: opts.basedir || "./",
|
||||
externalRequireName: opts.externalRequireName || "require",
|
||||
hasExports: opts.hasExports || false,
|
||||
prelude: opts.prelude || undefined,
|
||||
preludePath: opts.preludePath || undefined,
|
||||
raw: opts.raw || false,
|
||||
sourceMapPrefix: opts.sourceMapPrefix || '//#',
|
||||
standalone: opts.standalone || undefined,
|
||||
standaloneModule: opts.standaloneModule || undefined,
|
||||
};
|
||||
|
||||
var res = browserPack(); // 'opts' are optional
|
||||
var res2 = browserPack(packOpts);
|
||||
|
||||
// ensure return value is a stream
|
||||
var res3 = res.pipe(res2);
|
||||
|
||||
res.on("error", function (err: any) {
|
||||
console.error("browser-pack error: ", err);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export = BrowserPackTest;
|
||||
61
browser-pack/browser-pack.d.ts
vendored
Normal file
61
browser-pack/browser-pack.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
// Type definitions for browser-pack v6.0.1
|
||||
// Project: https://github.com/substack/browser-pack
|
||||
// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
/** pack node-style source files from a json stream into a browser bundle
|
||||
*/
|
||||
declare module BrowserPack {
|
||||
|
||||
export interface Options {
|
||||
/** Whether the bundle should include require= (or the opts.externalRequireName) so that
|
||||
* require() is available outside the bundle
|
||||
*/
|
||||
hasExports?: boolean;
|
||||
|
||||
/** A string to use in place of 'require' if opts.hasExports is specified, default is 'require'
|
||||
*/
|
||||
externalRequireName?: string;
|
||||
|
||||
/** Specify a custom prelude, but know what you're doing first. See the prelude.js file in
|
||||
* this repo for the default prelude. If you specify a custom prelude, you must also specify
|
||||
* a valid opts.preludePath to the prelude source file for sourcemaps to work
|
||||
*/
|
||||
prelude?: string;
|
||||
|
||||
/** prelude.js path if a custom opts.prelude is specified
|
||||
*/
|
||||
preludePath?: string;
|
||||
|
||||
/** Used if opts.preludePath is undefined, this is used to resolve the prelude.js file location, default: 'process.cwd()'
|
||||
*/
|
||||
basedir?: string;
|
||||
|
||||
/** if given, the writable end of the stream will expect objects to be written to
|
||||
* it instead of expecting a stream of json text it will need to parse, default false
|
||||
*/
|
||||
raw?: boolean;
|
||||
|
||||
/** External string name to use for UMD, if not provided, UMD declaration is not wrapped around output
|
||||
*/
|
||||
standalone?: string;
|
||||
|
||||
/** Sets the internal module name to export for standalone
|
||||
*/
|
||||
standaloneModule?: string;
|
||||
|
||||
/** If given and source maps are computed, the opts.sourceMapPrefix string will be used instead of default: '//#'
|
||||
*/
|
||||
sourceMapPrefix?: string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "browser-pack" {
|
||||
/** pack node-style source files from a json stream into a browser bundle
|
||||
*/
|
||||
function browserPack(opts?: BrowserPack.Options): NodeJS.ReadWriteStream;
|
||||
export = browserPack;
|
||||
}
|
||||
39
browser-resolve/browser-resolve-tests.ts
Normal file
39
browser-resolve/browser-resolve-tests.ts
Normal file
@ -0,0 +1,39 @@
|
||||
/// <reference path="./browser-resolve.d.ts" />
|
||||
|
||||
import * as browserResolve from 'browser-resolve';
|
||||
|
||||
function basic_test_async(callback: (err?: Error, resolved?: string) => void) {
|
||||
browserResolve('typescript', function(error, resolved) {
|
||||
if (error) {
|
||||
return callback(error);
|
||||
}
|
||||
callback(null, resolved);
|
||||
});
|
||||
}
|
||||
|
||||
function basic_test_sync() {
|
||||
var resolved = browserResolve.sync('typescript');
|
||||
}
|
||||
|
||||
function options_test_async() {
|
||||
browserResolve('typescript', {
|
||||
browser: 'jsnext:main',
|
||||
filename: './browser-resolve/browser-resolve.js',
|
||||
modules: {
|
||||
fs: './fs-shim.js'
|
||||
}
|
||||
}, function(error, resolved) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
return;
|
||||
}
|
||||
console.log(resolved);
|
||||
});
|
||||
}
|
||||
|
||||
function options_test_sync() {
|
||||
var resolved = browserResolve.sync('typescript', {
|
||||
filename: './browser-resolve/browser-resolve.js',
|
||||
modules: {}
|
||||
});
|
||||
}
|
||||
61
browser-resolve/browser-resolve.d.ts
vendored
Normal file
61
browser-resolve/browser-resolve.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
// Type definitions for browser-resolve
|
||||
// Project: https://github.com/defunctzombie/node-browser-resolve
|
||||
// Definitions by: Mario Nebl <https://github.com/marionebl/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../resolve/resolve.d.ts" />
|
||||
|
||||
declare module 'browser-resolve' {
|
||||
import * as resolve from 'resolve';
|
||||
|
||||
/**
|
||||
* Callback invoked when resolving asynchronously
|
||||
*
|
||||
* @param error
|
||||
* @param resolved Absolute path to resolved identifier
|
||||
*/
|
||||
type resolveCallback = (err?: Error, resolved?: string) => void;
|
||||
|
||||
/**
|
||||
* Resolve a module path and call cb(err, path [, pkg])
|
||||
*
|
||||
* @param id Identifier to resolve
|
||||
* @param callback
|
||||
*/
|
||||
function browserResolve(id: string, cb: resolveCallback): void;
|
||||
|
||||
/**
|
||||
* Resolve a module path and call cb(err, path [, pkg])
|
||||
*
|
||||
* @param id Identifier to resolve
|
||||
* @param options Options to use for resolving, optional.
|
||||
* @param callback
|
||||
*/
|
||||
function browserResolve(id: string, opts: browserResolve.AsyncOpts, cb: resolveCallback): void;
|
||||
|
||||
/**
|
||||
* Returns a module path
|
||||
*
|
||||
* @param id Identifier to resolve
|
||||
* @param options Options to use for resolving, optional.
|
||||
*/
|
||||
function browserResolveSync(id: string, opts?: browserResolve.SyncOpts): string;
|
||||
|
||||
namespace browserResolve {
|
||||
interface Opts {
|
||||
// the 'browser' property to use from package.json (defaults to 'browser')
|
||||
browser?: string;
|
||||
// the calling filename where the require() call originated (in the source)
|
||||
filename?: string;
|
||||
// modules object with id to path mappings to consult before doing manual resolution (use to provide core modules)
|
||||
modules?: any;
|
||||
}
|
||||
|
||||
export interface AsyncOpts extends resolve.AsyncOpts, Opts {}
|
||||
export interface SyncOpts extends resolve.SyncOpts, Opts {}
|
||||
|
||||
export var sync: typeof browserResolveSync;
|
||||
}
|
||||
|
||||
export = browserResolve
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/// <reference path="./browser-sync.d.ts"/>
|
||||
import browserSync = require("browser-sync");
|
||||
import * as browserSync from "browser-sync";
|
||||
|
||||
(() => {
|
||||
//make sure that the interfaces are correctly exposed
|
||||
|
||||
27
browser-sync/browser-sync.d.ts
vendored
27
browser-sync/browser-sync.d.ts
vendored
@ -8,10 +8,10 @@
|
||||
/// <reference path="../micromatch/micromatch.d.ts" />
|
||||
|
||||
declare module "browser-sync" {
|
||||
import chokidar = require("chokidar");
|
||||
import fs = require("fs");
|
||||
import http = require("http");
|
||||
import mm = require("micromatch");
|
||||
import * as chokidar from "chokidar";
|
||||
import * as fs from "fs";
|
||||
import * as http from "http";
|
||||
import * as mm from "micromatch";
|
||||
|
||||
namespace browserSync {
|
||||
interface Options {
|
||||
@ -23,14 +23,14 @@ declare module "browser-sync" {
|
||||
* weinre.port - Default: 8080
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
ui?: UIOptions;
|
||||
ui?: UIOptions | boolean;
|
||||
/**
|
||||
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
|
||||
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
|
||||
* patterns.
|
||||
* Default: false
|
||||
*/
|
||||
files?: string | string[];
|
||||
files?: string | (string | FileCallback)[];
|
||||
/**
|
||||
* File watching options that get passed along to Chokidar. Check their docs for available options
|
||||
* Default: undefined
|
||||
@ -245,7 +245,7 @@ declare module "browser-sync" {
|
||||
* Note: requires at least version 1.6.2
|
||||
*/
|
||||
socket?: SocketOptions;
|
||||
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
||||
middleware?: MiddlewareHandler | PerRouteMiddleware | (MiddlewareHandler | PerRouteMiddleware)[];
|
||||
}
|
||||
|
||||
interface Hash<T> {
|
||||
@ -261,6 +261,12 @@ declare module "browser-sync" {
|
||||
};
|
||||
}
|
||||
|
||||
interface FileCallback {
|
||||
match?: string | string[];
|
||||
fn: (event: string, file: string) => any;
|
||||
options?: chokidar.WatchOptions;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
/** set base directory */
|
||||
baseDir?: string | string[];
|
||||
@ -274,7 +280,7 @@ declare module "browser-sync" {
|
||||
*/
|
||||
routes?: Hash<string>;
|
||||
/** configure custom middleware */
|
||||
middleware?: MiddlewareHandler[];
|
||||
middleware?: (MiddlewareHandler | PerRouteMiddleware)[];
|
||||
}
|
||||
|
||||
interface ProxyOptions {
|
||||
@ -289,6 +295,11 @@ declare module "browser-sync" {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface PerRouteMiddleware {
|
||||
route: string;
|
||||
handle: MiddlewareHandler;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
|
||||
5
bytebuffer/bytebuffer.d.ts
vendored
5
bytebuffer/bytebuffer.d.ts
vendored
@ -91,7 +91,7 @@ declare class ByteBuffer
|
||||
/**
|
||||
* Data view to manipulate the backing buffer. Becomes null if the backing buffer has a capacity of 0.
|
||||
*/
|
||||
view: DataView;
|
||||
view: DataView;
|
||||
|
||||
/**
|
||||
* Allocates a new ByteBuffer backed by a buffer of the specified capacity.
|
||||
@ -424,7 +424,7 @@ declare class ByteBuffer
|
||||
|
||||
/**
|
||||
* Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that large or larger.
|
||||
*/
|
||||
*/
|
||||
resize( capacity: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
@ -611,6 +611,5 @@ declare class ByteBuffer
|
||||
}
|
||||
|
||||
declare module 'bytebuffer' {
|
||||
namespace ByteBuffer {}
|
||||
export = ByteBuffer;
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ function legend_examples() {
|
||||
},
|
||||
item: {
|
||||
onclick: function(id) { /* code */ },
|
||||
onmoouseover: function(id) { /* code */ },
|
||||
onmouseover: function(id) { /* code */ },
|
||||
onmouseout: function(id) { /* code */ },
|
||||
}
|
||||
}
|
||||
|
||||
2
c3/c3.d.ts
vendored
2
c3/c3.d.ts
vendored
@ -650,7 +650,7 @@ declare namespace c3 {
|
||||
/**
|
||||
* Set mouseover event handler to the legend item.
|
||||
*/
|
||||
onmoouseover?: (id: any) => void;
|
||||
onmouseover?: (id: any) => void;
|
||||
/**
|
||||
* Set mouseout event handler to the legend item.
|
||||
*/
|
||||
|
||||
34
cachefactory/cachefactory-tests.ts
Normal file
34
cachefactory/cachefactory-tests.ts
Normal file
@ -0,0 +1,34 @@
|
||||
/// <reference path="cachefactory.d.ts" />
|
||||
|
||||
CacheFactory.get('test');
|
||||
|
||||
CacheFactory.createCache('test', {
|
||||
deleteOnExpire: 'aggressive',
|
||||
recycleFreq: 60000
|
||||
});
|
||||
|
||||
let testCache = CacheFactory.get('test');
|
||||
|
||||
testCache.put('testOne', {title: 'testOne', id: 1});
|
||||
|
||||
let item = testCache.get('testOne');
|
||||
|
||||
|
||||
let profileCache = CacheFactory('profileCache', {
|
||||
maxAge: 60 * 60 * 1000,
|
||||
deleteOnExpire: 'aggressive'
|
||||
});
|
||||
|
||||
let localStoragePolyfill = {
|
||||
getItem: (key: string) => { return ""; },
|
||||
setItem: (key: string, value: string) => { },
|
||||
removeItem: (key: string) => { }
|
||||
};
|
||||
|
||||
let myAwesomeCache = CacheFactory('myAwesomeCache', {
|
||||
maxAge: 15 * 60 * 1000,
|
||||
cacheFlushInterval: 60 * 60 * 1000,
|
||||
deleteOnExpire: 'aggressive',
|
||||
storageMode: 'localStorage',
|
||||
storageImpl: localStoragePolyfill
|
||||
});
|
||||
443
cachefactory/cachefactory.d.ts
vendored
Normal file
443
cachefactory/cachefactory.d.ts
vendored
Normal file
@ -0,0 +1,443 @@
|
||||
// Type definitions for CacheFactory 1.4.0
|
||||
// Project: https://github.com/jmdobry/CacheFactory
|
||||
// Definitions by: Vaggelis Mparmpas <https://github.com/vag1830>, Daniel Massa <https://github.com/danielmassa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module CacheFactory {
|
||||
export interface IStoreImplementation {
|
||||
getItem(key: string): string;
|
||||
|
||||
setItem(key: string, value: string): void;
|
||||
|
||||
removeItem(key: string): void;
|
||||
}
|
||||
|
||||
export interface CacheGetOptions {
|
||||
/*
|
||||
* A callback function to be executed whenever an expired item is removed from a cache when the cache is in passive
|
||||
* or aggressive mode. Will be passed the key and value of the expired item.
|
||||
*
|
||||
* Will be passed a third done argument if the cache is in passive mode. This allows you to synchronously access the
|
||||
* key and value of the expired item when you make the cache#get(key[, options]) call that is the reason the expired
|
||||
* item is being removed in the first place. Default: null.
|
||||
*/
|
||||
onExpire?(key: string, value: any): any;
|
||||
}
|
||||
|
||||
export interface CachePutOptions {
|
||||
/*
|
||||
* The number of milliseconds until a newly inserted item expires. Default: Number.MAX_VALUE.
|
||||
*/
|
||||
maxAge?: number;
|
||||
|
||||
/*
|
||||
* If inserting a promise into a cache, also insert the rejection value if the promise rejects. Default: false.
|
||||
*/
|
||||
storeOnReject?: boolean;
|
||||
|
||||
/*
|
||||
* If inserting a promise into a cache, also insert the resolved value if the promise resolves. Default: false.
|
||||
*/
|
||||
storeOnResolve?: boolean;
|
||||
|
||||
created?: Date;
|
||||
access?: Date;
|
||||
expires?: Date;
|
||||
}
|
||||
|
||||
export interface CacheTouchOptions extends CachePutOptions { }
|
||||
|
||||
export interface CacheOptions {
|
||||
/*
|
||||
* If set, remove all items from a cache on an interval after the given number of milliseconds. Default: null.
|
||||
*/
|
||||
cacheFlushInterval?: number;
|
||||
|
||||
/*
|
||||
* Maximum number of items a cache can hold. Adding more items than the capacity will cause the cache to operate
|
||||
* like an LRU cache, removing the least recently used items to stay under capacity. Default: Number.MAX_VALUE.
|
||||
*/
|
||||
|
||||
capacity?: number;
|
||||
|
||||
/*
|
||||
* Determines the behavior of a cache when an item expires. Default: none.
|
||||
*
|
||||
* Possible values:
|
||||
*
|
||||
* none - cache will do nothing when an item expires.
|
||||
* passive - cache will do nothing when an item expires. Expired items will remain in the cache until requested,
|
||||
* at which point they are removed, and undefined is returned.
|
||||
* aggressive - cache will remove expired items as soon as they are discovered.
|
||||
*/
|
||||
deleteOnExpire?: string;
|
||||
|
||||
/*
|
||||
* Determines whether a cache is disabled. Default: false.
|
||||
*/
|
||||
disabled?: boolean;
|
||||
|
||||
/*
|
||||
* The number of milliseconds until a newly inserted item expires. Default: Number.MAX_VALUE.
|
||||
*/
|
||||
maxAge?: number;
|
||||
|
||||
/*
|
||||
* Determines how often a cache will scan for expired items when in aggressive mode. Default: 1000 (milliseconds).
|
||||
*/
|
||||
recycleFreq?: number;
|
||||
|
||||
/*
|
||||
* If inserting a promise into a cache, also insert the rejection value if the promise rejects. Default: false.
|
||||
*/
|
||||
storeOnReject?: boolean;
|
||||
|
||||
/*
|
||||
* If inserting a promise into a cache, also insert the resolved value if the promise resolves. Default: false.
|
||||
*/
|
||||
storeOnResolve?: boolean;
|
||||
|
||||
/*
|
||||
* Provide a custom storage medium, e.g. a polyfill for localStorage. Default: null.
|
||||
*
|
||||
* Must implement:
|
||||
*
|
||||
* setItem - Same API as localStorage.setItem(key, value)
|
||||
* getItem - Same API as localStorage.getItem(key)
|
||||
* removeItem - Same API as localStorage.removeItem(key)
|
||||
*/
|
||||
storageImpl?: IStoreImplementation;
|
||||
|
||||
/*
|
||||
* Determines the storage medium used by a cache. Default: memory.
|
||||
*
|
||||
* Possible values:
|
||||
*
|
||||
* memory - cache will hold data in memory. Data is cleared when the page is refreshed.
|
||||
* localStorage - cache will hold data in localStorage if available. Data is not cleared when the page is refreshed.
|
||||
* sessionStorage - cache will hold data in sessionStorage if available. Data is not cleared when the page is refreshed.
|
||||
*/
|
||||
storageMode?: string;
|
||||
|
||||
/*
|
||||
* Determines the namespace of a cache when storageMode is set to localStorage or sessionStorage. Make it a shorter
|
||||
* string to save space. Default: angular-cache.caches.
|
||||
*/
|
||||
storagePrefix?: string;
|
||||
|
||||
/*
|
||||
* A callback function to be executed whenever an expired item is removed from a cache when the cache is in passive
|
||||
* or aggressive mode. Will be passed the key and value of the expired item.
|
||||
*
|
||||
* Will be passed a third done argument if the cache is in passive mode. This allows you to synchronously access the
|
||||
* key and value of the expired item when you make the cache#get(key[, options]) call that is the reason the expired
|
||||
* item is being removed in the first place. Default: null.
|
||||
*/
|
||||
onExpire?(key: string, value: any): any;
|
||||
}
|
||||
|
||||
export interface ICache {
|
||||
|
||||
$$id: string;
|
||||
|
||||
/**
|
||||
* Return the item with the given key.options, if provided, must be an object.
|
||||
*
|
||||
* If the cache is in passive mode, then options.onExpire can be a function that will be called with the key
|
||||
* and value of the requested item if the requested item is expired, with the get call itself returning undefined.
|
||||
* @param key
|
||||
* @returns {}
|
||||
*/
|
||||
get<T>(key: string, options?: CacheGetOptions): T;
|
||||
|
||||
/**
|
||||
* Insert the item with the given key and value into the cache.options, if provided, must be an object.
|
||||
*
|
||||
* If inserting a promise, options.storeOnReject determines whether to insert the rejection value if the promise
|
||||
* rejects (overriding the default storeOnReject setting for the cache). If inserting a promise, options.storeOnResolve
|
||||
* determines whether to insert the resolved value if the promise resolves (overriding the default storeOnResolve setting for the cache).
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @param options
|
||||
*/
|
||||
put<T>(key: string, value: T, options?: CachePutOptions): void;
|
||||
|
||||
/**
|
||||
* Remove and return the item with the given key, if it is in the cache.
|
||||
* @param key
|
||||
* @returns {}
|
||||
*/
|
||||
remove<T>(key: string): T;
|
||||
|
||||
/**
|
||||
* Remove all items in the cache.
|
||||
*/
|
||||
removeAll(): void;
|
||||
|
||||
/**
|
||||
* Remove and return all expired items in the cache.
|
||||
* @returns {}
|
||||
*/
|
||||
removeExpired(): { [key: string]: any };
|
||||
|
||||
/**
|
||||
* Completely destroy this cache and its data.
|
||||
* @returns {}
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Returns an object containing information about the cache.
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
info(): CacheInfo;
|
||||
|
||||
/**
|
||||
* Returns an object containing information about the item with the given key, if the item is in the cache.
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
info(key: string): CacheItemInfo;
|
||||
|
||||
/**
|
||||
* Return the keys of all items in the cache as an object.
|
||||
* @returns {}
|
||||
*/
|
||||
keySet(): any;
|
||||
|
||||
/**
|
||||
* Return the keys of all items in the cache as an array.
|
||||
* @returns []
|
||||
*/
|
||||
keys(): Array<string>;
|
||||
|
||||
/**
|
||||
* Enable the cache.
|
||||
*/
|
||||
enable(): void;
|
||||
|
||||
/**
|
||||
* Disable the cache.
|
||||
*/
|
||||
disable(): void;
|
||||
|
||||
/**
|
||||
* cache#touch() will "touch" all items in the cache.
|
||||
* cache#touch(key) will "touch" the item with the given key.
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
touch(key?: string, options?: CacheTouchOptions): void;
|
||||
|
||||
/**
|
||||
* Set the cacheFlushInterval for the cache.
|
||||
* @param cacheFlushInterval
|
||||
*/
|
||||
setCacheFlushInterval(cacheFlushInterval: number): void;
|
||||
|
||||
/**
|
||||
* Set the capacity for the cache.Setting this lower than the current item count will result in those items being removed.
|
||||
* @param capacity
|
||||
*/
|
||||
setCapacity(capacity: number): void;
|
||||
|
||||
/**
|
||||
* Set the deleteOnExpire for the cache.
|
||||
* @param deleteOnExpire
|
||||
*/
|
||||
setDeleteOnExpire(deleteOnExpire: string): void;
|
||||
|
||||
/**
|
||||
* Set the maxAge for the cache.
|
||||
*/
|
||||
setMaxAge(maxAge: number): void;
|
||||
|
||||
/**
|
||||
* Set the onExpire for the cache.
|
||||
* @param onExpire
|
||||
*/
|
||||
setOnExpire(onExpire: Function): void;
|
||||
|
||||
/**
|
||||
* Set the recycleFreq for the cache.
|
||||
* @param recycleFreq
|
||||
*/
|
||||
setRecycleFreq(recycleFreq: number): void;
|
||||
|
||||
/**
|
||||
* Set the storageMode for the cache.This will move data from the current storage medium to the new one.
|
||||
* @param storageMode
|
||||
*/
|
||||
setStorageMode(storageMode: string): void;
|
||||
|
||||
/**
|
||||
* Set multiple options for the cache at a time.Setting strict to true will reset options for the cache
|
||||
* that are not specifically set in the options hash to CacheFactoryProvider.defaults.
|
||||
* @param options
|
||||
*/
|
||||
setOptions(options: CacheOptions, strict?: boolean): void;
|
||||
|
||||
/**
|
||||
* Return the values of all items in the cache as an array.
|
||||
* @returns Array<any>
|
||||
*/
|
||||
values(): Array<any>
|
||||
}
|
||||
|
||||
export interface ICacheFactory {
|
||||
|
||||
BinaryHeap: IBinaryHeap;
|
||||
utils: IUtils;
|
||||
defaults: CacheOptions;
|
||||
|
||||
/**
|
||||
* Create a cache. cache must not already exist. cacheId must be a string. options is an optional argument and must be an object.
|
||||
* Any options you pass here will override any default options.
|
||||
* @param cacheId
|
||||
* @param options
|
||||
* @returns ICache
|
||||
*/
|
||||
(cacheId: string, options?: CacheOptions): ICache;
|
||||
|
||||
/**
|
||||
* Create a cache. cache must not already exist. cacheId must be a string. options is an optional argument and must be an object.
|
||||
* Any options you pass here will override any default options.
|
||||
* @param cacheId
|
||||
* @param options
|
||||
* @returns ICache
|
||||
*/
|
||||
createCache(cacheId: string, options?: CacheOptions): ICache;
|
||||
|
||||
/**
|
||||
* Return the cache with the given cacheId.
|
||||
* @param cacheId The id of the cache storage.
|
||||
* @returns ICache
|
||||
*/
|
||||
get(cacheId: string, options?: CacheOptions): ICache;
|
||||
|
||||
/**
|
||||
* Return an object of key- value pairs, the keys being cache ids and the values being the result of .info() being called on each cache.
|
||||
* @returns CacheInfo
|
||||
*/
|
||||
info(): CacheInfo;
|
||||
|
||||
/**
|
||||
* Return the ids of all registered caches as an object.
|
||||
* @returns {[key: string]: ICache}
|
||||
*/
|
||||
keySet(): { [key: string]: ICache };
|
||||
|
||||
/**
|
||||
* Return the ids of all registered caches as an array.
|
||||
* @returns Array<string>
|
||||
*/
|
||||
keys(): Array<string>;
|
||||
|
||||
/**
|
||||
* Destroy the cache with the given cacheId.
|
||||
* @param cacheId
|
||||
*/
|
||||
destroy(cacheId: string): void;
|
||||
|
||||
/**
|
||||
* Destroy all registered caches.
|
||||
*/
|
||||
destroyAll(): void;
|
||||
|
||||
/**
|
||||
* Remove all data from all registered caches.
|
||||
*/
|
||||
clearAll(): void;
|
||||
|
||||
/**
|
||||
* Enable all registered caches.
|
||||
*/
|
||||
enableAll(): void;
|
||||
|
||||
/**
|
||||
* Disable all registered caches.
|
||||
*/
|
||||
disableAll(): void;
|
||||
|
||||
/**
|
||||
* Call.touch() on all registered caches.
|
||||
*/
|
||||
touchAll(): void;
|
||||
|
||||
/**
|
||||
* Call.removeExpired() on all registered caches.Returns a hash of any expired items, keyed by cache id.
|
||||
* @returns {}
|
||||
*/
|
||||
removeExpiredFromAll(): Array<{ [key: string]: Array<{ [key: string]: any }> }>;
|
||||
}
|
||||
|
||||
export interface IUtils {
|
||||
isNumber(value: any): boolean;
|
||||
isString(value: any): boolean;
|
||||
isObject(value: any): boolean;
|
||||
isFunction(value: any): boolean;
|
||||
equals(a: any, b: any): boolean;
|
||||
fromJson(value: any): {}
|
||||
Promise: any;
|
||||
}
|
||||
|
||||
export interface HeapItem {
|
||||
key: string;
|
||||
accessed: Date;
|
||||
}
|
||||
|
||||
export interface IBinaryHeap {
|
||||
(w?: IWeightFunc, c?: ICompareFunc): void;
|
||||
|
||||
heap: Array<HeapItem>;
|
||||
weightFunc: IWeightFunc;
|
||||
compareFunc: ICompareFunc;
|
||||
|
||||
push(node: HeapItem): void;
|
||||
pop(): HeapItem;
|
||||
peek(): HeapItem;
|
||||
remove(node: HeapItem): HeapItem;
|
||||
removeAll(): void;
|
||||
size(): Number;
|
||||
}
|
||||
|
||||
export interface IWeightFunc {
|
||||
<T>(x: T): T;
|
||||
}
|
||||
|
||||
export interface ICompareFunc {
|
||||
<T>(x: T, y: T): boolean;
|
||||
}
|
||||
|
||||
export interface CacheInfo {
|
||||
size: Number;
|
||||
caches: { [key: string]: any };
|
||||
capacity: Number;
|
||||
maxAge: Number;
|
||||
deleteOnExpire: string;
|
||||
onExpire: Function;
|
||||
cacheFlushInterval: Number;
|
||||
recycleFreq: Number;
|
||||
storageMode: string;
|
||||
storageImpl: IStoreImplementation;
|
||||
disabled: boolean;
|
||||
storagePrefix: string;
|
||||
storeOnResolve: boolean;
|
||||
storeOnReject: boolean;
|
||||
}
|
||||
|
||||
export interface CacheItemInfo {
|
||||
created: Date;
|
||||
accessed: Date;
|
||||
expires: Date;
|
||||
isExpired: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var CacheFactory: CacheFactory.ICacheFactory;
|
||||
|
||||
declare module "cachefactory" {
|
||||
export = CacheFactory;
|
||||
}
|
||||
2
chartist/chartist.d.ts
vendored
2
chartist/chartist.d.ts
vendored
@ -105,7 +105,7 @@ declare namespace Chartist {
|
||||
plugins?: Array<any>; // all of these plugins seem to be functions with options, but keeping type any for now
|
||||
|
||||
update(data: Object, options?: T, override?: boolean): void;
|
||||
detatch(): void;
|
||||
detach(): void;
|
||||
|
||||
/**
|
||||
* Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop.
|
||||
|
||||
2
chrome/chrome-app.d.ts
vendored
2
chrome/chrome-app.d.ts
vendored
@ -685,7 +685,7 @@ declare namespace chrome.usb {
|
||||
interface DeviceEvent extends chrome.events.Event<(device: Device) => void> {}
|
||||
|
||||
export var onDeviceAdded: DeviceEvent;
|
||||
export var onDeviceAdded: DeviceEvent;
|
||||
export var onDeviceRemoved: DeviceEvent;
|
||||
|
||||
export function getDevices(options: { vendorId?: number, productId?: number, filters?: DeviceFilter[] }, callback: (devices: Device[]) => void): void;
|
||||
export function getUserSelectedDevices(options: { multiple?: boolean, filters?: DeviceFilter[] }, callback: (devices: Device[]) => void): void;
|
||||
|
||||
2
chrome/chrome.d.ts
vendored
2
chrome/chrome.d.ts
vendored
@ -6210,7 +6210,7 @@ declare namespace chrome.tabs {
|
||||
* The tab's new favicon URL.
|
||||
* @since Chrome 27.
|
||||
*/
|
||||
faviconUrl?: string;
|
||||
favIconUrl?: string;
|
||||
/**
|
||||
* The tab's new title.
|
||||
* @since Chrome 48.
|
||||
|
||||
2
ckeditor/ckeditor.d.ts
vendored
2
ckeditor/ckeditor.d.ts
vendored
@ -641,7 +641,7 @@ declare namespace CKEDITOR {
|
||||
filebrowserImageBrowseLinkUrl?: string;
|
||||
filebrowserImageBrowseUrl?: string;
|
||||
filebrowserImageUploadUrl?: string;
|
||||
filebrowserUploadUr?: string;
|
||||
filebrowserUploadUrl?: string;
|
||||
filebrowserWindowFeatures?: string;
|
||||
filebrowserWindowHeight?: number | string;
|
||||
filebrowserWindowWidth?: number | string;
|
||||
|
||||
26
co-views/co-views-tests.ts
Normal file
26
co-views/co-views-tests.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="co-views.d.ts" />
|
||||
|
||||
import views = require('co-views');
|
||||
|
||||
const render = views('views', {
|
||||
map: {
|
||||
html: 'swig'
|
||||
},
|
||||
default: 'jade'
|
||||
});
|
||||
|
||||
const fileName = 'xxx'; // template file name
|
||||
const locals = {}; // template locals data
|
||||
|
||||
async function test() {
|
||||
const html = await render(fileName, locals);
|
||||
console.log(html);
|
||||
}
|
||||
|
||||
// or use generator
|
||||
|
||||
// function* test() {
|
||||
// const html = yield render(fileName, locals);
|
||||
// console.log(html);
|
||||
// }
|
||||
68
co-views/co-views.d.ts
vendored
Normal file
68
co-views/co-views.d.ts
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
// Type definitions for co-views v2.1
|
||||
// Project: https://github.com/tj/co-views/
|
||||
// Definitions by: devlee <https://github.com/devlee/>
|
||||
// Definitions: https://github.com/devlee/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import views = require('co-views');
|
||||
const render = views('views', {
|
||||
map: {
|
||||
html: 'swig'
|
||||
},
|
||||
default: 'jade'
|
||||
});
|
||||
|
||||
=============================================== */
|
||||
|
||||
declare module "co-views" {
|
||||
|
||||
interface EngineMap {
|
||||
/**
|
||||
* use for .html files
|
||||
*/
|
||||
html: string
|
||||
}
|
||||
|
||||
interface CoViewsOptions {
|
||||
|
||||
/**
|
||||
* default extname
|
||||
*/
|
||||
ext?: string,
|
||||
|
||||
/**
|
||||
* default extname
|
||||
*/
|
||||
default?: string,
|
||||
|
||||
/**
|
||||
* engine map
|
||||
*/
|
||||
map?: EngineMap,
|
||||
|
||||
/**
|
||||
* proxy partials
|
||||
*/
|
||||
partials?: Object,
|
||||
|
||||
/**
|
||||
* cache compiled templates
|
||||
*/
|
||||
cache?: boolean,
|
||||
|
||||
/**
|
||||
* common locals data
|
||||
*/
|
||||
locals?: Object
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass views `dir` and `opts` to return a render function.
|
||||
*/
|
||||
function views(dir?: string, opts?: CoViewsOptions): {
|
||||
(view: string, locals?: Object): any
|
||||
};
|
||||
|
||||
export = views;
|
||||
}
|
||||
129
codemirror/codemirror.d.ts
vendored
129
codemirror/codemirror.d.ts
vendored
@ -181,7 +181,7 @@ declare namespace CodeMirror {
|
||||
handle: any;
|
||||
text: string;
|
||||
/** Object mapping gutter IDs to marker elements. */
|
||||
gutterMarks: any;
|
||||
gutterMarkers: any;
|
||||
textClass: string;
|
||||
bgClass: string;
|
||||
wrapClass: string;
|
||||
@ -220,14 +220,7 @@ declare namespace CodeMirror {
|
||||
|
||||
/** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area,
|
||||
and the size of the visible area(minus scrollbars). */
|
||||
getScrollInfo(): {
|
||||
left: any;
|
||||
top: any;
|
||||
width: any;
|
||||
height: any;
|
||||
clientWidth: any;
|
||||
clientHeight: any;
|
||||
}
|
||||
getScrollInfo(): CodeMirror.ScrollInfo;
|
||||
|
||||
/** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
@ -609,6 +602,15 @@ declare namespace CodeMirror {
|
||||
text: string;
|
||||
}
|
||||
|
||||
interface ScrollInfo {
|
||||
left: any;
|
||||
top: any;
|
||||
width: any;
|
||||
height: any;
|
||||
clientWidth: any;
|
||||
clientHeight: any;
|
||||
}
|
||||
|
||||
interface TextMarker {
|
||||
/** Remove the mark. */
|
||||
clear(): void;
|
||||
@ -1125,6 +1127,115 @@ declare namespace CodeMirror {
|
||||
severity?: string;
|
||||
to?: Position;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that calculates either a two-way or three-way merge between different sets of content.
|
||||
*/
|
||||
function MergeView(element: HTMLElement, options?: MergeView.MergeViewEditorConfiguration): MergeView.MergeViewEditor;
|
||||
|
||||
namespace MergeView {
|
||||
/**
|
||||
* Options available to MergeView.
|
||||
*/
|
||||
interface MergeViewEditorConfiguration extends EditorConfiguration {
|
||||
/**
|
||||
* Determines whether the original editor allows editing. Defaults to false.
|
||||
*/
|
||||
allowEditingOriginals?: boolean;
|
||||
|
||||
/**
|
||||
* When true stretches of unchanged text will be collapsed. When a number is given, this indicates the amount
|
||||
* of lines to leave visible around such stretches (which defaults to 2). Defaults to false.
|
||||
*/
|
||||
collapseIdentical?: boolean | number;
|
||||
|
||||
/**
|
||||
* Sets the style used to connect changed chunks of code. By default, connectors are drawn. When this is set to "align",
|
||||
* the smaller chunk is padded to align with the bigger chunk instead.
|
||||
*/
|
||||
connect?: string;
|
||||
|
||||
/**
|
||||
* Callback for when stretches of unchanged text are collapsed.
|
||||
*/
|
||||
onCollapse?(mergeView: MergeViewEditor, line: number, size: number, mark: TextMarker): void;
|
||||
|
||||
/**
|
||||
* Provides original version of the document to be shown on the right of the editor.
|
||||
*/
|
||||
orig: any;
|
||||
|
||||
/**
|
||||
* Provides original version of the document to be shown on the left of the editor.
|
||||
* To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight.
|
||||
*/
|
||||
origLeft?: any;
|
||||
|
||||
/**
|
||||
* Provides original version of document to be shown on the right of the editor.
|
||||
* To create a 2-way (as opposed to 3-way) merge view, provide only one of origLeft and origRight.
|
||||
*/
|
||||
origRight?: any;
|
||||
|
||||
/**
|
||||
* Determines whether buttons that allow the user to revert changes are shown. Defaults to true.
|
||||
*/
|
||||
revertButtons?: boolean;
|
||||
|
||||
/**
|
||||
* When true, changed pieces of text are highlighted. Defaults to true.
|
||||
*/
|
||||
showDifferences?: boolean;
|
||||
}
|
||||
|
||||
interface MergeViewEditor extends Editor {
|
||||
/**
|
||||
* Returns the editor instance.
|
||||
*/
|
||||
editor(): Editor;
|
||||
|
||||
/**
|
||||
* Left side of the merge view.
|
||||
*/
|
||||
left: DiffView;
|
||||
leftChunks(): MergeViewDiffChunk;
|
||||
leftOriginal(): Editor;
|
||||
|
||||
/**
|
||||
* Right side of the merge view.
|
||||
*/
|
||||
right: DiffView;
|
||||
rightChunks(): MergeViewDiffChunk;
|
||||
rightOriginal(): Editor;
|
||||
|
||||
/**
|
||||
* Sets whether or not the merge view should show the differences between the editor views.
|
||||
*/
|
||||
setShowDifferences(showDifferences: boolean): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks changes in chunks from oroginal to new.
|
||||
*/
|
||||
interface MergeViewDiffChunk {
|
||||
editFrom: number;
|
||||
editTo: number;
|
||||
origFrom: number;
|
||||
origTo: number;
|
||||
}
|
||||
|
||||
interface DiffView {
|
||||
/**
|
||||
* Forces the view to reload.
|
||||
*/
|
||||
forceUpdate(): (mode: string) => void;
|
||||
|
||||
/**
|
||||
* Sets whether or not the merge view should show the differences between the editor views.
|
||||
*/
|
||||
setShowDifferences(showDifferences: boolean): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "codemirror" {
|
||||
|
||||
33
combokeys/combokeys-tests.ts
Normal file
33
combokeys/combokeys-tests.ts
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
///<reference path="combokeys.d.ts" />
|
||||
|
||||
import Combokeys = require("combokeys");
|
||||
|
||||
const combokeys1: Combokeys.Combokeys = new Combokeys(document.createElement('div'));
|
||||
const combokeys2: Combokeys.Combokeys = new Combokeys(document.createElement('div'));
|
||||
|
||||
combokeys1.bind('ctrl+a', () => {});
|
||||
combokeys1.bind('ctrl+z', () => {}, 'keydown');
|
||||
combokeys1.bind(['ctrl+a', 'ctrl+shift+a'], () => {});
|
||||
combokeys1.bind(['ctrl+a', 'ctrl+shift+a'], () => {}, 'keyup');
|
||||
|
||||
combokeys1.bindMultiple(['ctrl+a', 'ctrl+shift+a'], () => {});
|
||||
combokeys1.bindMultiple(['ctrl+a', 'ctrl+shift+a'], () => {}, 'keyup');
|
||||
|
||||
const result: boolean = combokeys1.stopCallback(new Event(null), document.createElement('div'));
|
||||
|
||||
combokeys1.unbind('ctrl+a');
|
||||
combokeys1.unbind('ctrl+a', 'keydown');
|
||||
combokeys1.unbind(['ctrl+a', 'ctrl+shift+a']);
|
||||
combokeys1.unbind(['ctrl+a', 'ctrl+shift+a'], 'keydown');
|
||||
|
||||
combokeys1.trigger('ctrl+a');
|
||||
combokeys1.trigger('ctrl+a', 'keypress');
|
||||
|
||||
combokeys1.reset();
|
||||
|
||||
combokeys1.detach();
|
||||
|
||||
Combokeys.reset();
|
||||
|
||||
Combokeys.instances.forEach((combokeys: Combokeys.Combokeys) => combokeys.reset() );
|
||||
107
combokeys/combokeys.d.ts
vendored
Normal file
107
combokeys/combokeys.d.ts
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
// Type definitions for Combokeys v2.4.6
|
||||
// Project: https://github.com/PolicyStat/combokeys
|
||||
// Definitions by: Ian Clanton-Thuon <https://github.com/iclanton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Combokeys {
|
||||
interface CombokeysStatic {
|
||||
new (element: Element): Combokeys;
|
||||
|
||||
/**
|
||||
* all instances of Combokeys
|
||||
*/
|
||||
instances: Combokeys[];
|
||||
|
||||
/**
|
||||
* reset all instances
|
||||
*/
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface Combokeys {
|
||||
element: Element;
|
||||
|
||||
/**
|
||||
* binds an event to Combokeys
|
||||
*
|
||||
* can be a single key, a combination of keys separated with +,
|
||||
* an array of keys, or a sequence of keys separated by spaces
|
||||
*
|
||||
* be sure to list the modifier keys first to make sure that the
|
||||
* correct key ends up getting bound (the last key in the pattern)
|
||||
*
|
||||
* @param {keys} key combination or combinations
|
||||
* @param {callback} callback function
|
||||
* @param {handler} optional - one of "keypress", "keydown", or "keyup"
|
||||
* @returns void
|
||||
*/
|
||||
bind(keys: string | string[], callback: () => void, action?: string): void;
|
||||
|
||||
|
||||
/**
|
||||
* binds multiple combinations to the same callback
|
||||
*
|
||||
* @param {keys} key combinations
|
||||
* @param {callback} callback function
|
||||
* @param {handler} optional - one of "keypress", "keydown", or "keyup"
|
||||
* @returns void
|
||||
*/
|
||||
bindMultiple(keys: string[], callback: () => void, action?: string): void;
|
||||
|
||||
/**
|
||||
* unbinds an event to Combokeys
|
||||
*
|
||||
* the unbinding sets the callback function of the specified key combo
|
||||
* to an empty function and deletes the corresponding key in the
|
||||
* directMap dict.
|
||||
*
|
||||
* the keycombo+action has to be exactly the same as
|
||||
* it was defined in the bind method
|
||||
*
|
||||
* @param {keys} key combination or combinations
|
||||
* @param {action} optional - one of "keypress", "keydown", or "keyup"
|
||||
* @returns void
|
||||
*/
|
||||
unbind(keys: string | string[], action?: string): void;
|
||||
|
||||
/**
|
||||
* triggers an event that has already been bound
|
||||
*
|
||||
* @param {keys} key combination
|
||||
* @param {action} optional - one of "keypress", "keydown", or "keyup"
|
||||
* @returns void
|
||||
*/
|
||||
trigger(keys: string, action?: string): void;
|
||||
|
||||
/**
|
||||
* resets the library back to its initial state. This is useful
|
||||
* if you want to clear out the current keyboard shortcuts and bind
|
||||
* new ones - for example if you switch to another page
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* should we stop this event before firing off callbacks
|
||||
*
|
||||
* @param {e} event
|
||||
* @param {element} bound element
|
||||
* @return {boolean}
|
||||
*/
|
||||
stopCallback(e: Event, element: Element): boolean;
|
||||
|
||||
/**
|
||||
* detach all listners from the bound element
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
detach(): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var combokeys: Combokeys.CombokeysStatic;
|
||||
|
||||
declare module "combokeys" {
|
||||
export = combokeys;
|
||||
}
|
||||
156
common-tags/common-tags-tests.ts
Normal file
156
common-tags/common-tags-tests.ts
Normal file
@ -0,0 +1,156 @@
|
||||
/// <reference path="common-tags.d.ts" />
|
||||
|
||||
import * as commonTags from 'common-tags';
|
||||
|
||||
/* Test Built-in Tags */
|
||||
|
||||
commonTags.commaLists `
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
commonTags.commaListsAnd`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
commonTags.commaListsOr`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
let fruits = ['apple', 'orange', 'watermelon'];
|
||||
|
||||
commonTags.html`
|
||||
<div class="list">
|
||||
<ul>
|
||||
${fruits.map(fruit => `<li>${fruit}</li>`)}
|
||||
${'<li>kiwi</li>\n<li>guava</li>'}
|
||||
</ul>
|
||||
</div>
|
||||
`;
|
||||
|
||||
commonTags.codeBlock`
|
||||
<div class="list">
|
||||
<ul>
|
||||
${fruits.map(fruit => `<li>${fruit}</li>`)}
|
||||
${'<li>kiwi</li>\n<li>guava</li>'}
|
||||
</ul>
|
||||
</div>
|
||||
`;
|
||||
|
||||
commonTags.source`
|
||||
<div class="list">
|
||||
<ul>
|
||||
${fruits.map(fruit => `<li>${fruit}</li>`)}
|
||||
${'<li>kiwi</li>\n<li>guava</li>'}
|
||||
</ul>
|
||||
</div>
|
||||
`;
|
||||
|
||||
commonTags.oneLine`
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
`;
|
||||
|
||||
commonTags.oneLineTrim`
|
||||
https://news.com/article
|
||||
?utm_source=designernews.co
|
||||
`;
|
||||
|
||||
commonTags.oneLineCommaLists`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
commonTags.oneLineCommaListsOr`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
commonTags.oneLineCommaListsAnd`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
commonTags.inlineLists`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
commonTags.oneLineInlineLists`
|
||||
I like ${['apples', 'bananas', 'watermelons']}
|
||||
They're good!
|
||||
`;
|
||||
|
||||
let verb = 'notice';
|
||||
|
||||
commonTags.stripIndent`
|
||||
This is a multi-line string.
|
||||
You'll ${verb} that it is indented.
|
||||
We don't want to output this indentation.
|
||||
But we do want to keep this line indented.
|
||||
`;
|
||||
|
||||
commonTags.stripIndents`
|
||||
This is a multi-line string.
|
||||
You'll ${verb} that it is indented.
|
||||
We don't want to output this indentation.
|
||||
We don't want to keep this line indented either.
|
||||
`;
|
||||
|
||||
/* Test Tag Constructor */
|
||||
|
||||
new commonTags.TemplateTag();
|
||||
|
||||
const substitutionReplacer = (oldValue : string, newValue : string) => ({
|
||||
onSubstitution(substitution : string, resultSoFar : string) {
|
||||
if (substitution === oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
return substitution;
|
||||
}
|
||||
});
|
||||
|
||||
new commonTags.TemplateTag(substitutionReplacer('fizz', 'buzz'));
|
||||
|
||||
new commonTags.TemplateTag(
|
||||
substitutionReplacer('fizz', 'buzz'),
|
||||
substitutionReplacer('foo', 'bar')
|
||||
);
|
||||
|
||||
new commonTags.TemplateTag([
|
||||
substitutionReplacer('fizz', 'buzz'),
|
||||
substitutionReplacer('foo', 'bar')
|
||||
]);
|
||||
|
||||
new commonTags.TemplateTag({});
|
||||
|
||||
new commonTags.TemplateTag({
|
||||
onEndResult: endResult => `${endResult}!`
|
||||
});
|
||||
|
||||
new commonTags.TemplateTag({
|
||||
onSubstitution: substitution => `${substitution}!`,
|
||||
onEndResult: endResult => `${endResult}!`
|
||||
});
|
||||
|
||||
/* Tests Built-in Transformers */
|
||||
|
||||
new commonTags.TemplateTag(commonTags.trimResultTransformer());
|
||||
new commonTags.TemplateTag(commonTags.trimResultTransformer('left'));
|
||||
new commonTags.TemplateTag(commonTags.trimResultTransformer('right'));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.stripIndentTransformer());
|
||||
new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
|
||||
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
|
||||
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
|
||||
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'}));
|
||||
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'}));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.splitStringTransformer('foo'));
|
||||
62
common-tags/common-tags.d.ts
vendored
Normal file
62
common-tags/common-tags.d.ts
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
// Type definitions for common-tags v1.2.1
|
||||
// Project: https://github.com/declandewet/common-tags
|
||||
// Definitions by: Viktor Zozuliak <https://github.com/zuzusik>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'common-tags' {
|
||||
type TemplateTag = (literals: string[], ...placeholders: any[]) => string;
|
||||
|
||||
type TemplateTransformer = {
|
||||
onSubstitution?: (substitution: string, resultSoFar: string) => string;
|
||||
onEndResult?: (endResult : string) => string;
|
||||
}
|
||||
|
||||
/* Built-in Tags */
|
||||
export var commaLists: TemplateTag;
|
||||
|
||||
export var commaListsAnd: TemplateTag;
|
||||
|
||||
export var commaListsOr: TemplateTag;
|
||||
|
||||
export var html: TemplateTag;
|
||||
|
||||
export var codeBlock: TemplateTag;
|
||||
|
||||
export var source: TemplateTag;
|
||||
|
||||
export var oneLine: TemplateTag;
|
||||
|
||||
export var oneLineTrim: TemplateTag;
|
||||
|
||||
export var oneLineCommaLists: TemplateTag;
|
||||
|
||||
export var oneLineCommaListsOr: TemplateTag;
|
||||
|
||||
export var oneLineCommaListsAnd: TemplateTag;
|
||||
|
||||
export var inlineLists: TemplateTag;
|
||||
|
||||
export var oneLineInlineLists: TemplateTag;
|
||||
|
||||
export var stripIndent: TemplateTag;
|
||||
|
||||
export var stripIndents: TemplateTag;
|
||||
|
||||
/* New Tag Constructor */
|
||||
export var TemplateTag: {
|
||||
new(): TemplateTag;
|
||||
new(...transformers: TemplateTransformer[]): TemplateTag;
|
||||
new(transformers: TemplateTransformer[]): TemplateTag;
|
||||
};
|
||||
|
||||
/* Built-in Transformers */
|
||||
export var trimResultTransformer: (side?: 'left'|'right') => TemplateTransformer;
|
||||
|
||||
export var stripIndentTransformer: (type?: 'initial'|'all') => TemplateTransformer;
|
||||
|
||||
export var replaceResultTransformer: (replaceWhat: string, replaceWith: string) => TemplateTransformer;
|
||||
|
||||
export var inlineArrayTransformer: (opts?: {separator?: string, conjunction?: string}) => TemplateTransformer;
|
||||
|
||||
export var splitStringTransformer: (splitBy: string) => TemplateTransformer;
|
||||
}
|
||||
52
component-emitter/component-emitter-tests.ts
Normal file
52
component-emitter/component-emitter-tests.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/// <reference path='../node/node.d.ts' /> // only for require
|
||||
/// <reference path='component-emitter.d.ts' />
|
||||
// These are all of the examples from https://www.npmjs.com/package/component-emitter as of June 18, 2016
|
||||
|
||||
|
||||
// These are all of the examples from https://www.npmjs.com/package/component-emitter as of June 18, 2016
|
||||
|
||||
var Emitter = require('component-emitter');
|
||||
var emitter = new Emitter;
|
||||
emitter.emit('something');
|
||||
|
||||
|
||||
|
||||
|
||||
var user = { name: 'tobi' };
|
||||
Emitter(user);
|
||||
|
||||
(<Emitter>user).emit('im a user');
|
||||
|
||||
|
||||
|
||||
// this example modified from the one on https://www.npmjs.com/package/component-emitter
|
||||
var User = Object.create({
|
||||
someUserFunction: () => {console.log('someUserFunction called!')}
|
||||
})
|
||||
var another_user = Emitter(User);
|
||||
another_user.someUserFunction()
|
||||
another_user.on('hi', () => {console.log('Hi called')})
|
||||
another_user.emit('hi')
|
||||
|
||||
|
||||
// Additional sample code for this test
|
||||
function handleSomeRecurringEvent(event_data: any) {
|
||||
console.log('handle some-recurring-event')
|
||||
}
|
||||
emitter.on('some-recurring-event', handleSomeRecurringEvent)
|
||||
|
||||
|
||||
emitter.once('some-single-shot-event', (event_data: any) => {console.log('handle some-single-shot-event')})
|
||||
|
||||
|
||||
emitter.off()
|
||||
emitter.off('some-recurring-event')
|
||||
emitter.off('some-recurring-event', handleSomeRecurringEvent)
|
||||
|
||||
var event_data = {some: 'data'}
|
||||
emitter.emit('some-recurring-event')
|
||||
emitter.emit('some-recurring-event', event_data)
|
||||
|
||||
emitter.listeners('some-recurring-event')
|
||||
|
||||
emitter.hasListeners('some-recurring-event')
|
||||
19
component-emitter/component-emitter.d.ts
vendored
Normal file
19
component-emitter/component-emitter.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Type definitions for component-emitter v1.2.1
|
||||
// Project: https://www.npmjs.com/package/component-emitter
|
||||
// Definitions by: Peter Snider <https://github.com/psnider/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/emitter-component
|
||||
|
||||
|
||||
interface Emitter {
|
||||
(obj?: Object): Emitter;
|
||||
on(event: string, listener: Function): Emitter;
|
||||
once(event: string, listener: Function): Emitter;
|
||||
off(event?: string, listener?: Function): Emitter;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
listeners(event: string): Function[];
|
||||
hasListeners(event: string): boolean;
|
||||
}
|
||||
|
||||
declare module 'component-emitter' {
|
||||
var Emitter: Emitter;
|
||||
}
|
||||
2
cordova/cordova.d.ts
vendored
2
cordova/cordova.d.ts
vendored
@ -35,7 +35,7 @@ interface Cordova {
|
||||
* @param action The action name to call on the native side (generally corresponds to the native class method).
|
||||
* @param args An array of arguments to pass into the native environment.
|
||||
*/
|
||||
exec(success: () => any, fail: () => any, service: string, action: string, args?: string[]): void;
|
||||
exec(success: (data: any) => any, fail: (err: any) => any, service: string, action: string, args?: any[]): void;
|
||||
/** Gets the operating system name. */
|
||||
platformId: string;
|
||||
/** Gets Cordova framework version */
|
||||
|
||||
1
cordova/plugins/NetworkInformation.d.ts
vendored
1
cordova/plugins/NetworkInformation.d.ts
vendored
@ -47,6 +47,7 @@ interface Connection {
|
||||
*/
|
||||
type: string;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var Connection: {
|
||||
|
||||
@ -500,3 +500,5 @@ s = s.unescapeHTML();
|
||||
// #############################################################################################
|
||||
|
||||
promiseOfVoid = delay(i);
|
||||
|
||||
console.log('core-js version number:', core.version);
|
||||
|
||||
15
core-js/core-js.d.ts
vendored
15
core-js/core-js.d.ts
vendored
@ -790,8 +790,17 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
@ -1266,6 +1275,8 @@ interface String {
|
||||
declare function delay(msec: number): Promise<void>;
|
||||
|
||||
declare namespace core {
|
||||
var version: string;
|
||||
|
||||
namespace Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
|
||||
64
csv-parse/csv-parse-tests.ts
Normal file
64
csv-parse/csv-parse-tests.ts
Normal file
@ -0,0 +1,64 @@
|
||||
/// <reference path="csv-parse.d.ts" />
|
||||
|
||||
import parse = require('csv-parse');
|
||||
|
||||
function callbackAPITest() {
|
||||
var input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"';
|
||||
parse(input, {comment: '#'}, function(err, output){
|
||||
output.should.eql([ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]);
|
||||
});
|
||||
}
|
||||
|
||||
function streamAPITest() {
|
||||
var output:any = [];
|
||||
// Create the parser
|
||||
var parser = parse({delimiter: ':'});
|
||||
var record: any;
|
||||
// Use the writable stream api
|
||||
parser.on('readable', function(){
|
||||
while(record = parser.read()){
|
||||
output.push(record);
|
||||
}
|
||||
});
|
||||
// Catch any error
|
||||
parser.on('error', function(err: any){
|
||||
console.log(err.message);
|
||||
});
|
||||
// When we are done, test that the parsed output matched what expected
|
||||
parser.on('finish', function(){
|
||||
output.should.eql([
|
||||
[ 'root','x','0','0','root','/root','/bin/bash' ],
|
||||
[ 'someone','x','1022','1022','a funny cat','/home/someone','/bin/bash' ]
|
||||
]);
|
||||
});
|
||||
// Now that setup is done, write data to the stream
|
||||
parser.write("root:x:0:0:root:/root:/bin/bash\n");
|
||||
parser.write("someone:x:1022:1022:a funny cat:/home/someone:/bin/bash\n");
|
||||
// Close the readable stream
|
||||
parser.end();
|
||||
}
|
||||
|
||||
import fs = require('fs');
|
||||
|
||||
function pipeFunctionTest() {
|
||||
var transform = require('stream-transform');
|
||||
|
||||
var output:any = [];
|
||||
var parser = parse({delimiter: ':'})
|
||||
var input = fs.createReadStream('/etc/passwd');
|
||||
var transformer = transform(function(record: any[], callback: any){
|
||||
setTimeout(function(){
|
||||
callback(null, record.join(' ')+'\n');
|
||||
}, 500);
|
||||
}, {parallel: 10});
|
||||
input.pipe(parser).pipe(transformer).pipe(process.stdout);
|
||||
}
|
||||
|
||||
import parseSync = require('csv-parse/lib/sync');
|
||||
|
||||
function syncApiTest() {
|
||||
var input = '"key_1","key_2"\n"value 1","value 2"';
|
||||
var records = parseSync(input, {columns: true});
|
||||
records.should.eql([{ key_1: 'value 1', key_2: 'value 2' }]);
|
||||
}
|
||||
|
||||
132
csv-parse/csv-parse.d.ts
vendored
Normal file
132
csv-parse/csv-parse.d.ts
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
// Type definitions for csv-parse 1.1.0
|
||||
// Project: https://github.com/wdavidw/node-csv-parse
|
||||
// Definitions by: David Muller <https://github.com/davidm77>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "csv-parse/types" {
|
||||
interface callbackFn {
|
||||
(err: any, output: any): void
|
||||
}
|
||||
|
||||
interface nameCallback {
|
||||
(line1: any[]): boolean | string[]
|
||||
}
|
||||
|
||||
interface options {
|
||||
/***
|
||||
* Set the field delimiter. One character only, defaults to comma.
|
||||
*/
|
||||
delimiter?: string;
|
||||
|
||||
/***
|
||||
* String used to delimit record rows or a special value; special constants are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified).
|
||||
*/
|
||||
rowDelimiter?: string;
|
||||
/***
|
||||
* Optional character surrounding a field, one character only, defaults to double quotes.
|
||||
*/
|
||||
quote?: string
|
||||
|
||||
/***
|
||||
* Set the escape character, one character only, defaults to double quotes.
|
||||
*/
|
||||
escape?: string
|
||||
|
||||
/***
|
||||
* List of fields as an array, a user defined callback accepting the first line and returning the column names or true if autodiscovered in the first CSV line, default to null, affect the result data set in the sense that records will be objects instead of arrays.
|
||||
*/
|
||||
columns?: any[]|boolean|nameCallback;
|
||||
|
||||
/***
|
||||
* Treat all the characters after this one as a comment, default to '' (disabled).
|
||||
*/
|
||||
comment?: string
|
||||
|
||||
/***
|
||||
* Name of header-record title to name objects by.
|
||||
*/
|
||||
objname?: string
|
||||
|
||||
/***
|
||||
* Preserve quotes inside unquoted field.
|
||||
*/
|
||||
relax?: boolean
|
||||
|
||||
/***
|
||||
* Discard inconsistent columns count, default to false.
|
||||
*/
|
||||
relax_column_count?: boolean
|
||||
|
||||
/***
|
||||
* Dont generate empty values for empty lines.
|
||||
*/
|
||||
skip_empty_lines?: boolean
|
||||
|
||||
/***
|
||||
* Maximum numer of characters to be contained in the field and line buffers before an exception is raised, used to guard against a wrong delimiter or rowDelimiter, default to 128000 characters.
|
||||
*/
|
||||
max_limit_on_data_read?: number
|
||||
|
||||
/***
|
||||
* If true, ignore whitespace immediately around the delimiter, defaults to false. Does not remove whitespace in a quoted field.
|
||||
*/
|
||||
trim?: boolean
|
||||
|
||||
/***
|
||||
* If true, ignore whitespace immediately following the delimiter (i.e. left-trim all fields), defaults to false. Does not remove whitespace in a quoted field.
|
||||
*/
|
||||
ltrim?: boolean
|
||||
|
||||
/***
|
||||
* If true, ignore whitespace immediately preceding the delimiter (i.e. right-trim all fields), defaults to false. Does not remove whitespace in a quoted field.
|
||||
*/
|
||||
rtrim?: boolean
|
||||
|
||||
/***
|
||||
* If true, the parser will attempt to convert read data types to native types.
|
||||
*/
|
||||
auto_parse?: boolean
|
||||
|
||||
/***
|
||||
* If true, the parser will attempt to convert read data types to dates. It requires the "auto_parse" option.
|
||||
*/
|
||||
auto_parse_date?: boolean
|
||||
}
|
||||
|
||||
import * as stream from "stream";
|
||||
|
||||
interface Parser extends stream.Transform {
|
||||
__push(line: any): any ;
|
||||
__write(chars: any, end: any, callback: any): any;
|
||||
}
|
||||
|
||||
interface ParserConstructor {
|
||||
new (options: options): Parser;
|
||||
}
|
||||
|
||||
interface parse {
|
||||
(input: string, options?: options, callback?: callbackFn): any;
|
||||
(options: options, callback: callbackFn): any;
|
||||
(callback: callbackFn): any;
|
||||
(options?: options): NodeJS.ReadWriteStream;
|
||||
Parser: ParserConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "csv-parse" {
|
||||
import { parse as parseIntf } from "csv-parse/types";
|
||||
|
||||
let parse: parseIntf;
|
||||
|
||||
export = parse;
|
||||
}
|
||||
|
||||
declare module "csv-parse/lib/sync" {
|
||||
import { options } from "csv-parse/types";
|
||||
|
||||
function parse (input: string, options?: options): any;
|
||||
|
||||
export = parse;
|
||||
}
|
||||
16
cucumber/cucumber.d.ts
vendored
16
cucumber/cucumber.d.ts
vendored
@ -29,8 +29,20 @@ declare namespace cucumber {
|
||||
}
|
||||
|
||||
interface HookScenario{
|
||||
attach(text: string, mimeType?: string, callback?: (err?:any) => void): void;
|
||||
isFailed() : boolean;
|
||||
getKeyword():string;
|
||||
getName():string;
|
||||
getDescription():string;
|
||||
getUri():string;
|
||||
getLine():number;
|
||||
getTags():string[];
|
||||
getException():Error;
|
||||
getAttachments():any[];
|
||||
attach(data:any, mimeType?:string, callback?:(err?:any) => void):void;
|
||||
isSuccessful():boolean;
|
||||
isFailed():boolean;
|
||||
isPending():boolean;
|
||||
isUndefined():boolean;
|
||||
isSkipped():boolean;
|
||||
}
|
||||
|
||||
interface HookCode {
|
||||
|
||||
@ -2706,3 +2706,17 @@ function testMultiUtcFormat() {
|
||||
["%Y", function() { return true; }]
|
||||
]);
|
||||
}
|
||||
|
||||
function testEnterSizeEmpty() {
|
||||
|
||||
var selectionSize: number,
|
||||
emptyStatus: boolean;
|
||||
|
||||
var newNodes = d3.selectAll('.test')
|
||||
.data(['1', '2', '3'])
|
||||
.enter();
|
||||
|
||||
emptyStatus = newNodes.empty();
|
||||
selectionSize = newNodes.size();
|
||||
|
||||
}
|
||||
26
d3/d3.d.ts
vendored
26
d3/d3.d.ts
vendored
@ -292,17 +292,17 @@ declare namespace d3 {
|
||||
*/
|
||||
datum(): Datum;
|
||||
|
||||
/**
|
||||
* Set the data item for each node in the selection.
|
||||
* @param value the constant element to use for each node
|
||||
*/
|
||||
datum<NewDatum>(value: NewDatum): Update<NewDatum>;
|
||||
|
||||
/**
|
||||
* Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute.
|
||||
* @param value the function to compute data for each node
|
||||
*/
|
||||
datum<NewDatum>(value: (datum: Datum, index: number, outerIndex: number) => NewDatum): Update<NewDatum>;
|
||||
|
||||
/**
|
||||
* Set the data item for each node in the selection.
|
||||
* @param value the constant element to use for each node
|
||||
*/
|
||||
datum<NewDatum>(value: NewDatum): Update<NewDatum>;
|
||||
|
||||
/**
|
||||
* Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted.
|
||||
@ -415,6 +415,9 @@ declare namespace d3 {
|
||||
|
||||
select(name: (datum: Datum, index: number, outerIndex: number) => EventTarget): Selection<Datum>;
|
||||
call(func: (selection: Enter<Datum>, ...args: any[]) => any, ...args: any[]): Enter<Datum>;
|
||||
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1094,6 +1097,12 @@ declare namespace d3 {
|
||||
export function mean(array: number[]): number;
|
||||
export function mean<T>(array: T[], accessor: (datum: T, index: number) => number): number;
|
||||
|
||||
/**
|
||||
* Compute the median of an array of numbers (the 0.5-quantile).
|
||||
*/
|
||||
export function median(array: number[]): number;
|
||||
export function median<T>(datum: T[], accessor: (datum: T, index: number) => number): number;
|
||||
|
||||
export function quantile(array: number[], p: number): number;
|
||||
|
||||
export function variance(array: number[]): number;
|
||||
@ -1102,8 +1111,7 @@ declare namespace d3 {
|
||||
export function deviation(array: number[]): number;
|
||||
export function deviation<T>(array: T[], accessor: (datum: T, index: number) => number): number;
|
||||
|
||||
export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number;
|
||||
export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number;
|
||||
export function bisectLeft<T>(array: T[], x: T, lo?: number, hi?: number): number;
|
||||
|
||||
export var bisect: typeof bisectRight;
|
||||
|
||||
@ -3055,6 +3063,8 @@ declare namespace d3 {
|
||||
}
|
||||
|
||||
export interface Partition<T extends partition.Node> {
|
||||
(root: T): T[];
|
||||
|
||||
nodes(root: T): T[];
|
||||
|
||||
links(nodes: T[]): partition.Link<T>[];
|
||||
|
||||
1112
d3kit/d3kit-tests.ts
Normal file
1112
d3kit/d3kit-tests.ts
Normal file
File diff suppressed because it is too large
Load Diff
155
d3kit/d3kit.d.ts
vendored
Normal file
155
d3kit/d3kit.d.ts
vendored
Normal file
@ -0,0 +1,155 @@
|
||||
// Type definitions for d3Kit v1.1.0
|
||||
// Project: https://www.npmjs.com/package/d3kit
|
||||
// Definitions by: Morgan Benton <https://github.com/morphatic/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
|
||||
declare namespace d3kit {
|
||||
|
||||
export interface ChartMargin {
|
||||
top?: number;
|
||||
right?: number;
|
||||
bottom?: number;
|
||||
left?: number;
|
||||
}
|
||||
|
||||
export interface ChartOptions {
|
||||
margin?: ChartMargin;
|
||||
offset?: [number,number];
|
||||
initialWidth?: number;
|
||||
initialHeight?: number;
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
export interface ChartMixin {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
export class Skeleton {
|
||||
|
||||
constructor(selector: string|Element, options?: ChartOptions, customEvents?: Array<string>);
|
||||
|
||||
// Getters
|
||||
getCustomEventNames(): Array<string>;
|
||||
getDispatcher(): any; // should be d3.Dispatch but this throws error for user-created events
|
||||
getInnerWidth(): number;
|
||||
getInnerHeight(): number;
|
||||
getLayerOrganizer(): LayerOrganizer;
|
||||
getRootG(): d3.Selection<any>;
|
||||
getSvg(): d3.Selection<any>;
|
||||
|
||||
// Getter/Setters
|
||||
data(): any;
|
||||
data(data?: any, doNotDispatch?: boolean): Skeleton;
|
||||
options(): any; // wish this could be ChartOptions
|
||||
options(options: ChartOptions, doNotDispatch?: boolean): Skeleton;
|
||||
margin(): ChartMargin;
|
||||
margin(margin: ChartMargin, doNotDispatch?: boolean): Skeleton;
|
||||
offset(): [number, number];
|
||||
offset(offset: Array<number>, doNotDispatch?: boolean): Skeleton;
|
||||
width(): number;
|
||||
width(value: number|string, doNotDispatch?: boolean): Skeleton;
|
||||
height(): number;
|
||||
height(value: number|string, doNotDispatch?: boolean): Skeleton;
|
||||
dimension(): [number, number];
|
||||
dimension(dimension: [number|string, number|string], doNotDispatch?: boolean): Skeleton;
|
||||
autoResize(mode?: string|boolean): string|boolean|void;
|
||||
autoResizeDetection(method?:string): string|void;
|
||||
autoResizeToAspectRatio(ratio?: number|boolean): number|boolean|void;
|
||||
|
||||
// Other functions
|
||||
on(eventName: string, listener: (...args: Array<any>) => void): void;
|
||||
hasData(): boolean;
|
||||
hasNonZeroArea(): boolean;
|
||||
mixin(fn: ChartMixin): void;
|
||||
resizeToFitContainer(mode: string|boolean, doNotDispatch?: boolean): void;
|
||||
resizeToAspectRatio(ratio: number, doNotDispatch?: boolean): void;
|
||||
}
|
||||
|
||||
interface ChartletPropertyCallback {
|
||||
(datum?: any, datum_index?: number): any;
|
||||
}
|
||||
|
||||
export interface ChartletEventFunction {
|
||||
(sel?: d3.Selection<any>, done?: string): (sel: d3.Selection<any>) => void;
|
||||
}
|
||||
|
||||
export class Chartlet {
|
||||
|
||||
constructor(
|
||||
enterFunction?: ChartletEventFunction,
|
||||
updateFunction?: ChartletEventFunction,
|
||||
exitFunction?: ChartletEventFunction,
|
||||
customEventName?: Array<string>);
|
||||
|
||||
// Getter functions
|
||||
getDispatcher(): d3.Dispatch;
|
||||
getCustomEventNames(): Array<string>;
|
||||
getPropertyValue(name: string, datum: any, datum_index: number): any;
|
||||
|
||||
// Getter/Setter functions
|
||||
property(name: string): ChartletPropertyCallback;
|
||||
property(name: string, value: any): Chartlet;
|
||||
|
||||
// Enter/Update/Exit functions
|
||||
enter( sel?: d3.Selection<any>, done?: string): (sel: d3.Selection<any>) => void;
|
||||
update(sel?: d3.Selection<any>, done?: string): (sel: d3.Selection<any>) => void;
|
||||
exit( sel?: d3.Selection<any>, done?: string): (sel: d3.Selection<any>) => void;
|
||||
|
||||
// Inheritance functions
|
||||
inheritPropertyFrom(parent_chartlet: Chartlet, parent_property_name: string, child_property_name?: string): void;
|
||||
inheritPropertiesFrom(parent_chartlet: Chartlet, parent_property_names: Array<string>, child_property_names?: Array<string>): void;
|
||||
publishEventsTo(dispatcher: d3.Dispatch): Chartlet;
|
||||
|
||||
// Events
|
||||
on(eventName: string, handlerFunction: ChartletEventFunction): void;
|
||||
}
|
||||
|
||||
interface LayerConfig {
|
||||
name?: string,
|
||||
names?: Array<string>,
|
||||
sublayers?: LayerConfig
|
||||
}
|
||||
|
||||
export class LayerOrganizer {
|
||||
|
||||
constructor(container: d3.Selection<any>, tag?: string);
|
||||
|
||||
create(config: string|Array<string>|LayerConfig|Array<LayerConfig>): d3.Selection<any>|Array<d3.Selection<any>>;
|
||||
get(name: string): d3.Selection<any>;
|
||||
has(name: string): boolean;
|
||||
}
|
||||
|
||||
export namespace factory {
|
||||
export function createChart(
|
||||
defaultOptions: ChartOptions,
|
||||
customEvents: Array<string>,
|
||||
constructor: (skeleton: Skeleton) => void
|
||||
): (selector: string|Element, options?: ChartOptions, customEvents?: Array<string>) => Skeleton;
|
||||
}
|
||||
|
||||
export namespace helper {
|
||||
export function debounce(fn: (...args: Array<any>) => void, wait: number, immediate: boolean): (...args: Array<any>) => void;
|
||||
export function extend(target: Object, ...args: Object[]): Object;
|
||||
export function deepExtend(target: Object, ...args: Object[]): Object;
|
||||
export function bindMouseEventsToDispatcher(selection: d3.Selection<any>, dispatch: d3.Dispatch, prefix: string): void;
|
||||
export function removeAllChildren(selection: d3.Selection<any>, noTransition: boolean): d3.Selection<any>;
|
||||
export function on(element: Element, type: string, listener: (...args: Array<any>) => void): void;
|
||||
export function off(element: Element, type: string, listener: (...args: Array<any>) => void): void;
|
||||
export function trim(str: string, characters: string): string;
|
||||
export function dasherize(str: string): string;
|
||||
export function $(s: Element|string): Element;
|
||||
export function $$(s: Array<Node>|NodeList): Array<Element>;
|
||||
export function isArray(value: any): boolean;
|
||||
export function isNumber(value: any): boolean;
|
||||
export function isObject(value: any): boolean;
|
||||
export function isElement(o: any): boolean;
|
||||
export function isFunction(functionToCheck: any): boolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'd3kit' {
|
||||
export = d3kit;
|
||||
}
|
||||
146
d3pie/d3pie-tests.ts
Normal file
146
d3pie/d3pie-tests.ts
Normal file
@ -0,0 +1,146 @@
|
||||
/// <reference path='d3pie.d.ts' />
|
||||
|
||||
let chart = new d3pie('test',
|
||||
{
|
||||
header: {
|
||||
title: {
|
||||
text: '',
|
||||
color: '#333333',
|
||||
fontSize: 18,
|
||||
font: 'arial'
|
||||
},
|
||||
subtitle: {
|
||||
color: '#666666',
|
||||
fontSize: 14,
|
||||
font: 'arial'
|
||||
},
|
||||
location: 'top-center',
|
||||
titleSubtitlePadding: 8
|
||||
},
|
||||
footer: {
|
||||
text: '',
|
||||
color: '#666666',
|
||||
fontSize: 14,
|
||||
font: 'arial',
|
||||
location: 'left'
|
||||
},
|
||||
size: {
|
||||
canvasHeight: 500,
|
||||
canvasWidth: 500,
|
||||
pieInnerRadius: 0,
|
||||
pieOuterRadius: null
|
||||
},
|
||||
data: {
|
||||
sortOrder: 'none',
|
||||
smallSegmentGrouping: {
|
||||
enabled: false,
|
||||
value: 1,
|
||||
valueType: 'percentage',
|
||||
label: 'Other',
|
||||
color: '#cccccc'
|
||||
},
|
||||
content: []
|
||||
},
|
||||
labels: {
|
||||
outer: {
|
||||
format: 'label',
|
||||
hideWhenLessThanPercentage: null,
|
||||
pieDistance: 30
|
||||
},
|
||||
inner: {
|
||||
format: 'percentage',
|
||||
hideWhenLessThanPercentage: null
|
||||
},
|
||||
mainLabel: {
|
||||
color: '#333333',
|
||||
font: 'arial',
|
||||
fontSize: 10
|
||||
},
|
||||
percentage: {
|
||||
color: '#dddddd',
|
||||
font: 'arial',
|
||||
fontSize: 10,
|
||||
decimalPlaces: 0
|
||||
},
|
||||
value: {
|
||||
color: '#cccc44',
|
||||
font: 'arial',
|
||||
fontSize: 10
|
||||
},
|
||||
lines: {
|
||||
enabled: true,
|
||||
style: 'curved',
|
||||
color: 'segment' // 'segment' or a hex color
|
||||
}
|
||||
},
|
||||
effects: {
|
||||
load: {
|
||||
effect: 'default', // none / default
|
||||
speed: 1000
|
||||
},
|
||||
pullOutSegmentOnClick: {
|
||||
effect: 'bounce', // none / linear / bounce / elastic / back
|
||||
speed: 300,
|
||||
size: 10
|
||||
},
|
||||
highlightSegmentOnMouseover: true,
|
||||
highlightLuminosity: -0.2
|
||||
},
|
||||
tooltips: {
|
||||
enabled: false,
|
||||
type: 'placeholder', // caption|placeholder
|
||||
string: '',
|
||||
placeholderParser: null,
|
||||
styles: {
|
||||
fadeInSpeed: 250,
|
||||
backgroundColor: '#000000',
|
||||
backgroundOpacity: 0.5,
|
||||
color: '#efefef',
|
||||
borderRadius: 2,
|
||||
font: 'arial',
|
||||
fontSize: 10,
|
||||
padding: 4
|
||||
}
|
||||
},
|
||||
|
||||
misc: {
|
||||
colors: {
|
||||
background: null, // transparent
|
||||
segments: [
|
||||
'#2484c1', '#65a620', '#7b6888', '#a05d56', '#961a1a',
|
||||
'#d8d23a', '#e98125', '#d0743c', '#635222', '#6ada6a',
|
||||
'#0c6197', '#7d9058', '#207f33', '#44b9b0', '#bca44a',
|
||||
'#e4a14b', '#a3acb2', '#8cc3e9', '#69a6f9', '#5b388f',
|
||||
'#546e91', '#8bde95', '#d2ab58', '#273c71', '#98bf6e',
|
||||
'#4daa4b', '#98abc5', '#cc1010', '#31383b', '#006391',
|
||||
'#c2643f', '#b0a474', '#a5a39c', '#a9c2bc', '#22af8c',
|
||||
'#7fcecf', '#987ac6', '#3d3b87', '#b77b1c', '#c9c2b6',
|
||||
'#807ece', '#8db27c', '#be66a2', '#9ed3c6', '#00644b',
|
||||
'#005064', '#77979f', '#77e079', '#9c73ab', '#1f79a7'
|
||||
],
|
||||
segmentStroke: '#ffffff'
|
||||
},
|
||||
gradient: {
|
||||
enabled: false,
|
||||
percentage: 95,
|
||||
color: '#000000'
|
||||
},
|
||||
canvasPadding: {
|
||||
top: 5,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
left: 5
|
||||
},
|
||||
pieCenterOffset: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
cssPrefix: null
|
||||
},
|
||||
callbacks: {
|
||||
onload: null,
|
||||
onMouseoverSegment: null,
|
||||
onMouseoutSegment: null,
|
||||
onClickSegment: null
|
||||
}
|
||||
})
|
||||
146
d3pie/d3pie.d.ts
vendored
Normal file
146
d3pie/d3pie.d.ts
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
// Type definitions for d3pie 0.1.9
|
||||
// Project: https://github.com/benkeen/d3pie
|
||||
// Definitions by: Petryshyn Sergii <https://github.com/mc-petry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace d3pie {
|
||||
interface ID3PieChart {
|
||||
redraw(): void
|
||||
openSegment(index: number): void
|
||||
closeSegment(index: void): void
|
||||
getOpenSegment(): any
|
||||
updateProp(propKey: string, value: any): void
|
||||
destroy(): void
|
||||
}
|
||||
|
||||
interface ID3PieStyleOptions {
|
||||
color?: string
|
||||
fontSize?: number
|
||||
font?: string
|
||||
}
|
||||
|
||||
interface ID3PieTextOptions extends ID3PieStyleOptions {
|
||||
text?: string
|
||||
}
|
||||
|
||||
interface ID3PieLabelsOptions {
|
||||
format?: 'label' | 'value' | 'percentage' | 'label-value1' | 'label-value2' | 'label-percentage1' | 'label-percentage2'
|
||||
hideWhenLessThanPercentage?: number
|
||||
}
|
||||
|
||||
interface ID3PieOptions {
|
||||
header?: {
|
||||
title?: ID3PieTextOptions
|
||||
subtitle?: ID3PieTextOptions
|
||||
location?: 'top-center' | 'top-left' | 'pie-center'
|
||||
titleSubtitlePadding?: number
|
||||
}
|
||||
footer?: { location?: 'left' } & ID3PieTextOptions
|
||||
size?: {
|
||||
canvasHeight?: number
|
||||
canvasWidth?: number
|
||||
pieOuterRadius?: string | number
|
||||
pieInnerRadius?: string | number
|
||||
}
|
||||
data: {
|
||||
sortOrder?: 'none' | 'random' | 'value-asc' | 'value-desc' | 'label-asc' | 'label-desc'
|
||||
smallSegmentGrouping?: {
|
||||
enabled?: boolean
|
||||
value?: number
|
||||
valueType?: 'percentage' | 'value'
|
||||
label?: string
|
||||
color?: string
|
||||
}
|
||||
content: {
|
||||
label: string
|
||||
value: number
|
||||
color?: string
|
||||
}[]
|
||||
}
|
||||
labels?: {
|
||||
outer?: { pieDistance?: number } & ID3PieLabelsOptions
|
||||
inner?: ID3PieLabelsOptions
|
||||
mainLabel?: ID3PieStyleOptions
|
||||
percentage?: { decimalPlaces?: number } & ID3PieStyleOptions
|
||||
value?: ID3PieStyleOptions
|
||||
lines?: {
|
||||
enabled?: boolean
|
||||
style?: 'curved' | 'straight'
|
||||
color?: string
|
||||
}
|
||||
truncation?: {
|
||||
enabled?: boolean
|
||||
truncateLength?: number
|
||||
}
|
||||
formatter?: (context: {
|
||||
section: 'outer' | 'inner'
|
||||
value: number
|
||||
label: string
|
||||
}) => string
|
||||
}
|
||||
effects?: {
|
||||
load?: {
|
||||
effect?: 'none' | 'default'
|
||||
speed?: number
|
||||
}
|
||||
pullOutSegmentOnClick?: {
|
||||
effect?: 'none' | 'linear' | 'bounce' | 'elastic' | 'back'
|
||||
speed?: number
|
||||
size?: number
|
||||
}
|
||||
highlightSegmentOnMouseover?: boolean
|
||||
highlightLuminosity?: number
|
||||
}
|
||||
tooltips?: {
|
||||
enabled?: boolean
|
||||
type?: 'placeholder' | 'caption'
|
||||
string?: string
|
||||
placeholderParser?: (index: number, data: { label?: string, percentage?: number, value?: number }) => void
|
||||
styles?: {
|
||||
fadeInSpeed?: number
|
||||
backgroundColor?: string
|
||||
backgroundOpacity?: number
|
||||
color?: string
|
||||
borderRadius?: number
|
||||
font?: string
|
||||
fontSize?: number
|
||||
padding?: number
|
||||
}
|
||||
}
|
||||
misc?: {
|
||||
colors?: {
|
||||
background?: string
|
||||
segments?: string[]
|
||||
segmentStroke?: string
|
||||
}
|
||||
gradient?: {
|
||||
enabled?: boolean
|
||||
percentage?: number
|
||||
color?: string
|
||||
}
|
||||
canvasPadding?: {
|
||||
top?: number
|
||||
right?: number
|
||||
bottom?: number
|
||||
left?: number
|
||||
}
|
||||
pieCenterOffset?: {
|
||||
x?: number
|
||||
y?: number
|
||||
}
|
||||
cssPrefix?: string
|
||||
}
|
||||
callbacks?: {
|
||||
onload?: Function
|
||||
onMouseoverSegment?: Function
|
||||
onMouseoutSegment?: Function
|
||||
onClickSegment?: Function
|
||||
}
|
||||
}
|
||||
|
||||
interface ID3PieClass {
|
||||
new (id: string | HTMLElement, options: ID3PieOptions): ID3PieChart
|
||||
}
|
||||
}
|
||||
|
||||
declare const d3pie: d3pie.ID3PieClass
|
||||
@ -11,8 +11,12 @@ namespace DagreD3Tests {
|
||||
|
||||
predecessors["a"] = graph.predecessors("a");
|
||||
successors["a"] = graph.successors("a");
|
||||
graph.transition = (selection: d3.Selection<any>) => {
|
||||
return d3.transition();
|
||||
};
|
||||
|
||||
const render = new dagreD3.render();
|
||||
const svg = d3.select("svg");
|
||||
render.arrows()["arrowType"] = (parent: d3.Selection<any>, id: string, edge: Dagre.Edge, type: string) => {};
|
||||
render(svg, graph);
|
||||
}
|
||||
|
||||
4
dagre-d3/dagre-d3.d.ts
vendored
4
dagre-d3/dagre-d3.d.ts
vendored
@ -19,10 +19,14 @@ declare namespace Dagre {
|
||||
height: number;
|
||||
predecessors(id: string): string[];
|
||||
successors(id: string): string[];
|
||||
// see source of http://cpettitt.github.io/project/dagre-d3/latest/demo/interactive-demo.html
|
||||
transition?(selection: d3.Selection<any>): d3.Transition<any>;
|
||||
width: number;
|
||||
}
|
||||
|
||||
interface Render {
|
||||
// see http://cpettitt.github.io/project/dagre-d3/latest/demo/user-defined.html for example usage
|
||||
arrows (): { [arrowStyleName: string]: (parent: d3.Selection<any>, id: string, edge: Dagre.Edge, type: string) => void };
|
||||
new (): Render;
|
||||
(selection: d3.Selection<any>, g: Dagre.Graph): void;
|
||||
}
|
||||
|
||||
59
daterangepicker/daterangepicker-tests.ts
Normal file
59
daterangepicker/daterangepicker-tests.ts
Normal file
@ -0,0 +1,59 @@
|
||||
/// <reference path="daterangepicker.d.ts"/>
|
||||
|
||||
function tests_simple() {
|
||||
$('#daterange').daterangepicker();
|
||||
$('input[name="daterange"]').daterangepicker({
|
||||
timePicker: true,
|
||||
timePickerIncrement: 30,
|
||||
locale: {
|
||||
format: 'MM/DD/YYYY h:mm A'
|
||||
}
|
||||
});
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name="datefilter"]').on('apply.daterangepicker', function (ev, picker) {
|
||||
$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
|
||||
});
|
||||
|
||||
|
||||
$('input[name="datefilter"]').on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
$('#demo').daterangepicker({
|
||||
"startDate": "05/06/2016",
|
||||
"endDate": "05/12/2016"
|
||||
}, function (start: string, end: string, label: string) {
|
||||
console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
|
||||
});
|
||||
|
||||
$(function() {
|
||||
|
||||
function cb(start: moment.Moment, end: moment.Moment) {
|
||||
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
|
||||
}
|
||||
cb(moment().subtract(29, 'days'), moment());
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
});
|
||||
}
|
||||
166
daterangepicker/daterangepicker.d.ts
vendored
Normal file
166
daterangepicker/daterangepicker.d.ts
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
// Type definitions for Date Range Picker v2.1.19
|
||||
// Project: http://www.daterangepicker.com/
|
||||
// Definitions by: SirMartin <https://github.com/SirMartin/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="../moment/moment.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
daterangepicker(settings?: daterangepicker.Settings): JQuery;
|
||||
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
|
||||
}
|
||||
|
||||
declare module daterangepicker {
|
||||
|
||||
interface DatepickerEventObject extends JQueryEventObject {
|
||||
date: Date;
|
||||
format(format?: string): string;
|
||||
}
|
||||
|
||||
interface Settings {
|
||||
/**
|
||||
* The start of the initially selected date range
|
||||
*/
|
||||
startDate?: string | moment.Moment | Date;
|
||||
/**
|
||||
* The end of the initially selected date range
|
||||
*/
|
||||
endDate?: string | moment.Moment | Date;
|
||||
/**
|
||||
* The earliest date a user may select
|
||||
*/
|
||||
minDate?: string | moment.Moment | Date;
|
||||
/**
|
||||
* The latest date a user may select
|
||||
*/
|
||||
maxDate?: string | moment.Moment | Date;
|
||||
/**
|
||||
* The maximum span between the selected start and end dates. Can have any property you can add to a moment object (i.e. days, months)
|
||||
*/
|
||||
dateLimit?: any;
|
||||
/**
|
||||
* Show year and month select boxes above calendars to jump to a specific month and year
|
||||
*/
|
||||
showDropdowns?: boolean;
|
||||
/**
|
||||
* Show localized week numbers at the start of each week on the calendars
|
||||
*/
|
||||
showWeekNumbers?: boolean;
|
||||
/**
|
||||
* Show ISO week numbers at the start of each week on the calendars
|
||||
*/
|
||||
showISOWeekNumbers?: boolean;
|
||||
/**
|
||||
* Allow selection of dates with times, not just dates
|
||||
*/
|
||||
timePicker?: boolean;
|
||||
/**
|
||||
* Increment of the minutes selection list for times (i.e. 30 to allow only selection of times ending in 0 or 30)
|
||||
*/
|
||||
timePickerIncrement?: number;
|
||||
/**
|
||||
* Use 24- hour instead of 12- hour times, removing the AM/ PM selection.
|
||||
*/
|
||||
timePicker24Hour?: boolean;
|
||||
/**
|
||||
* Show seconds in the timePicker.
|
||||
*/
|
||||
timePickerSeconds?: boolean;
|
||||
/**
|
||||
* Set predefined date ranges the user can select from.Each key is the label for the range, and its value an array with two dates representing the bounds of the range.
|
||||
*/
|
||||
ranges?: any;
|
||||
/**
|
||||
* (string: 'left'/'right'/'center') Whether the picker appears aligned to the left, to the right, or centered under the HTML element it's attached to
|
||||
*/
|
||||
opens?: string;
|
||||
/**
|
||||
* (string: 'down' or 'up') Whether the picker appears below (default) or above the HTML element it's attached to
|
||||
*/
|
||||
drops?: string;
|
||||
/**
|
||||
* CSS class names that will be added to all buttons in the picker
|
||||
*/
|
||||
buttonClasses?: string[];
|
||||
/**
|
||||
* CSS class string that will be added to the apply button
|
||||
*/
|
||||
applyClass?: string;
|
||||
/**
|
||||
* CSS class string that will be added to the cancel button
|
||||
*/
|
||||
cancelClass?: string;
|
||||
/**
|
||||
* Allows you to provide localized strings for buttons and labels, customize the date display format, and change the first day of week for the calendars.
|
||||
*/
|
||||
locale?: Locale;
|
||||
/**
|
||||
* Show only a single calendar to choose one date, instead of a range picker with two calendars; the start and end dates provided to your callback will be the same single date chosen.
|
||||
*/
|
||||
singleDatePicker?: boolean;
|
||||
/**
|
||||
* Hide the apply and cancel buttons, and automatically apply a new date range as soon as two dates or a predefined range is selected.
|
||||
*/
|
||||
autoApply?: boolean;
|
||||
/**
|
||||
* When enabled, the two calendars displayed will always be for two sequential months (i.e.January and February), and both will be advanced when clicking the left or right arrows above the calendars.When disabled, the two calendars can be individually advanced and display any month/ year.
|
||||
*/
|
||||
linkedCalendars?: boolean;
|
||||
/**
|
||||
* jQuery selector of the parent element that the date range picker will be added to, if not provided this will be 'body'
|
||||
*/
|
||||
parentEl?: string;
|
||||
/**
|
||||
* A function that is passed each date in the two calendars before they are displayed, and may return true or false to indicate whether that date should be available for selection or not.
|
||||
*/
|
||||
isInvalidDate?(startDate: string | moment.Moment | Date, endDate?: string | moment.Moment | Date): boolean;
|
||||
/**
|
||||
* Indicates whether the date range picker should automatically update the value of an < input > element it's attached to at initialization and when the selected dates change.
|
||||
*/
|
||||
autoUpdateInput?: boolean;
|
||||
/**
|
||||
* Normally, if you use the ranges option to specify pre- defined date ranges, calendars for choosing a custom date range are not shown until the user clicks "Custom Range".When this option is set to true, the calendars for choosing a custom date range are always shown instead.
|
||||
*/
|
||||
alwaysShowCalendars?: boolean;
|
||||
}
|
||||
|
||||
interface Locale {
|
||||
/**
|
||||
* Text for cancel label.
|
||||
*/
|
||||
cancelLabel?: string;
|
||||
/**
|
||||
* Text for apply label.
|
||||
*/
|
||||
applyLabel?: string;
|
||||
/**
|
||||
* Format of the date string. example: 'YYYY-MM-DD'
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* Separator between the startDate and endDate in the attached input element. Example: ' - '
|
||||
*/
|
||||
separator?: string;
|
||||
/**
|
||||
* Text for the week label.
|
||||
*/
|
||||
weekLabel?: string;
|
||||
/**
|
||||
* Text for the custom range label.
|
||||
*/
|
||||
customRangeLabel?: string;
|
||||
/**
|
||||
* The first day of the week (0-6, Sunday to Saturday).
|
||||
*/
|
||||
firstDay?: number;
|
||||
/**
|
||||
* Weekday names displayed in the header of calendar.
|
||||
*/
|
||||
daysOfWeek?: string[];
|
||||
/**
|
||||
* Month names used in the month select boxes.
|
||||
*/
|
||||
monthNames?: string[];
|
||||
}
|
||||
}
|
||||
259
db.js/db.js-tests.ts
Normal file
259
db.js/db.js-tests.ts
Normal file
@ -0,0 +1,259 @@
|
||||
// Test file for db.js Definition file
|
||||
/// <reference path="db.js.d.ts" />
|
||||
|
||||
/* Type for use in tests */
|
||||
|
||||
interface Person {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
answer: number;
|
||||
group?: string;
|
||||
}
|
||||
|
||||
/* Opening/creating a database and connection */
|
||||
|
||||
var server: DbJs.Server;
|
||||
|
||||
db.open({
|
||||
server: 'my-app',
|
||||
version: 1,
|
||||
schema: {
|
||||
people: {
|
||||
key: { keyPath: 'id', autoIncrement: true },
|
||||
indexes: {
|
||||
firstName: {},
|
||||
answer: { unique: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
}).then(function (s: DbJs.Server) {
|
||||
server = s;
|
||||
});
|
||||
|
||||
var typedStore: DbJs.TypedObjectStoreServer<Person> = server['people'];
|
||||
|
||||
/* Basic server operations */
|
||||
|
||||
var idb = server.getIndexedDB();
|
||||
server.close();
|
||||
|
||||
/* General server/store methods */
|
||||
|
||||
// Adding items
|
||||
server.add<Person>('people', {
|
||||
firstName: 'Aaron',
|
||||
lastName: 'Powell',
|
||||
answer: 42
|
||||
}).then(function (item) { });
|
||||
|
||||
typedStore.add({
|
||||
firstName: 'Aaron',
|
||||
lastName: 'Powell',
|
||||
answer: 42
|
||||
}).then(function (item) { });
|
||||
|
||||
// Updating
|
||||
server.update<Person>('people', {
|
||||
firstName: 'Aaron',
|
||||
lastName: 'Powell',
|
||||
answer: 42
|
||||
}).then(function (item) { });
|
||||
|
||||
typedStore.update({
|
||||
firstName: 'Aaron',
|
||||
lastName: 'Powell',
|
||||
answer: 42
|
||||
}).then(function (item) { });
|
||||
|
||||
// Removing
|
||||
server.remove('people', 1).then(function (key) { });
|
||||
typedStore.remove(1).then(function (key) { });
|
||||
|
||||
// Clearing
|
||||
server.clear('people').then(function() { });
|
||||
typedStore.clear().then(function() { });
|
||||
|
||||
// Fetching
|
||||
|
||||
// Getting a single object by key
|
||||
server.get<Person>('people', 5).then(function (results) { });
|
||||
typedStore.get(5).then(function (results) { });
|
||||
|
||||
// Getting a single object by key range
|
||||
|
||||
// With a MongoDB-style range:
|
||||
|
||||
server.get<Person>('people', {gte: 1, lt: 3})
|
||||
.then(function (results) { });
|
||||
typedStore.get({gte: 1, lt: 3})
|
||||
.then(function (results) { });
|
||||
|
||||
// With an IDBKeyRange :
|
||||
|
||||
server.get<Person>('people', IDBKeyRange.bound(1, 3, false, true))
|
||||
.then(function (results) { });
|
||||
typedStore.get(IDBKeyRange.bound(1, 3, false, true))
|
||||
.then(function (results) { });
|
||||
|
||||
// Querying
|
||||
|
||||
// Querying all objects
|
||||
server.query<Person>('people')
|
||||
.all()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
typedStore.query()
|
||||
.all()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// Querying using indexes
|
||||
server.query<Person>('people', 'specialProperty')
|
||||
.all()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
typedStore.query('specialProperty')
|
||||
.all()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// Filter with property and value
|
||||
server.query<Person>('people')
|
||||
.filter('firstName', 'Aaron')
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// Filter with function
|
||||
server.query<Person>('people')
|
||||
.filter(function(person: any) { return person.group === 'hipster'; })
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
typedStore.query('people')
|
||||
.filter(function(person) { return person.group === 'hipster'; })
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// Querying with ranges
|
||||
server.query<Person>('people', 'firstName')
|
||||
.only('Aaron')
|
||||
.then(function (results) { });
|
||||
|
||||
server.query<Person>('people', 'answer')
|
||||
.bound(30, 50)
|
||||
.then(function (results) { });
|
||||
|
||||
server.query<Person>('people', 'firstName')
|
||||
.range({ eq: 'Aaron' })
|
||||
.then(function (results) { });
|
||||
|
||||
server.query<Person>('people', 'answer')
|
||||
.range({ gte: 30, lte: 50 })
|
||||
.then(function (results) { });
|
||||
|
||||
// Querying for distinct values
|
||||
server.query<Person>('people', 'firstName')
|
||||
.only('Aaron')
|
||||
.distinct()
|
||||
.execute()
|
||||
.then(function (data) { });
|
||||
|
||||
// Limiting cursor range
|
||||
server.query<Person>('people', 'firstName')
|
||||
.all()
|
||||
.limit(1, 3)
|
||||
.execute()
|
||||
.then(function (data) { });
|
||||
|
||||
// Cursor direction (desc)
|
||||
server.query<Person>('people')
|
||||
.all()
|
||||
.desc()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// Keys
|
||||
server.query<Person>('people', 'firstName')
|
||||
.only('Aaron')
|
||||
.keys()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// Mapping
|
||||
server.query<Person>('people', 'age')
|
||||
.lowerBound(30)
|
||||
.map(function (value) {
|
||||
return {
|
||||
fullName: value.firstName + ' ' + value.lastName,
|
||||
raw: value
|
||||
};
|
||||
})
|
||||
.execute()
|
||||
.then(function (data) { });
|
||||
|
||||
// Counting
|
||||
server.query<Person>('people', 'firstName')
|
||||
.only('Aaron')
|
||||
.count()
|
||||
.execute()
|
||||
.then(function (results) { });
|
||||
|
||||
// With no arguments (count all items)
|
||||
server.count().then(function (ct) { });
|
||||
|
||||
// With a key
|
||||
server.count('myKey').then(function (ct) { });
|
||||
|
||||
// With a MongoDB-style range
|
||||
server.count({gte: 1, lt: 3}).then(function (ct) { });
|
||||
|
||||
// With an IDBKeyRange range
|
||||
server.count(IDBKeyRange.bound(1, 3, false, true)).then(function (ct) { });
|
||||
|
||||
// Atomic updates
|
||||
server.query('users', 'last_mod')
|
||||
.lowerBound(new Date().getTime() - 10000)
|
||||
.modify({ last_mod: new Date().getTime() })
|
||||
.execute()
|
||||
.then(function(results) { });
|
||||
|
||||
server.query('users', 'changed')
|
||||
.only(true)
|
||||
.modify({ changed: false })
|
||||
.execute()
|
||||
.then(function () { });
|
||||
|
||||
server.query('users', 'name')
|
||||
.lowerBound('marcy')
|
||||
.modify({ views: function(profile: any) { return profile.views + 1; } })
|
||||
.execute()
|
||||
.then(function () { });
|
||||
|
||||
/* Other server methods */
|
||||
|
||||
// Closing connection
|
||||
server.close();
|
||||
|
||||
// Retrieving the indexedDB.open result object in use
|
||||
var storeNames = server.getIndexedDB().objectStoreNames;
|
||||
|
||||
// Server event handlers
|
||||
|
||||
server.addEventListener('abort', function (e: Event) { });
|
||||
server.addEventListener('error', function (err: Event) { });
|
||||
server.addEventListener('versionchange', function (e: Event) { });
|
||||
|
||||
server
|
||||
.abort(function (e) { })
|
||||
.error(function (err) { })
|
||||
.versionchange(function (e) { });
|
||||
|
||||
// Deleting a database
|
||||
db.delete('dbName').then(function () { }, function (err: Error) { });
|
||||
db.delete('dbName').catch(function (err) { }).then(function (ev) { });
|
||||
|
||||
// Comparing two keys
|
||||
|
||||
db.cmp('key1', 'key2');
|
||||
154
db.js/db.js.d.ts
vendored
Normal file
154
db.js/db.js.d.ts
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
// Type definitions for db.js v0.14.0
|
||||
// Project: https://github.com/aaronpowell/db.js/
|
||||
// Definitions by: Chris Wrench <https://github.com/cgwrench>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module DbJs {
|
||||
interface ErrorListener {
|
||||
(err: Error): void;
|
||||
}
|
||||
|
||||
interface OpenOptions {
|
||||
server: string;
|
||||
version: number;
|
||||
schema?: any;
|
||||
}
|
||||
|
||||
interface DbJsStatic {
|
||||
open(options: OpenOptions): Promise<Server>;
|
||||
delete(dbName: string): Promise<void>;
|
||||
cmp(key1: any, key2: any): number;
|
||||
}
|
||||
|
||||
// Query API
|
||||
|
||||
interface ExecutableQuery<T> {
|
||||
execute(): Promise<T[]>;
|
||||
}
|
||||
|
||||
interface CountableQuery<T> {
|
||||
count(): ExecutableQuery<T>;
|
||||
}
|
||||
|
||||
interface KeysQuery<T> extends DescableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DistinctableQuery<T>, MappableQuery<T> {
|
||||
}
|
||||
|
||||
interface KeyableQuery<T> {
|
||||
keys(): KeysQuery<T>;
|
||||
}
|
||||
|
||||
interface FilterQuery<T> extends KeyableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, DistinctableQuery<T>, ModifiableQuery<T>, LimitableQuery<T>, MappableQuery<T> {
|
||||
}
|
||||
|
||||
interface FilterableQuery<T> {
|
||||
filter<TValue>(index: string, value: TValue): FilterQuery<T>;
|
||||
filter(filter: (value: T) => boolean): FilterQuery<T>;
|
||||
}
|
||||
|
||||
interface DescQuery<T> extends KeyableQuery<T>, CountableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, ModifiableQuery<T>, MappableQuery<T> {
|
||||
}
|
||||
|
||||
interface DescableQuery<T> {
|
||||
desc(): DescQuery<T>;
|
||||
}
|
||||
|
||||
interface DistinctQuery<T> extends KeyableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, ModifiableQuery<T>, MappableQuery<T>, CountableQuery<T> {
|
||||
}
|
||||
|
||||
interface DistinctableQuery<T> {
|
||||
distinct(filter?: (value: T) => boolean): DistinctQuery<T>;
|
||||
}
|
||||
|
||||
interface ModifiableQuery<T> {
|
||||
modify(filter: (value: T) => boolean): ExecutableQuery<T>;
|
||||
modify(modifyObj: any): ExecutableQuery<T>;
|
||||
}
|
||||
|
||||
interface LimitableQuery<T> {
|
||||
limit(n: any, m: any): ExecutableQuery<T>;
|
||||
}
|
||||
|
||||
interface MappableQuery<T> {
|
||||
map<TMap>(fn: (value: T) => TMap): Query<TMap>;
|
||||
}
|
||||
|
||||
interface Query<T> extends Promise<T>, KeyableQuery<T>, ExecutableQuery<T>, FilterableQuery<T>, DescableQuery<T>, DistinctableQuery<T>, ModifiableQuery<T>, LimitableQuery<T>, MappableQuery<T>, CountableQuery<T> {
|
||||
}
|
||||
|
||||
interface IndexQuery<T> extends Query<T> {
|
||||
only(...args: any[]): Query<T>;
|
||||
bound(lowerBound: any, upperBound: any): Query<T>;
|
||||
upperBound(upperBound: any): Query<T>;
|
||||
lowerBound(lowerBound: any): Query<T>;
|
||||
range(opts: any): Query<T>;
|
||||
all(): Query<T>;
|
||||
}
|
||||
|
||||
interface KeyValuePair<TKey, TValue> {
|
||||
key: TKey;
|
||||
item: TValue;
|
||||
}
|
||||
|
||||
interface BaseServer {
|
||||
getIndexedDB(): IDBDatabase;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface IndexAccessibleServer {
|
||||
[store: string]: TypedObjectStoreServer<any>;
|
||||
}
|
||||
|
||||
interface ObjectStoreServer {
|
||||
add<T>(table: string, entity: T): Promise<T>;
|
||||
add<T>(table: string, ...entities: T[]): Promise<T[]>;
|
||||
add<TKey, TValue>(table: string, entity: KeyValuePair<TKey, TValue>): Promise<KeyValuePair<TKey, TValue>>;
|
||||
add<TKey, TValue>(table: string, ...entities: KeyValuePair<TKey, TValue>[]): Promise<KeyValuePair<TKey, TValue>[]>;
|
||||
update<T>(table: string, entity: T): Promise<T>;
|
||||
update<T>(table: string, ...entities: T[]): Promise<T[]>;
|
||||
update<TKey, TValue>(table: string, entity: KeyValuePair<TKey, TValue>): Promise<KeyValuePair<TKey, TValue>>;
|
||||
update<TKey, TValue>(table: string, ...entities: KeyValuePair<TKey, TValue>[]): Promise<KeyValuePair<TKey, TValue>[]>;
|
||||
remove<TKey>(table: string, key: TKey): Promise<TKey>;
|
||||
remove<TKey>(table: string, ...keys: TKey[]): Promise<TKey[]>;
|
||||
clear(table: string): Promise<void>;
|
||||
get<T>(table: string, key: any): Promise<T>;
|
||||
query<T>(table: string): IndexQuery<T>;
|
||||
query<T>(table: string, index: string): IndexQuery<T>;
|
||||
count(): Promise<number>;
|
||||
count(keyOrRange: any): Promise<number>;
|
||||
count(table: string, key: any): Promise<number>;
|
||||
addEventListener(type: 'abort', listener: (ev: Event) => any): void;
|
||||
addEventListener(type: 'versionchange', listener: (ev: Event) => any): void;
|
||||
addEventListener(type: 'error', listener: (err: Error) => any): void;
|
||||
addEventListener(type: string, listener: EventListener | ErrorListener): void;
|
||||
abort(listener: (ev: Event) => any): ObjectStoreServer;
|
||||
versionchange(listener: (ev: Event) => any): ObjectStoreServer;
|
||||
error(listener: (ev: Error) => any): ObjectStoreServer;
|
||||
}
|
||||
|
||||
interface TypedObjectStoreServer<T> {
|
||||
add(entity: T): Promise<T>;
|
||||
add(...entities: T[]): Promise<T[]>;
|
||||
add<TKey, TValue>(entity: KeyValuePair<TKey, TValue>): Promise<KeyValuePair<TKey, TValue>>;
|
||||
add<TKey, TValue>(...entities: KeyValuePair<TKey, TValue>[]): Promise<KeyValuePair<TKey, TValue>[]>;
|
||||
update(entity: T): Promise<T>;
|
||||
update(...entities: T[]): Promise<T[]>;
|
||||
update<TKey, TValue>(entity: KeyValuePair<TKey, TValue>): Promise<KeyValuePair<TKey, TValue>>;
|
||||
update<TKey, TValue>(...entities: KeyValuePair<TKey, TValue>[]): Promise<KeyValuePair<TKey, TValue>[]>;
|
||||
remove<TKey>(key: TKey): Promise<TKey>;
|
||||
remove<TKey>(...keys: TKey[]): Promise<TKey[]>;
|
||||
clear(): Promise<void>;
|
||||
get(key: any): Promise<T>;
|
||||
query(): IndexQuery<T>;
|
||||
query(index: string): IndexQuery<T>;
|
||||
count(key: any): Promise<number>;
|
||||
}
|
||||
|
||||
type Server = DbJs.IndexAccessibleServer & DbJs.ObjectStoreServer & DbJs.BaseServer;
|
||||
}
|
||||
|
||||
declare module "db" {
|
||||
var db: DbJs.DbJsStatic;
|
||||
export = db;
|
||||
}
|
||||
|
||||
declare var db: DbJs.DbJsStatic;
|
||||
7443
devextreme/devextreme-15.2.9.d.ts
vendored
Normal file
7443
devextreme/devextreme-15.2.9.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
353
devextreme/devextreme.d.ts
vendored
353
devextreme/devextreme.d.ts
vendored
File diff suppressed because it is too large
Load Diff
35
df-visible/df-visible-tests.ts
Normal file
35
df-visible/df-visible-tests.ts
Normal file
@ -0,0 +1,35 @@
|
||||
/// <reference path="df-visible.d.ts" />
|
||||
|
||||
// https://github.com/customd/jquery-visible/blob/master/examples/demo-basic.html
|
||||
$(function(){
|
||||
|
||||
// Add the spans to the container element.
|
||||
$('#container dt').each(function(){ $(this).append('<span></span>'); });
|
||||
|
||||
// Trigger the
|
||||
$('#detect').on('click',function(){
|
||||
|
||||
// Select the detection type.
|
||||
var detectPartial = $('#detect_type').val() == 'partial';
|
||||
|
||||
// Loop over each container, and check if it's visible.
|
||||
$('#container dt').each(function(){
|
||||
|
||||
// Is this element visible onscreen?
|
||||
var visible = $(this).visible( detectPartial );
|
||||
|
||||
// Set the visible status into the span.
|
||||
$(this).find('span').text( visible ? 'Onscreen' : 'Offscreen' ).toggleClass('visible',visible);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// https://www.customd.com/articles/13/checking-if-an-element-is-visible-on-screen-using-jquery
|
||||
// Check both vertical, and horizontal at once
|
||||
$('#element').visible(true, false, 'both');
|
||||
|
||||
// Check only horizontal
|
||||
$('#element').visible(true, false, 'horizontal');
|
||||
|
||||
// Check only vertical
|
||||
$('#element').visible(true, false, 'vertical');
|
||||
18
df-visible/df-visible.d.ts
vendored
Normal file
18
df-visible/df-visible.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Type definitions for jquery-visible
|
||||
// Project: https://github.com/customd/jquery-visible
|
||||
// Definitions by: Andrey Lipatkin <https://github.com/Litee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
type Direction = "horizontal" | "vertical" | "both";
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Gets the value of a setting.
|
||||
* @param details Which setting to consider.
|
||||
* @param callback The callback parameter should be a function that looks like this:
|
||||
* function(object details) {...};
|
||||
*/
|
||||
visible(partial?: boolean, hidden?: boolean, direction?: Direction): boolean;
|
||||
}
|
||||
@ -30,4 +30,8 @@ gantt.load("/data/events");
|
||||
//events
|
||||
gantt.attachEvent("onBeforeLightbox", function (id?: string) {
|
||||
gantt.showTask(id);
|
||||
});
|
||||
});
|
||||
|
||||
//gantt enterprise
|
||||
var gantt2 = Gantt.getGanttInstance();
|
||||
gantt2.config.api_date = "format";
|
||||
938
dhtmlxgantt/dhtmlxgantt.d.ts
vendored
938
dhtmlxgantt/dhtmlxgantt.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -30,4 +30,11 @@ scheduler.load("/data/events");
|
||||
//events
|
||||
scheduler.attachEvent("onEmptyClick", function (ev?: Event) {
|
||||
var date: Date = scheduler.getActionData(ev).date;
|
||||
});
|
||||
});
|
||||
|
||||
//filters
|
||||
scheduler.filter_week = (id: string, e: Event) => true;
|
||||
|
||||
//enterprise version
|
||||
var scheduler2 = Scheduler.getSchedulerInstance();
|
||||
scheduler2.addEvent({ some: 1 });
|
||||
648
dhtmlxscheduler/dhtmlxscheduler.d.ts
vendored
648
dhtmlxscheduler/dhtmlxscheduler.d.ts
vendored
File diff suppressed because it is too large
Load Diff
2
dojo/dojo.d.ts
vendored
2
dojo/dojo.d.ts
vendored
@ -649,7 +649,7 @@ declare namespace dojo {
|
||||
* @param url URL to request
|
||||
* @param options OptionalOptions for the request.
|
||||
*/
|
||||
interface xhr { (url: String, options?: dojo.request.xhr.__Options): void }
|
||||
interface xhr { (url: String, options?: dojo.request.xhr.__Options): dojo.request.__Promise }
|
||||
interface xhr {
|
||||
/**
|
||||
* Send an HTTP DELETE request using XMLHttpRequest with the given URL and options.
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
$("span").dotdotdot({ ellipsis: ":::" });
|
||||
$("span").dotdotdot({ wrap: "letter" });
|
||||
$("span").dotdotdot({ fallbackToLetter: false });
|
||||
$("span").dotdotdot({ after: "a.after" });
|
||||
$("span").dotdotdot({ after: $("#after") });
|
||||
$("span").dotdotdot({ watch: true });
|
||||
$("span").dotdotdot({ height: 42 });
|
||||
|
||||
2
dotdotdot/dotdotdot.d.ts
vendored
2
dotdotdot/dotdotdot.d.ts
vendored
@ -31,7 +31,7 @@ declare namespace JQueryDotDotDot {
|
||||
/** jQuery-selector for the element to keep and put after the ellipsis.
|
||||
* Default: null
|
||||
*/
|
||||
after?: JQuery;
|
||||
after?: string | JQuery;
|
||||
|
||||
/** Whether to update the ellipsis: true/'window'
|
||||
* Default: false
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user