mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' into handleExtraObjectLiteralProperties
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/// <reference path="angular-ui-tree.d.ts" />
|
||||
|
||||
var treeNode: AngularUITree.ITreeNode = {
|
||||
id: 0,
|
||||
nodes: [],
|
||||
title: "test"
|
||||
};
|
||||
|
||||
var treeNode2: AngularUITree.ITreeNode = {
|
||||
id: "0",
|
||||
nodes: [treeNode],
|
||||
title: "test2"
|
||||
};
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for angular-ui-tree v2.8.0
|
||||
// Project: https://github.com/angular-ui-tree/angular-ui-tree
|
||||
// Definitions by: Calvin Fernandez <https://github.com/CalvinFernandez>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module AngularUITree {
|
||||
/**
|
||||
* Node in list
|
||||
*/
|
||||
interface ITreeNode {
|
||||
id: number | string;
|
||||
nodes: ITreeNode[];
|
||||
title: string;
|
||||
}
|
||||
}
|
||||
+5920
File diff suppressed because it is too large
Load Diff
Vendored
+231
-86
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.35
|
||||
// Type definitions for Angular v2.0.0-alpha.36
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -1158,9 +1158,9 @@ declare module ng {
|
||||
|
||||
descendants: boolean;
|
||||
|
||||
isViewQuery: void;
|
||||
isViewQuery: any;
|
||||
|
||||
selector: void;
|
||||
selector: any;
|
||||
|
||||
isVarBindingQuery: boolean;
|
||||
|
||||
@@ -1200,7 +1200,7 @@ declare module ng {
|
||||
|
||||
attributeName: string;
|
||||
|
||||
token: void;
|
||||
token: any;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
@@ -1250,7 +1250,7 @@ declare module ng {
|
||||
* };
|
||||
*
|
||||
* MyComponent.annotations = [
|
||||
* new ng.Component({...})
|
||||
* new ng.Component({...}),
|
||||
* new ng.View({...})
|
||||
* ]
|
||||
* MyComponent.parameters = [
|
||||
@@ -1335,7 +1335,7 @@ declare module ng {
|
||||
* };
|
||||
*
|
||||
* MyComponent.annotations = [
|
||||
* new ng.Component({...})
|
||||
* new ng.Component({...}),
|
||||
* new ng.View({...})
|
||||
* ]
|
||||
* ```
|
||||
@@ -1512,7 +1512,7 @@ declare module ng {
|
||||
* };
|
||||
*
|
||||
* MyComponent.annotations = [
|
||||
* new ng.Component({...})
|
||||
* new ng.Component({...}),
|
||||
* new ng.View({...})
|
||||
* ]
|
||||
* ```
|
||||
@@ -1585,7 +1585,7 @@ declare module ng {
|
||||
* };
|
||||
*
|
||||
* MyComponent.annotations = [
|
||||
* new ng.Component({...})
|
||||
* new ng.Component({...}),
|
||||
* new ng.View({...})
|
||||
* ]
|
||||
* MyComponent.parameters = [
|
||||
@@ -1604,7 +1604,7 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* {@link ViewQueryMetadata} factory function.
|
||||
* {@link di/ViewQueryMetadata} factory function.
|
||||
*/
|
||||
var ViewQuery : QueryFactory ;
|
||||
|
||||
@@ -2020,6 +2020,8 @@ declare module ng {
|
||||
*/
|
||||
class WrappedValue {
|
||||
|
||||
static wrap(value: any): WrappedValue;
|
||||
|
||||
wrapped: any;
|
||||
}
|
||||
|
||||
@@ -2075,6 +2077,30 @@ declare module ng {
|
||||
*/
|
||||
class IterableDiffers {
|
||||
|
||||
static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers;
|
||||
|
||||
|
||||
/**
|
||||
* Takes an array of {@link IterableDifferFactory} and returns a binding used to extend the
|
||||
* inherited {@link IterableDiffers} instance with the provided factories and return a new
|
||||
* {@link IterableDiffers} instance.
|
||||
*
|
||||
* The following example shows how to extend an existing list of factories,
|
||||
* which will only be applied to the injector for this component and its children.
|
||||
* This step is all that's required to make a new {@link IterableDiffer} available.
|
||||
*
|
||||
* # Example
|
||||
*
|
||||
* ```
|
||||
* @Component({
|
||||
* viewBindings: [
|
||||
* IterableDiffers.extend([new ImmutableListDiffer()])
|
||||
* ]
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
static extend(factories: IterableDifferFactory[]): Binding;
|
||||
|
||||
factories: IterableDifferFactory[];
|
||||
|
||||
find(iterable: Object): IterableDifferFactory;
|
||||
@@ -2104,6 +2130,30 @@ declare module ng {
|
||||
*/
|
||||
class KeyValueDiffers {
|
||||
|
||||
static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers;
|
||||
|
||||
|
||||
/**
|
||||
* Takes an array of {@link KeyValueDifferFactory} and returns a binding used to extend the
|
||||
* inherited {@link KeyValueDiffers} instance with the provided factories and return a new
|
||||
* {@link KeyValueDiffers} instance.
|
||||
*
|
||||
* The following example shows how to extend an existing list of factories,
|
||||
* which will only be applied to the injector for this component and its children.
|
||||
* This step is all that's required to make a new {@link KeyValueDiffer} available.
|
||||
*
|
||||
* # Example
|
||||
*
|
||||
* ```
|
||||
* @Component({
|
||||
* viewBindings: [
|
||||
* KeyValueDiffers.extend([new ImmutableMapDiffer()])
|
||||
* ]
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
static extend(factories: KeyValueDifferFactory[]): Binding;
|
||||
|
||||
factories: KeyValueDifferFactory[];
|
||||
|
||||
find(kv: Object): KeyValueDifferFactory;
|
||||
@@ -2147,41 +2197,6 @@ declare module ng {
|
||||
const APP_COMPONENT : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Angular's representation of an Application.
|
||||
*
|
||||
* `ApplicationRef` represents a running application instance. Use it to retrieve the host
|
||||
* component, injector,
|
||||
* or dispose of an application.
|
||||
*/
|
||||
interface ApplicationRef {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current {@link ComponentMetadata} type.
|
||||
*/
|
||||
hostComponentType: Type;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current {@link ComponentMetadata} instance.
|
||||
*/
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Dispose (un-load) the application.
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the root application {@link Injector}.
|
||||
*/
|
||||
injector: Injector;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bootstrapping for Angular applications.
|
||||
*
|
||||
@@ -2323,6 +2338,41 @@ declare module ng {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Angular's representation of an Application.
|
||||
*
|
||||
* `ApplicationRef` represents a running application instance. Use it to retrieve the host
|
||||
* component, injector,
|
||||
* or dispose of an application.
|
||||
*/
|
||||
interface ApplicationRef {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current {@link ComponentMetadata} type.
|
||||
*/
|
||||
hostComponentType: Type;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current {@link ComponentMetadata} instance.
|
||||
*/
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Dispose (un-load) the application.
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the root application {@link Injector}.
|
||||
*/
|
||||
injector: Injector;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies app root url for the application.
|
||||
*
|
||||
@@ -2338,7 +2388,7 @@ declare module ng {
|
||||
/**
|
||||
* Returns the base URL of the currently running application.
|
||||
*/
|
||||
value: void;
|
||||
value: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -3031,9 +3081,10 @@ declare module ng {
|
||||
* A reference to an Angular ProtoView.
|
||||
*
|
||||
* A ProtoView is a reference to a template for easy creation of views.
|
||||
* (See {@link AppViewManager#createViewInContainer} and {@link AppViewManager#createRootHostView}).
|
||||
* (See {@link AppViewManager#createViewInContainer `AppViewManager#createViewInContainer`} and
|
||||
* {@link AppViewManager#createRootHostView `AppViewManager#createRootHostView`}).
|
||||
*
|
||||
* A `ProtoView` is a foctary for creating `View`s.
|
||||
* A `ProtoView` is a factory for creating `View`s.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
@@ -3303,7 +3354,7 @@ declare module ng {
|
||||
*/
|
||||
class InjectMetadata {
|
||||
|
||||
token: void;
|
||||
token: any;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
@@ -3458,7 +3509,7 @@ declare module ng {
|
||||
*/
|
||||
class DependencyMetadata {
|
||||
|
||||
token: void;
|
||||
token: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -3544,6 +3595,52 @@ declare module ng {
|
||||
class Injector {
|
||||
|
||||
|
||||
/**
|
||||
* Turns a list of binding definitions into an internal resolved list of resolved bindings.
|
||||
*
|
||||
* A resolution is a process of flattening multiple nested lists and converting individual
|
||||
* bindings into a list of {@link ResolvedBinding}s. The resolution can be cached by `resolve`
|
||||
* for the {@link Injector} for performance-sensitive code.
|
||||
*
|
||||
* @param `bindings` can be a list of `Type`, {@link Binding}, {@link ResolvedBinding}, or a
|
||||
* recursive list of more bindings.
|
||||
*
|
||||
* The returned list is sparse, indexed by `id` for the {@link Key}. It is generally not useful to
|
||||
* application code
|
||||
* other than for passing it to {@link Injector} functions that require resolved binding lists,
|
||||
* such as
|
||||
* `fromResolvedBindings` and `createChildFromResolved`.
|
||||
*/
|
||||
static resolve(bindings: List<Type | Binding | List<any>>): List<ResolvedBinding>;
|
||||
|
||||
|
||||
/**
|
||||
* Resolves bindings and creates an injector based on those bindings. This function is slower than
|
||||
* the corresponding `fromResolvedBindings` because it needs to resolve bindings first. See
|
||||
* `resolve`
|
||||
* for the {@link Injector}.
|
||||
*
|
||||
* Prefer `fromResolvedBindings` in performance-critical code that creates lots of injectors.
|
||||
*
|
||||
* @param `bindings` can be a list of `Type`, {@link Binding}, {@link ResolvedBinding}, or a
|
||||
* recursive list of more
|
||||
* bindings.
|
||||
* @param `depProvider`
|
||||
*/
|
||||
static resolveAndCreate(bindings: List<Type | Binding | List<any>>, depProvider?: DependencyProvider): Injector;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an injector from previously resolved bindings. This bypasses resolution and flattening.
|
||||
* This API is the recommended way to construct injectors in performance-sensitive parts.
|
||||
*
|
||||
* @param `bindings` A sparse list of {@link ResolvedBinding}s. See `resolve` for the
|
||||
* {@link Injector}.
|
||||
* @param `depProvider`
|
||||
*/
|
||||
static fromResolvedBindings(bindings: List<ResolvedBinding>, depProvider?: DependencyProvider): Injector;
|
||||
|
||||
|
||||
/**
|
||||
* Returns debug information about the injector.
|
||||
*
|
||||
@@ -3699,7 +3796,7 @@ declare module ng {
|
||||
/**
|
||||
* Token used when retrieving this binding. Usually the `Type`.
|
||||
*/
|
||||
token: void;
|
||||
token: any;
|
||||
|
||||
|
||||
/**
|
||||
@@ -3748,7 +3845,7 @@ declare module ng {
|
||||
* expect(injector.get(String)).toEqual('Hello');
|
||||
* ```
|
||||
*/
|
||||
toValue: void;
|
||||
toValue: any;
|
||||
|
||||
|
||||
/**
|
||||
@@ -3784,7 +3881,7 @@ declare module ng {
|
||||
* expect(injectorClass.get(Vehicle) instanceof Car).toBe(true);
|
||||
* ```
|
||||
*/
|
||||
toAlias: void;
|
||||
toAlias: any;
|
||||
|
||||
|
||||
/**
|
||||
@@ -3841,7 +3938,7 @@ declare module ng {
|
||||
*/
|
||||
class BindingBuilder {
|
||||
|
||||
token: void;
|
||||
token: any;
|
||||
|
||||
|
||||
/**
|
||||
@@ -3982,6 +4079,8 @@ declare module ng {
|
||||
*/
|
||||
class Dependency {
|
||||
|
||||
static fromKey(key: Key): Dependency;
|
||||
|
||||
key: Key;
|
||||
|
||||
optional: boolean;
|
||||
@@ -4019,7 +4118,19 @@ declare module ng {
|
||||
* Keys are used internally by the {@link Injector} because their system-wide unique `id`s allow the
|
||||
* injector to index in arrays rather than looking up items in maps.
|
||||
*/
|
||||
interface Key {
|
||||
class Key {
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves a `Key` for a token.
|
||||
*/
|
||||
static get(token: Object): Key;
|
||||
|
||||
|
||||
/**
|
||||
* @returns the number of keys registered in the system.
|
||||
*/
|
||||
static numberOfKeys: number;
|
||||
|
||||
token: Object;
|
||||
|
||||
@@ -4075,7 +4186,7 @@ declare module ng {
|
||||
|
||||
addKey(injector: Injector, key: Key): void;
|
||||
|
||||
context: void;
|
||||
context: any;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
@@ -4280,7 +4391,7 @@ declare module ng {
|
||||
* instead of writing:
|
||||
*
|
||||
* ```
|
||||
* import {If, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/angular2';
|
||||
* import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/angular2';
|
||||
* import {OtherDirective} from 'myDirectives';
|
||||
*
|
||||
* @Component({
|
||||
@@ -4288,16 +4399,16 @@ declare module ng {
|
||||
* })
|
||||
* @View({
|
||||
* templateUrl: 'myComponent.html',
|
||||
* directives: [If, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, OtherDirective]
|
||||
* directives: [NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, OtherDirective]
|
||||
* })
|
||||
* export class MyComponent {
|
||||
* ...
|
||||
* }
|
||||
* ```
|
||||
* one could enumerate all the core directives at once:
|
||||
* one could import all the core directives at once:
|
||||
*
|
||||
* ```
|
||||
* import {coreDirectives} from 'angular2/angular2';
|
||||
* import {CORE_DIRECTIVES} from 'angular2/angular2';
|
||||
* import {OtherDirective} from 'myDirectives';
|
||||
*
|
||||
* @Component({
|
||||
@@ -4305,7 +4416,7 @@ declare module ng {
|
||||
* })
|
||||
* @View({
|
||||
* templateUrl: 'myComponent.html',
|
||||
* directives: [coreDirectives, OtherDirective]
|
||||
* directives: [CORE_DIRECTIVES, OtherDirective]
|
||||
* })
|
||||
* export class MyComponent {
|
||||
* ...
|
||||
@@ -4337,9 +4448,9 @@ declare module ng {
|
||||
*/
|
||||
class NgClass {
|
||||
|
||||
initialClasses: void;
|
||||
initialClasses: any;
|
||||
|
||||
rawClass: void;
|
||||
rawClass: any;
|
||||
|
||||
onCheck(): void;
|
||||
|
||||
@@ -4379,6 +4490,10 @@ declare module ng {
|
||||
*/
|
||||
class NgFor {
|
||||
|
||||
static bulkRemove(tuples: List<RecordViewTuple>, viewContainer: ViewContainerRef): List<RecordViewTuple>;
|
||||
|
||||
static bulkInsert(tuples: List<RecordViewTuple>, viewContainer: ViewContainerRef, templateRef: TemplateRef): List<RecordViewTuple>;
|
||||
|
||||
viewContainer: ViewContainerRef;
|
||||
|
||||
templateRef: TemplateRef;
|
||||
@@ -4387,7 +4502,7 @@ declare module ng {
|
||||
|
||||
cdr: ChangeDetectorRef;
|
||||
|
||||
ngForOf: void;
|
||||
ngForOf: any;
|
||||
|
||||
onCheck(): void;
|
||||
}
|
||||
@@ -4424,7 +4539,7 @@ declare module ng {
|
||||
*/
|
||||
class NgIf {
|
||||
|
||||
ngIf: void;
|
||||
ngIf: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -4455,20 +4570,20 @@ declare module ng {
|
||||
* # Example:
|
||||
*
|
||||
* ```
|
||||
* <div ng-style="{'text-align': alignEpr}"></div>
|
||||
* <div [ng-style]="{'text-align': alignExp}"></div>
|
||||
* ```
|
||||
*
|
||||
* In the above example the `text-align` style will be updated based on the `alignEpr` value
|
||||
* In the above example the `text-align` style will be updated based on the `alignExp` value
|
||||
* changes.
|
||||
*
|
||||
* # Syntax
|
||||
*
|
||||
* - `<div ng-style="{'text-align': alignEpr}"></div>`
|
||||
* - `<div ng-style="styleExp"></div>`
|
||||
* - `<div [ng-style]="{'text-align': alignExp}"></div>`
|
||||
* - `<div [ng-style]="styleExp"></div>`
|
||||
*/
|
||||
class NgStyle {
|
||||
|
||||
rawStyle: void;
|
||||
rawStyle: any;
|
||||
|
||||
onCheck(): void;
|
||||
}
|
||||
@@ -4508,7 +4623,7 @@ declare module ng {
|
||||
*/
|
||||
class NgSwitch {
|
||||
|
||||
ngSwitch: void;
|
||||
ngSwitch: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -4529,7 +4644,7 @@ declare module ng {
|
||||
*/
|
||||
class NgSwitchWhen {
|
||||
|
||||
ngSwitchWhen: void;
|
||||
ngSwitchWhen: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -4782,7 +4897,7 @@ declare module ng {
|
||||
*/
|
||||
class NgControlName extends NgControl {
|
||||
|
||||
update: void;
|
||||
update: any;
|
||||
|
||||
model: any;
|
||||
|
||||
@@ -4855,7 +4970,7 @@ declare module ng {
|
||||
|
||||
form: Control;
|
||||
|
||||
update: void;
|
||||
update: any;
|
||||
|
||||
model: any;
|
||||
|
||||
@@ -4893,7 +5008,7 @@ declare module ng {
|
||||
*/
|
||||
class NgModel extends NgControl {
|
||||
|
||||
update: void;
|
||||
update: any;
|
||||
|
||||
model: any;
|
||||
|
||||
@@ -5055,7 +5170,7 @@ declare module ng {
|
||||
|
||||
directives: List<NgControl>;
|
||||
|
||||
ngSubmit: void;
|
||||
ngSubmit: any;
|
||||
|
||||
onChange(_: any): void;
|
||||
|
||||
@@ -5119,7 +5234,7 @@ declare module ng {
|
||||
|
||||
form: ControlGroup;
|
||||
|
||||
ngSubmit: void;
|
||||
ngSubmit: any;
|
||||
|
||||
formDirective: Form;
|
||||
|
||||
@@ -5175,9 +5290,9 @@ declare module ng {
|
||||
|
||||
cd: NgControl;
|
||||
|
||||
onChange: void;
|
||||
onChange: any;
|
||||
|
||||
onTouched: void;
|
||||
onTouched: any;
|
||||
|
||||
renderer: Renderer;
|
||||
|
||||
@@ -5215,9 +5330,9 @@ declare module ng {
|
||||
|
||||
cd: NgControl;
|
||||
|
||||
onChange: void;
|
||||
onChange: any;
|
||||
|
||||
onTouched: void;
|
||||
onTouched: any;
|
||||
|
||||
renderer: Renderer;
|
||||
|
||||
@@ -5267,9 +5382,9 @@ declare module ng {
|
||||
|
||||
value: string;
|
||||
|
||||
onChange: void;
|
||||
onChange: any;
|
||||
|
||||
onTouched: void;
|
||||
onTouched: any;
|
||||
|
||||
renderer: Renderer;
|
||||
|
||||
@@ -5313,6 +5428,16 @@ declare module ng {
|
||||
* ```
|
||||
*/
|
||||
class Validators {
|
||||
|
||||
static required(c:Control): StringMap<string, boolean>;
|
||||
|
||||
static nullValidator(c: any): StringMap<string, boolean>;
|
||||
|
||||
static compose(validators: List<Function>): Function;
|
||||
|
||||
static group(c:ControlGroup): StringMap<string, boolean>;
|
||||
|
||||
static array(c:ControlArray): StringMap<string, boolean>;
|
||||
}
|
||||
|
||||
class NgValidator {
|
||||
@@ -5403,6 +5528,30 @@ declare module ng {
|
||||
|
||||
class RenderDirectiveMetadata {
|
||||
|
||||
static DIRECTIVE_TYPE: any;
|
||||
|
||||
static COMPONENT_TYPE: any;
|
||||
|
||||
static create({id, selector, compileChildren, events, host, properties, readAttributes, type,
|
||||
callOnDestroy, callOnChange, callOnCheck, callOnInit, callOnAllChangesDone,
|
||||
changeDetection, exportAs}: {
|
||||
id?: string,
|
||||
selector?: string,
|
||||
compileChildren?: boolean,
|
||||
events?: List<string>,
|
||||
host?: Map<string, string>,
|
||||
properties?: List<string>,
|
||||
readAttributes?: List<string>,
|
||||
type?: number,
|
||||
callOnDestroy?: boolean,
|
||||
callOnChange?: boolean,
|
||||
callOnCheck?: boolean,
|
||||
callOnInit?: boolean,
|
||||
callOnAllChangesDone?: boolean,
|
||||
changeDetection?: string,
|
||||
exportAs?: string
|
||||
}): RenderDirectiveMetadata;
|
||||
|
||||
id: any;
|
||||
|
||||
selector: string;
|
||||
@@ -5668,8 +5817,6 @@ declare module ng {
|
||||
*/
|
||||
const APP_ID : OpaqueToken ;
|
||||
|
||||
const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Defines when a compiled template should be stored as a string
|
||||
@@ -5764,8 +5911,6 @@ declare module ng {
|
||||
|
||||
var ComponentRef: InjectableReference;
|
||||
|
||||
var Key: InjectableReference;
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/angular2" {
|
||||
|
||||
Vendored
+689
@@ -0,0 +1,689 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.36
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/router depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2.d.ts"/>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ngRouter {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: List<RouteDefinition>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
childRouter: Router;
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canReuse(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
deactivate(nextInstruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: any;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class PathLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
const APP_BASE_HREF : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate], which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* If `onActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements OnActivate {
|
||||
* onActivate(next, prev) {
|
||||
* this.log = 'Finished navigating from ' + prev.urlPath + ' to ' + next.urlPath;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate], which is called by the router before destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
* If `onDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse], which is called by the router at the end of a
|
||||
* successful route navigation when [canReuse] is implemented and returns or resolves to true.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate], which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
* If `canDeactivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanDeactivate {
|
||||
* canDeactivate(next, prev) {
|
||||
* return askUserIfTheyAreSureTheyWantToQuit();
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse], which is called by the router to determine whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
* If `canReuse` returns or resolves to `true`, the component instance will be reused.
|
||||
*
|
||||
* If `canReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse(next, prev) {
|
||||
* return next.params.id == prev.params.id;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.id = next.params.id;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canActivate], which is called by the router to determine
|
||||
* if a component can be instantiated as part of a navigation.
|
||||
*
|
||||
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
|
||||
* This is because [canActivate] is called before the component is instantiated.
|
||||
*
|
||||
* If `canActivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canActivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'control-panel-cmp'
|
||||
* })
|
||||
* @CanActivate(() => checkIfUserIsLoggedIn())
|
||||
* class ControlPanelCmp {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
var CanActivate : (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator ;
|
||||
|
||||
|
||||
/**
|
||||
* `Instruction` is a tree of `ComponentInstructions`, with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
* This is a public API.
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
component: ComponentInstruction;
|
||||
|
||||
child: Instruction;
|
||||
|
||||
auxInstruction: StringMap<string, Instruction>;
|
||||
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*/
|
||||
class ComponentInstruction {
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: List<string>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
componentType: any;
|
||||
|
||||
resolveComponentType(): Promise<Type>;
|
||||
|
||||
specificity: any;
|
||||
|
||||
terminal: any;
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: List<Url>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runtime representation of a type.
|
||||
*
|
||||
* In JavaScript a Type is a constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
|
||||
new(args: any): any;
|
||||
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
const ROUTER_DIRECTIVES : List<any> ;
|
||||
|
||||
const ROUTER_BINDINGS : List<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
class AuxRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component?: Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
as?: string;
|
||||
|
||||
data?: any;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
type: string;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ngRouter;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
-11
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.35
|
||||
// Type definitions for Angular v2.0.0-alpha.36
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -109,7 +109,7 @@ declare module ngRouter {
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): void;
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
|
||||
/**
|
||||
@@ -214,7 +214,7 @@ declare module ngRouter {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: void;
|
||||
routeParams: any;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ declare module ngRouter {
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class HTML5LocationStrategy extends LocationStrategy {
|
||||
class PathLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
@@ -551,13 +551,13 @@ declare module ngRouter {
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
componentType: void;
|
||||
componentType: any;
|
||||
|
||||
resolveComponentType(): Promise<Type>;
|
||||
|
||||
specificity: void;
|
||||
specificity: any;
|
||||
|
||||
terminal: void;
|
||||
terminal: any;
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
@@ -594,9 +594,11 @@ declare module ngRouter {
|
||||
|
||||
}
|
||||
|
||||
const routerDirectives : List<any> ;
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
var routerInjectables : List<any> ;
|
||||
const ROUTER_DIRECTIVES : List<any> ;
|
||||
|
||||
const ROUTER_BINDINGS : List<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
@@ -667,8 +669,6 @@ declare module ngRouter {
|
||||
data?: any;
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
+281
-52
@@ -1,65 +1,294 @@
|
||||
/// <reference path="cheerio.d.ts" />
|
||||
|
||||
import cheerio = require("cheerio");
|
||||
import cheerio from 'cheerio';
|
||||
|
||||
var $ = cheerio.load("<html></html>");
|
||||
var $el = $('selector');
|
||||
var $multiEl = $('seletor', 'selector', 'selector');
|
||||
/*
|
||||
* LOADING
|
||||
*/
|
||||
let html =
|
||||
`<ul id="fruits">
|
||||
<li class="orange">Apple</li>
|
||||
<li class="class">Orange</li>
|
||||
<li class="pear">Pear</li>
|
||||
<input type="text" />
|
||||
</ul>`;
|
||||
|
||||
$el.addClass("class").addClass("test");
|
||||
$el.hasClass("test");
|
||||
$el.removeClass("class").removeClass("test");
|
||||
// Preferred Method
|
||||
var $ = cheerio.load(html);
|
||||
// Directly load element
|
||||
cheerio(html);
|
||||
cheerio('ul', html);
|
||||
cheerio('li', 'ul', html);
|
||||
|
||||
$el.attr('class');
|
||||
$el.attr('class', 'test');
|
||||
$el.removeAttr("class").removeAttr("test");
|
||||
|
||||
$el.find("ul").find("> li");
|
||||
|
||||
$el.parent().parent();
|
||||
$el.next().next();
|
||||
$el.prev().prev();
|
||||
$el.siblings().siblings();
|
||||
|
||||
$el.children().children();
|
||||
$el.children("li").children("a");
|
||||
|
||||
$el.children().each((index, element) => {
|
||||
return $(element).find('t');
|
||||
$ = cheerio.load(html, {
|
||||
normalizeWhitespace: true,
|
||||
xmlMode: true
|
||||
});
|
||||
|
||||
$el.children().map((index, element) => {
|
||||
return $(element).find('t');
|
||||
$ = cheerio.load(html, {
|
||||
normalizeWhitespace: true,
|
||||
xmlMode: true,
|
||||
decodeEntities: true,
|
||||
lowercaseTags: true,
|
||||
lowerCaseAttributeNames: true,
|
||||
recognizeCDATA: true,
|
||||
recognizeSelfClosing: true
|
||||
});
|
||||
|
||||
$el.children().filter((index) => {
|
||||
return $el.children().eq(index).find('t').length >= 0;
|
||||
});
|
||||
/**
|
||||
* Selectors
|
||||
*/
|
||||
var $el = $('.class');
|
||||
var $multiEl = $('selector', 'selector', 'selector');
|
||||
|
||||
$el.filter('span').filter('li');
|
||||
/**
|
||||
* Attributes
|
||||
*/
|
||||
|
||||
$el.first().last().find('t');
|
||||
|
||||
$('div').eq(0).find('b');
|
||||
|
||||
$('#id').append("test html", "other html").find('a');
|
||||
$('#id').prepend("test html", "other html").find('a');
|
||||
$('#id').after("test html", "other html").find('a');
|
||||
$('#id').before("test html", "other html").find('a');
|
||||
|
||||
$el.remove('div').remove('a');
|
||||
|
||||
$('#id').replaceWith('some html').parent();
|
||||
$('#id').empty().parent();
|
||||
|
||||
$el.html();
|
||||
$el.html("<html></html>").find('div');
|
||||
|
||||
$el.text();
|
||||
$el.text('some text');
|
||||
|
||||
$el.toArray();
|
||||
$el.clone().find('a').parent();
|
||||
$.root().find('a');
|
||||
// attr
|
||||
$el.attr('id');
|
||||
$el.attr('id', 'favorite').html();
|
||||
|
||||
// data
|
||||
$el.data();
|
||||
$el.data('apple-color');
|
||||
$el.data('kind', 'mac');
|
||||
|
||||
// val
|
||||
$('input[type="text"]').val();
|
||||
$('input[type="text"]').val('test').html();
|
||||
|
||||
// removeAttr
|
||||
$el.removeAttr('class').html();
|
||||
|
||||
// hasClass, addClass, removeClass, toggleClass
|
||||
$el.addClass('class').addClass('test');
|
||||
$el.hasClass('test');
|
||||
$el.removeClass('class').removeClass('test');
|
||||
$el.addClass('red').removeClass().html();
|
||||
$el.toggleClass('fruit green red').html();
|
||||
|
||||
// is
|
||||
$el.is('#id');
|
||||
$el.is($el);
|
||||
$el.is(() => {
|
||||
return true;
|
||||
});
|
||||
|
||||
/**
|
||||
* Forms
|
||||
*/
|
||||
// serializeArray
|
||||
$('<form><input name="foo" value="bar" /></form>').serializeArray();
|
||||
|
||||
/**
|
||||
* Traversing
|
||||
*/
|
||||
// find
|
||||
$el.find('li').length;
|
||||
$el.find($('.apple')).length;
|
||||
|
||||
// .parent([selector])
|
||||
$el.parent().attr('id');
|
||||
$el.parent('.class').attr('id');
|
||||
|
||||
// .parents([selector])
|
||||
$el.parents().length;
|
||||
$el.parents('.class').length;
|
||||
|
||||
// .parentsUntil([selector][,filter])
|
||||
$el.parentsUntil().length;
|
||||
$el.parentsUntil('.class').length;
|
||||
|
||||
// .closest(selector)
|
||||
$el.closest();
|
||||
$el.closest('.class');
|
||||
|
||||
// .next([selector])
|
||||
$el.next().hasClass('class');
|
||||
$el.next('.class').hasClass('class');
|
||||
|
||||
// .nextAll([selector])
|
||||
$el.nextAll().length;
|
||||
$el.nextAll('.class').length;
|
||||
|
||||
// .nextUntil([selector], [filter])
|
||||
$el.nextUntil();
|
||||
$el.nextUntil('.class');
|
||||
|
||||
// .prev([selector])
|
||||
$el.prev().hasClass('class');
|
||||
$el.prev('.class').hasClass('class');
|
||||
|
||||
// .prevAll([selector])
|
||||
$el.prevAll().length;
|
||||
$el.prevAll('.class').length;
|
||||
|
||||
// .prevUntil([selector], [filter])
|
||||
$el.prevUntil();
|
||||
$el.prevUntil('.class');
|
||||
|
||||
// .slice( start, [end] )
|
||||
$el.slice(1).eq(0).text();
|
||||
$el.slice(1, 2).length;
|
||||
|
||||
// .siblings([selector])
|
||||
$el.siblings().length;
|
||||
$el.siblings('.class').length;
|
||||
|
||||
// .children([selector])
|
||||
$el.children().length;
|
||||
$el.children('.class').text();
|
||||
|
||||
// .contents()
|
||||
$el.contents().length;
|
||||
|
||||
// .each( function(index, element) )
|
||||
$el.each((i, el) => {
|
||||
$(el).html();
|
||||
});
|
||||
|
||||
// .map( function(index, element) )
|
||||
$el.map((i, el) => {
|
||||
return $(el).text();
|
||||
}).get().join(' ');
|
||||
|
||||
// .filter
|
||||
$ = cheerio.load(html);
|
||||
$el.filter('.class').attr('class');
|
||||
$el.filter($('.class')).attr('class');
|
||||
$el.filter($('.class')[0]).attr('class');
|
||||
|
||||
$el.filter((i, el) => {
|
||||
return $(el).attr('class') === 'class';
|
||||
}).attr('class');
|
||||
|
||||
// .not
|
||||
$el.not('.class').length;
|
||||
$el.not($('.class')).length;
|
||||
$el.not($('.class')[0]).length;
|
||||
|
||||
$el.not((i, el) => {
|
||||
return $(el).attr('class') === 'class';
|
||||
}).length;
|
||||
|
||||
// .has
|
||||
$el.has('.class').attr('id');
|
||||
$el.has($el[0]).attr('id');
|
||||
|
||||
// .first()
|
||||
$el.children().first().text();
|
||||
|
||||
// .last()
|
||||
$el.children().last().text();
|
||||
|
||||
// .eq( i )
|
||||
$el.eq(0).text();
|
||||
$el.eq(-1).text();
|
||||
|
||||
// .get( [i] )
|
||||
$el.get(0).tagName;
|
||||
$el.get().length;
|
||||
|
||||
// .index()
|
||||
// .index( selector )
|
||||
// .index( nodeOrSelection )
|
||||
$el.index();
|
||||
$el.index('li');
|
||||
$el.index($('#fruit, li'));
|
||||
|
||||
// .end()
|
||||
$el.eq(0).end().length;
|
||||
|
||||
// .add
|
||||
$el.add('.class').length
|
||||
|
||||
// .addBack( [filter] )
|
||||
$el.eq(0).addBack().length
|
||||
$el.eq(0).addBack('.class').length
|
||||
|
||||
/**
|
||||
* Manipulation
|
||||
*/
|
||||
|
||||
// .append( content, [content, ...] )
|
||||
$el.append('<li class="plum">Plum</li>').html();
|
||||
$el.append('<li class="plum">Plum</li>', '<li class="plum">Plum</li>').html();
|
||||
|
||||
// .prepend( content, [content, ...] )
|
||||
$el.prepend('<li class="plum">Plum</li>').html();
|
||||
$el.prepend('<li class="plum">Plum</li>', '<li class="plum">Plum</li>').html();
|
||||
|
||||
// .after( content, [content, ...] )
|
||||
$el.after('<li class="plum">Plum</li>').html();
|
||||
$el.after('<li class="plum">Plum</li>', '<li class="plum">Plum</li>').html();
|
||||
|
||||
// .insertAfter( content )
|
||||
$('<li class="plum">Plum</li>').insertAfter('.class').html();
|
||||
|
||||
// .before( content, [content, ...] )
|
||||
$el.before('<li class="plum">Plum</li>').html();
|
||||
$el.before('<li class="plum">Plum</li>', '<li class="plum">Plum</li>').html();
|
||||
|
||||
// .insertBefore( content )
|
||||
$('<li class="plum">Plum</li>').insertBefore('.class').html();
|
||||
|
||||
// .remove( [selector] )
|
||||
$el.remove().html();
|
||||
$el.remove('.class').html();
|
||||
|
||||
// .replaceWith( content )
|
||||
$el.replaceWith($('<li class="plum">Plum</li>')).html();
|
||||
|
||||
// .empty()
|
||||
$el.empty().html();
|
||||
|
||||
// .html( [htmlString] )
|
||||
$el.html();
|
||||
$el.html('<li class="mango">Mango</li>').html();
|
||||
|
||||
// .text( [textString] )
|
||||
$el.text();
|
||||
$el.text('text');
|
||||
|
||||
// .wrap( content )
|
||||
// See https://github.com/cheeriojs/cheerio/issues/731
|
||||
// $el.wrap($('<div class="red-fruit"></div>')).html();
|
||||
|
||||
// .css
|
||||
$el.css('width');
|
||||
$el.css(['width', 'height']);
|
||||
$el.css('width', '50px');
|
||||
|
||||
/**
|
||||
* Rendering
|
||||
*/
|
||||
$.html();
|
||||
$.html('.class');
|
||||
$.xml();
|
||||
|
||||
/**
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
// .clone() ####
|
||||
$el.clone().html();
|
||||
|
||||
/**
|
||||
* Utilities
|
||||
*/
|
||||
|
||||
// $.root
|
||||
$.root().append('<ul id="vegetables"></ul>').html();
|
||||
|
||||
// $.contains( container, contained )
|
||||
$.contains($el[0], $el[0]);
|
||||
|
||||
// $.parseHTML( data [, context ] [, keepScripts ] )
|
||||
$.parseHTML(html);
|
||||
$.parseHTML(html, null, true);
|
||||
|
||||
/**
|
||||
* Not in doc
|
||||
*/
|
||||
$el.toArray();
|
||||
|
||||
Vendored
+59
-11
@@ -17,12 +17,17 @@ interface Cheerio {
|
||||
attr(name: string, value: any): Cheerio;
|
||||
|
||||
data(): any;
|
||||
data(name: string): any;
|
||||
data(name: string, value: any): any;
|
||||
|
||||
val(): string;
|
||||
val(value: string): Cheerio;
|
||||
|
||||
removeAttr(name: string): Cheerio;
|
||||
|
||||
has(selector: string): Cheerio;
|
||||
has(element: CheerioElement): Cheerio;
|
||||
|
||||
hasClass(className: string): boolean;
|
||||
addClass(classNames: string): Cheerio;
|
||||
|
||||
@@ -41,6 +46,9 @@ interface Cheerio {
|
||||
is(selection: Cheerio): boolean;
|
||||
is(func: (index: number, element: CheerioElement) => boolean): boolean;
|
||||
|
||||
// Form
|
||||
serializeArray(): {name: string, value: string}[];
|
||||
|
||||
// Traversing
|
||||
|
||||
find(selector: string): Cheerio;
|
||||
@@ -52,10 +60,12 @@ interface Cheerio {
|
||||
parentsUntil(element: CheerioElement, filter?: string): Cheerio;
|
||||
parentsUntil(element: Cheerio, filter?: string): Cheerio;
|
||||
|
||||
closest(): Cheerio;
|
||||
closest(selector: string): Cheerio;
|
||||
|
||||
next(selector?: string): Cheerio;
|
||||
nextAll(): Cheerio;
|
||||
nextAll(selector: string): Cheerio;
|
||||
|
||||
nextUntil(selector?: string, filter?: string): Cheerio;
|
||||
nextUntil(element: CheerioElement, filter?: string): Cheerio;
|
||||
@@ -63,6 +73,7 @@ interface Cheerio {
|
||||
|
||||
prev(selector?: string): Cheerio;
|
||||
prevAll(): Cheerio;
|
||||
prevAll(selector: string): Cheerio;
|
||||
|
||||
prevUntil(selector?: string, filter?: string): Cheerio;
|
||||
prevUntil(element: CheerioElement, filter?: string): Cheerio;
|
||||
@@ -83,15 +94,24 @@ interface Cheerio {
|
||||
filter(selection: Cheerio): Cheerio;
|
||||
filter(element: CheerioElement): Cheerio;
|
||||
filter(elements: CheerioElement[]): Cheerio;
|
||||
filter(func: (index: number) => boolean): Cheerio;
|
||||
filter(func: (index: number, element: CheerioElement) => boolean): Cheerio;
|
||||
|
||||
not(selector: string): Cheerio;
|
||||
not(selection: Cheerio): Cheerio;
|
||||
not(element: CheerioElement): Cheerio;
|
||||
not(func: (index: number, element: CheerioElement) => boolean): Cheerio;
|
||||
|
||||
first(): Cheerio;
|
||||
last(): Cheerio;
|
||||
|
||||
eq(index: number): Cheerio;
|
||||
|
||||
get(): Document[];
|
||||
get(index: number): Document;
|
||||
get(): CheerioElement[];
|
||||
get(index: number): CheerioElement;
|
||||
|
||||
index(): number;
|
||||
index(selector: string): number;
|
||||
index(selection: Cheerio): number;
|
||||
|
||||
end(): Cheerio;
|
||||
|
||||
@@ -101,6 +121,9 @@ interface Cheerio {
|
||||
add(elements: CheerioElement[]): Cheerio;
|
||||
add(selection: Cheerio): Cheerio;
|
||||
|
||||
addBack():Cheerio;
|
||||
addBack(filter: string):Cheerio;
|
||||
|
||||
// Manipulation
|
||||
|
||||
append(content: string, ...contents: any[]): Cheerio;
|
||||
@@ -118,11 +141,19 @@ interface Cheerio {
|
||||
after(content: Document[], ...contents: any[]): Cheerio;
|
||||
after(content: Cheerio, ...contents: any[]): Cheerio;
|
||||
|
||||
insertAfter(content: string): Cheerio;
|
||||
insertAfter(content: Document): Cheerio;
|
||||
insertAfter(content: Cheerio): Cheerio;
|
||||
|
||||
before(content: string, ...contents: any[]): Cheerio;
|
||||
before(content: Document, ...contents: any[]): Cheerio;
|
||||
before(content: Document[], ...contents: any[]): Cheerio;
|
||||
before(content: Cheerio, ...contents: any[]): Cheerio;
|
||||
|
||||
insertBefore(content: string): Cheerio;
|
||||
insertBefore(content: Document): Cheerio;
|
||||
insertBefore(content: Cheerio): Cheerio;
|
||||
|
||||
remove(selector?: string): Cheerio;
|
||||
|
||||
replaceWith(content: string): Cheerio;
|
||||
@@ -138,6 +169,11 @@ interface Cheerio {
|
||||
text(): string;
|
||||
text(text: string): Cheerio;
|
||||
|
||||
// See https://github.com/cheeriojs/cheerio/issues/731
|
||||
/*wrap(content: string): Cheerio;
|
||||
wrap(content: Document): Cheerio;
|
||||
wrap(content: Cheerio): Cheerio;*/
|
||||
|
||||
css(propertyName: string): string;
|
||||
css(propertyNames: string[]): string[];
|
||||
css(propertyName: string, value: string): Cheerio;
|
||||
@@ -172,11 +208,7 @@ interface CheerioOptionsInterface {
|
||||
normalizeWhitespace?: boolean;
|
||||
}
|
||||
|
||||
interface CheerioStatic {
|
||||
// Document References
|
||||
// Cheerio https://github.com/cheeriojs/cheerio
|
||||
// JQuery http://api.jquery.com
|
||||
|
||||
interface CheerioSelector {
|
||||
(selector: string): Cheerio;
|
||||
(selector: string, context: string): Cheerio;
|
||||
(selector: string, context: CheerioElement): Cheerio;
|
||||
@@ -187,7 +219,12 @@ interface CheerioStatic {
|
||||
(selector: string, context: CheerioElement[], root: string): Cheerio;
|
||||
(selector: string, context: Cheerio, root: string): Cheerio;
|
||||
(selector: any): Cheerio;
|
||||
}
|
||||
|
||||
interface CheerioStatic extends CheerioSelector {
|
||||
// Document References
|
||||
// Cheerio https://github.com/cheeriojs/cheerio
|
||||
// JQuery http://api.jquery.com
|
||||
xml(): string;
|
||||
root(): Cheerio;
|
||||
contains(container: CheerioElement, contained: CheerioElement): boolean;
|
||||
@@ -202,17 +239,28 @@ interface CheerioStatic {
|
||||
interface CheerioElement {
|
||||
// Document References
|
||||
// Node Console
|
||||
|
||||
tagName: string;
|
||||
type: string;
|
||||
name: string;
|
||||
attribs: Object;
|
||||
children: CheerioElement[];
|
||||
childNodes: CheerioElement[];
|
||||
lastChild: CheerioElement;
|
||||
next: CheerioElement;
|
||||
nextSibling: CheerioElement;
|
||||
prev: CheerioElement;
|
||||
previousSibling: CheerioElement;
|
||||
parent: CheerioElement;
|
||||
root: CheerioElement;
|
||||
parentNode: CheerioElement;
|
||||
nodeValue: string;
|
||||
}
|
||||
|
||||
interface CheerioAPI extends CheerioSelector {
|
||||
load(html: string, options?: CheerioOptionsInterface): CheerioStatic;
|
||||
}
|
||||
|
||||
declare var cheerio:CheerioAPI;
|
||||
|
||||
declare module "cheerio" {
|
||||
export function load(html: string, options?: CheerioOptionsInterface): CheerioStatic;
|
||||
export default cheerio;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="codemirror.d.ts" />
|
||||
/// <reference path="showhint.d.ts" />
|
||||
var doc = new CodeMirror.Doc('text');
|
||||
var pos = new CodeMirror.Pos(2, 3);
|
||||
CodeMirror.showHint(doc);
|
||||
CodeMirror.showHint(doc, function (cm) {
|
||||
return {
|
||||
from: pos,
|
||||
list: ["one", "two"],
|
||||
to: pos
|
||||
};
|
||||
});
|
||||
CodeMirror.showHint(doc, function (cm) {
|
||||
return {
|
||||
from: pos,
|
||||
list: [
|
||||
{
|
||||
text: "disp1",
|
||||
render: function (el, self, data) {
|
||||
;
|
||||
}
|
||||
},
|
||||
{
|
||||
className: "class2",
|
||||
displayText: "disp2",
|
||||
from: pos,
|
||||
to: pos,
|
||||
text: "sometext"
|
||||
}
|
||||
],
|
||||
to: pos
|
||||
};
|
||||
});
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: jacqt <https://github.com/jacqt>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module CodeMirror {
|
||||
var commands : any;
|
||||
|
||||
/** Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
|
||||
options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
|
||||
a hinting functions (the hint option), which is a function that take an editor instance and options object,
|
||||
and return a {list, from, to} object, where list is an array of strings or objects (the completions), and
|
||||
from and to give the start and end of the token that is being completed as {line, ch} objects. An optional
|
||||
selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */
|
||||
function showHint (cm: CodeMirror.Doc, hinter?: (doc : CodeMirror.Doc) => Hints, options?: IShowHintOptions) : void;
|
||||
|
||||
|
||||
interface Hints {
|
||||
from: Position;
|
||||
to: Position;
|
||||
list: Hint[] | string[];
|
||||
}
|
||||
|
||||
/** Interface used by showHint.js Codemirror add-on
|
||||
When completions aren't simple strings, they should be objects with the following properties: */
|
||||
interface Hint {
|
||||
text: string;
|
||||
className?: string;
|
||||
displayText?: string;
|
||||
from?: Position;
|
||||
render?: (element: any, self: any, data: any) => void;
|
||||
to?: Position;
|
||||
}
|
||||
|
||||
interface Editor {
|
||||
/** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */
|
||||
on(eventName: string, handler: (doc: CodeMirror.Doc, event : any ) => void ): void;
|
||||
off(eventName: string, handler: (doc: CodeMirror.Doc, event : any) => void ): void;
|
||||
}
|
||||
|
||||
/** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/
|
||||
interface Doc {
|
||||
state: any;
|
||||
showHint: (options: IShowHintOptions) => void;
|
||||
}
|
||||
|
||||
interface IShowHintOptions {
|
||||
completeSingle: boolean;
|
||||
hint: (doc : CodeMirror.Doc) => Hints;
|
||||
}
|
||||
|
||||
/** The Handle used to interact with the autocomplete dialog box.*/
|
||||
interface Handle {
|
||||
moveFocus(n: number, avoidWrap: boolean): void;
|
||||
setFocus(n: number): void;
|
||||
menuSize(): number;
|
||||
length: number;
|
||||
close(): void;
|
||||
pick(): void;
|
||||
data: any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/// <reference path="./favico.js.d.ts"/>
|
||||
|
||||
|
||||
// constructor options
|
||||
|
||||
var plain = (): favicojs.Favico => new Favico({
|
||||
});
|
||||
|
||||
var repositioned = (): favicojs.Favico => new Favico({
|
||||
position: 'upleft'
|
||||
});
|
||||
|
||||
var shaped = (): favicojs.Favico => new Favico({
|
||||
type: 'rectangle'
|
||||
});
|
||||
|
||||
var usingCustomFont = (): favicojs.Favico => new Favico({
|
||||
fontFamily: 'FontAwesome',
|
||||
elementId: 'badgefont'
|
||||
});
|
||||
|
||||
var colored = (): favicojs.Favico => new Favico({
|
||||
bgColor: '#5CB85C',
|
||||
textColor: '#ff0'
|
||||
});
|
||||
|
||||
var domBound = (): favicojs.Favico => new Favico({
|
||||
element: document.getElementById('favico')
|
||||
});
|
||||
|
||||
var iconUrlHandler = (url: string): void => {
|
||||
console.log(url);
|
||||
};
|
||||
var withDataUrl = (): favicojs.Favico => new Favico({
|
||||
dataUrl: iconUrlHandler
|
||||
});
|
||||
|
||||
|
||||
var favicons: favicojs.Favico[] = [
|
||||
plain(),
|
||||
repositioned(),
|
||||
shaped(),
|
||||
usingCustomFont(),
|
||||
colored(),
|
||||
domBound(),
|
||||
withDataUrl(),
|
||||
];
|
||||
|
||||
|
||||
// public methods
|
||||
|
||||
favicons.map(favico => {
|
||||
|
||||
// badge
|
||||
favico.badge(2);
|
||||
favico.badge(3, 'slide');
|
||||
favico.badge(3000, {animation: 'none', type: 'rectangle'});
|
||||
favico.reset();
|
||||
|
||||
// image
|
||||
favico.image(document.getElementById('image'));
|
||||
|
||||
// video
|
||||
favico.video(document.getElementById('video'));
|
||||
|
||||
// webcam
|
||||
favico.webcam();
|
||||
});
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for favico.js
|
||||
// Project: http://lab.ejci.net/favico.js/
|
||||
// Definitions by: Yu Matsushita <https://github.com/drowse314-dev-ymat>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module favicojs {
|
||||
|
||||
interface FavicoJsStatic {
|
||||
new (opt?: FavicoJsOptions): Favico;
|
||||
}
|
||||
|
||||
interface FavicoJsOptions {
|
||||
bgColor?: string;
|
||||
textColor?: string;
|
||||
fontFamily?: string;
|
||||
fontStyle?: string;
|
||||
type?: string;
|
||||
position?: string;
|
||||
animation?: string;
|
||||
elementId?: string;
|
||||
element?: HTMLElement;
|
||||
dataUrl?: (url: string) => any;
|
||||
}
|
||||
|
||||
interface Favico {
|
||||
|
||||
badge(number: number): void;
|
||||
badge(number: number, animation: string): void;
|
||||
badge(number: number, opts: FavicoJsOptions): void;
|
||||
|
||||
reset(): void;
|
||||
|
||||
image(imageElement: HTMLElement): void;
|
||||
|
||||
video(imageElement: HTMLElement): void;
|
||||
|
||||
webcam(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare var Favico: favicojs.FavicoJsStatic;
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for freedom v0.6.26
|
||||
// Project: https://github.com/freedomjs/freedom
|
||||
// Definitions by: Jonathan Pevarnek <https://github.com/jpevarnek/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./freedom.d.ts" />
|
||||
|
||||
declare var freedom :freedom.FreedomInCoreEnv;
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for freedom v0.6.26
|
||||
// Project: https://github.com/freedomjs/freedom
|
||||
// Definitions by: Jonathan Pevarnek <https://github.com/jpevarnek/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./freedom.d.ts" />
|
||||
|
||||
declare var freedom :freedom.FreedomInModuleEnv;
|
||||
@@ -0,0 +1,24 @@
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts"/>
|
||||
/// <reference path="freedom.d.ts" />
|
||||
|
||||
var freedomModule :freedom.FreedomInModuleEnv;
|
||||
var freedomCore :freedom.FreedomInCoreEnv;
|
||||
|
||||
var parentModule :freedom.ParentModuleThing = freedomModule();
|
||||
parentModule.on('message', (x :string) => {
|
||||
});
|
||||
|
||||
var coreInModule :freedom.Core = freedomModule['core']();
|
||||
coreInModule.getLogger('tag').then((logger :freedom.Logger) => {
|
||||
logger.log('message');
|
||||
});
|
||||
|
||||
var freedomConsole :freedom.Console.Console = freedomModule['core.console']();
|
||||
var doneLogging :Promise<void> = freedomConsole.log('source', 'message');
|
||||
|
||||
freedomCore('freedom-module.json', {
|
||||
'logger': 'loggingprovider.json',
|
||||
'debug': 'log'
|
||||
}).then((moduleFactory) => {
|
||||
moduleFactory.close();
|
||||
});
|
||||
Vendored
+573
@@ -0,0 +1,573 @@
|
||||
// Type definitions for freedom v0.6.26
|
||||
// Project: https://github.com/freedomjs/freedom
|
||||
// Definitions by: Jonathan Pevarnek <https://github.com/jpevarnek/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts"/>
|
||||
|
||||
declare module freedom {
|
||||
// Common on/emit for message passing interfaces.
|
||||
interface EventDispatchFn<T> { (eventType: string, value?: T): void; }
|
||||
interface EventHandlerFn<T> {
|
||||
(eventType: string, handler: (eventData:T) => void): void;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
errcode: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
// TODO: replace OnAndEmit with EventHandler and EventEmitter;
|
||||
interface OnAndEmit<T,T2> {
|
||||
on: EventHandlerFn<T>;
|
||||
emit: EventDispatchFn<T2>;
|
||||
}
|
||||
|
||||
interface EventHandler {
|
||||
// Adds |f| as an event handler for all subsiquent events of type |t|.
|
||||
on(t: string, f: Function): void;
|
||||
// Adds |f| as an event handler for only the next event of type |t|.
|
||||
once(t: string, f: Function): void;
|
||||
// The |off| function removes the event event handling function |f| from
|
||||
// both |on| and the |once| event handling.
|
||||
off(t: string, f: Function): void;
|
||||
}
|
||||
|
||||
interface PortModule<T, T2> extends OnAndEmit<T, T2> {
|
||||
controlChannel: string;
|
||||
}
|
||||
|
||||
interface ModuleSelfConstructor {
|
||||
// Identifies a named API's provider class.
|
||||
provideSynchronous: (classFn?: Function) => void;
|
||||
provideAsynchronous :(classFn?: Function) => void;
|
||||
providePromises: (classFn?: Function) => void;
|
||||
}
|
||||
|
||||
interface ParentModuleThing extends ModuleSelfConstructor, OnAndEmit<any, any> {
|
||||
}
|
||||
|
||||
interface Logger {
|
||||
debug(...args: any[]): void;
|
||||
info(...args: any[]): void;
|
||||
log(...args: any[]): void;
|
||||
warn(...args: any[]): void;
|
||||
error(...args: any[]): void;
|
||||
}
|
||||
|
||||
// See |Core_unprivileged| in |core.unprivileged.js|
|
||||
interface Core {
|
||||
// Create a new channel which which to communicate between modules.
|
||||
createChannel(): Promise<ChannelSpecifier>;
|
||||
// Given an ChannelEndpointIdentifier for a channel, create a proxy event
|
||||
// interface for it.
|
||||
bindChannel(channelIdentifier: string): Promise<Channel>;
|
||||
// Returns the list of identifiers describing the dependency path.
|
||||
getId(): Promise<string[]>;
|
||||
getLogger(tag: string): Promise<Logger>;
|
||||
}
|
||||
|
||||
// Channels are ways that freedom modules can send each other messages.
|
||||
interface Channel extends OnAndEmit<any,any> {
|
||||
close(): void;
|
||||
}
|
||||
|
||||
// Specification for a channel.
|
||||
interface ChannelSpecifier {
|
||||
channel: Channel; // How to communicate over this channel.
|
||||
// A freedom channel endpoint identifier. Can be passed over a freedom
|
||||
// message-passing boundary. It is used to create a channel to the freedom
|
||||
// module that called createChannel and created this ChannelSpecifier.
|
||||
identifier: string;
|
||||
}
|
||||
|
||||
// This is the first argument given to a core provider's constructor. It is an
|
||||
// object that describes the parent module the core provider instance has been
|
||||
// created for.
|
||||
interface CoreProviderParentApp {
|
||||
manifestId: string;
|
||||
config: {
|
||||
views: {[viewName: string]: Object};
|
||||
};
|
||||
global: {
|
||||
removeEventListener: (s: string, f: Function, b: boolean) => void;
|
||||
};
|
||||
}
|
||||
|
||||
// A Freedom module sub is both a function and an object with members. The
|
||||
// type |T| is the type of the module's stub interface.
|
||||
interface FreedomModuleFactoryManager<T> {
|
||||
// This is the factory constructor for a new instance of a stub/channel to a
|
||||
// module.
|
||||
(...args: any[]): T;
|
||||
// This is the call to close a particular stub's channel and resources. It
|
||||
// is assumed that the argument is a result of the factory constructor. If
|
||||
// no argument is supplied, all stubs are closed.
|
||||
close: (freedomModuleStubInstance?: T) => Promise<void>;
|
||||
api: string;
|
||||
}
|
||||
|
||||
interface FreedomInCoreEnvOptions {
|
||||
debug?: string; // debug level
|
||||
logger?: string; // string to json for logging provider.
|
||||
}
|
||||
|
||||
interface FreedomInCoreEnv extends OnAndEmit<any,any> {
|
||||
// Represents the call to freedom when you create a root module. Returns a
|
||||
// promise to a factory constructor for the freedom module. The
|
||||
// |manifestPath| should be a path to a json string that specifies the
|
||||
// freedom module.
|
||||
(manifestPath: string, options?: FreedomInCoreEnvOptions):
|
||||
Promise<FreedomModuleFactoryManager<any>>;
|
||||
}
|
||||
|
||||
interface FreedomInModuleEnv {
|
||||
// Represents the call to freedom(), which returns the parent module's
|
||||
// freedom stub interface in an on/emit style. This is a getter.
|
||||
(): ParentModuleThing;
|
||||
|
||||
// Creates an interface to the freedom core provider which can be used to
|
||||
// create loggers and channels.
|
||||
// Note: unlike other providers, core is a getter.
|
||||
'core': FreedomModuleFactoryManager<Core>;
|
||||
'core.console': FreedomModuleFactoryManager<Console.Console>;
|
||||
'core.rtcdatachannel': FreedomModuleFactoryManager<RTCDataChannel.RTCDataChannel>;
|
||||
'core.rtcpeerconnection': FreedomModuleFactoryManager<RTCPeerConnection.RTCPeerConnection>;
|
||||
'core.storage': FreedomModuleFactoryManager<Storage.Storage>;
|
||||
'core.tcpsocket': FreedomModuleFactoryManager<TcpSocket.Socket>;
|
||||
'core.udpsocket': FreedomModuleFactoryManager<UdpSocket.Socket>;
|
||||
'pgp': FreedomModuleFactoryManager<PgpProvider.PgpProvider>;
|
||||
'portControl': FreedomModuleFactoryManager<PortControl.PortControl>;
|
||||
|
||||
// We use this specification so that you can reference freedom sub-modules by
|
||||
// an array-lookup of its name. One day, maybe we'll have a nicer way to do
|
||||
// this.
|
||||
[moduleName: string]: FreedomModuleFactoryManager<any>;
|
||||
}
|
||||
|
||||
// This generic interface represents any freedom method. Its purpose is to extend
|
||||
// the basic definition to include the reckless call method, which does not
|
||||
// produce a reply message.
|
||||
interface Method0<R> {
|
||||
(): Promise<R>;
|
||||
reckless: () => void;
|
||||
}
|
||||
interface Method1<T, R> {
|
||||
(a: T): Promise<R>;
|
||||
reckless: (a: T) => void;
|
||||
}
|
||||
interface Method2<T, U, R> {
|
||||
(a: T, b: U) : Promise<R>;
|
||||
reckless: (a: T, b: U) => void;
|
||||
}
|
||||
interface Method3<T, U, V, R> {
|
||||
(a: T, b: U, c: V): Promise<R>;
|
||||
reckless: (a: T, b: U, c: V) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.Console {
|
||||
interface Console {
|
||||
log(source: string, message: string): Promise<void>;
|
||||
debug(source: string, message: string): Promise<void>;
|
||||
info(source: string, message: string): Promise<void>;
|
||||
warn(source: string, message: string): Promise<void>;
|
||||
error(source: string, message: string): Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.RTCDataChannel {
|
||||
interface Message {
|
||||
// Exactly one of the below must be specified.
|
||||
text?: string;
|
||||
buffer?: ArrayBuffer;
|
||||
binary?: Blob; // Not yet supported in Chrome.
|
||||
}
|
||||
|
||||
// Constructed by |freedom['rtcdatachannel'](id)| where |id| is a string
|
||||
// representing the channel id created by an |rtcpeerconnection| object.
|
||||
interface RTCDataChannel {
|
||||
getLabel(): Promise<string>;
|
||||
getOrdered(): Promise<boolean>;
|
||||
getMaxPacketLifeTime(): Promise<number>;
|
||||
getMaxRetransmits(): Promise<number>;
|
||||
getProtocol(): Promise<string>;
|
||||
getNegotiated(): Promise<boolean>;
|
||||
getId(): Promise<number>;
|
||||
getReadyState(): Promise<string>;
|
||||
getBufferedAmount(): Promise<number>;
|
||||
|
||||
on(t: 'onopen', f: () => void): void;
|
||||
on(t: 'onerror', f: () => void): void;
|
||||
on(t: 'onclose', f: () => void): void;
|
||||
on(t: 'onmessage', f: (m: Message) => void): void;
|
||||
on(t: string, f: Function): void;
|
||||
|
||||
close(): Promise<void>;
|
||||
getBinaryType(): Promise<string>;
|
||||
setBinaryType(type: string): Promise<void>;
|
||||
send: freedom.Method1<string, void>;
|
||||
sendBuffer: freedom.Method1<ArrayBuffer, void>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.RTCPeerConnection {
|
||||
interface RTCIceServer {
|
||||
urls: string[];
|
||||
username?: string;
|
||||
credential?: string;
|
||||
}
|
||||
|
||||
interface RTCConfiguration {
|
||||
iceServers: RTCIceServer[];
|
||||
iceTransports?: string;
|
||||
peerIdentity?: string;
|
||||
}
|
||||
|
||||
interface RTCOfferOptions {
|
||||
offerToReceiveVideo?: number;
|
||||
offerToReceiveAudio?: number;
|
||||
voiceActivityDetection?: boolean;
|
||||
iceRestart?: boolean;
|
||||
}
|
||||
|
||||
interface RTCSessionDescription {
|
||||
type: string;
|
||||
sdp: string;
|
||||
}
|
||||
|
||||
interface RTCIceCandidate {
|
||||
candidate: string;
|
||||
sdpMid?: string;
|
||||
sdpMLineIndex?: number;
|
||||
}
|
||||
|
||||
interface OnIceCandidateEvent {
|
||||
candidate: RTCIceCandidate
|
||||
}
|
||||
|
||||
interface RTCDataChannelInit {
|
||||
ordered?: boolean;
|
||||
maxPacketLifeTime?: number;
|
||||
maxRetransmits?: number;
|
||||
protocol?: string;
|
||||
negotiated?: boolean;
|
||||
id?: number;
|
||||
}
|
||||
|
||||
// Note: the freedom factory constructor
|
||||
// |freedom['rtcpeerconnection'](config)| to create an RTCPeerConnection has
|
||||
// |RTCConfiguration| as the type of its config its argument.
|
||||
interface RTCPeerConnection {
|
||||
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescription>;
|
||||
createAnswer(): Promise<RTCSessionDescription>;
|
||||
|
||||
setLocalDescription(desc: RTCSessionDescription): Promise<void>;
|
||||
getLocalDescription(): Promise<RTCSessionDescription>;
|
||||
setRemoteDescription(desc: RTCSessionDescription): Promise<void>;
|
||||
getRemoteDescription(): Promise<RTCSessionDescription>;
|
||||
|
||||
getSignalingState(): Promise<string>;
|
||||
|
||||
updateIce(configuration: RTCConfiguration): Promise<void>;
|
||||
|
||||
addIceCandidate(candidate: RTCIceCandidate): Promise<void>;
|
||||
|
||||
getIceGatheringState(): Promise<string>;
|
||||
getIceConnectionState(): Promise<string>;
|
||||
|
||||
getConfiguration(): Promise<RTCConfiguration>;
|
||||
|
||||
getLocalStreams(): Promise<string[]>;
|
||||
getRemoteStreams(): Promise<string[]>;
|
||||
getStreamById(id: string): Promise<string>;
|
||||
addStream(ref: string): Promise<void>;
|
||||
removeStream(ref: string): Promise<void>;
|
||||
|
||||
close(): Promise<void>;
|
||||
|
||||
createDataChannel(label: string, init: RTCDataChannelInit): Promise<string>;
|
||||
|
||||
getStats(selector?: string): Promise<any>;
|
||||
|
||||
on(t: 'ondatachannel', f: (d: {channel: string}) => void): void;
|
||||
on(t: 'onnegotiationneeded', f: () => void): void;
|
||||
on(t: 'onicecandidate', f: (d: OnIceCandidateEvent) => void): void;
|
||||
on(t: 'onsignalingstatechange', f: () => void): void;
|
||||
on(t: 'onaddstream', f: (d: {stream: number}) => void): void;
|
||||
on(t: 'onremovestream', f: (d: {stream: number}) => void): void;
|
||||
on(t: 'oniceconnectionstatechange', f: () => void): void;
|
||||
on(t: string, f: Function): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.Storage {
|
||||
interface Storage {
|
||||
// Fetch array of all keys.
|
||||
keys(): Promise<string[]>;
|
||||
// Fetch a value for a key.
|
||||
get(key: string): Promise<string>;
|
||||
// Sets a value to a key. Fulfills promise with the previous value, if it
|
||||
// exists.
|
||||
set(key: string, value: string): Promise<string>;
|
||||
// Remove a single key. Fulfills promise with previous value, if exists.
|
||||
remove(key: string): Promise<string>;
|
||||
// Remove all data from storage.
|
||||
clear(): Promise<void>;
|
||||
} // class Storage
|
||||
}
|
||||
|
||||
declare module freedom.TcpSocket {
|
||||
interface DisconnectInfo {
|
||||
errcode: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface ReadInfo {
|
||||
data: ArrayBuffer;
|
||||
}
|
||||
|
||||
interface WriteInfo {
|
||||
bytesWritten: number;
|
||||
}
|
||||
|
||||
interface SocketInfo {
|
||||
connected: boolean;
|
||||
localAddress?: string;
|
||||
localPort?: number;
|
||||
peerAddress?: string;
|
||||
peerPort?: number;
|
||||
}
|
||||
|
||||
interface ConnectInfo {
|
||||
socket: number;
|
||||
host: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
// The TcpSocket class (freedom['core.TcpSocket'])
|
||||
interface Socket {
|
||||
listen(address: string, port: number): Promise<void>;
|
||||
connect(hostname: string, port: number): Promise<void>;
|
||||
secure(): Promise<void>;
|
||||
write: freedom.Method1<ArrayBuffer, WriteInfo>;
|
||||
pause: freedom.Method0<void>;
|
||||
resume: freedom.Method0<void>;
|
||||
getInfo(): Promise<SocketInfo>;
|
||||
close(): Promise<void>;
|
||||
// TcpSockets have 3 types of events:
|
||||
on(type: 'onConnection', f: (i: ConnectInfo) => void): void;
|
||||
on(type: 'onData', f: (i:ReadInfo) => void): void;
|
||||
off(type: 'onData', f: (i: ReadInfo) => void): void;
|
||||
on(type: 'onDisconnect', f: (i: DisconnectInfo) => void): void;
|
||||
on(eventType: string, f: (i: Object) => void): void;
|
||||
off(eventType: string, f: (i: Object) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.UdpSocket {
|
||||
// Type for the chrome.socket.getInfo callback:
|
||||
// https://developer.chrome.com/apps/sockets_udp#type-SocketInfo
|
||||
// This is also the type returned by getInfo().
|
||||
interface SocketInfo {
|
||||
// Note that there are other fields but these are the ones we care about.
|
||||
localAddress: string;
|
||||
localPort: number;
|
||||
}
|
||||
|
||||
// Type for the chrome.socket.recvFrom callback:
|
||||
// http://developer.chrome.com/apps/socket#method-recvFrom
|
||||
// This is also the type returned to onData callbacks.
|
||||
interface RecvFromInfo {
|
||||
resultCode: number;
|
||||
address: string;
|
||||
port: number;
|
||||
data: ArrayBuffer;
|
||||
}
|
||||
|
||||
interface Implementation {
|
||||
bind(address: string, port: number, continuation: () => void) : void;
|
||||
sendTo(data: ArrayBuffer, address: string, port: number,
|
||||
continuation: (bytesWritten: number) => void): void;
|
||||
destroy(continuation: () => void): void;
|
||||
getInfo(continuation: (socketInfo: SocketInfo) => void): void;
|
||||
}
|
||||
|
||||
interface Socket {
|
||||
bind: (address: string, port: number) => Promise<void>;
|
||||
sendTo: freedom.Method3<ArrayBuffer, string, number, number>;
|
||||
destroy: () => Promise<void>;
|
||||
on: (name: string, listener: Function) => void;
|
||||
getInfo: () => Promise<SocketInfo>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.PgpProvider {
|
||||
interface PublicKey {
|
||||
key: string;
|
||||
fingerprint: string;
|
||||
}
|
||||
|
||||
interface VerifyDecryptResult {
|
||||
data: ArrayBuffer;
|
||||
signedBy: string[];
|
||||
}
|
||||
|
||||
interface PgpProvider {
|
||||
// Standard freedom crypto API
|
||||
setup(passphrase: string, userid: string): Promise<void>;
|
||||
clear(): Promise<void>;
|
||||
exportKey(): Promise<PublicKey>;
|
||||
signEncrypt(data: ArrayBuffer, encryptKey?: string,
|
||||
sign?: boolean): Promise<ArrayBuffer>;
|
||||
verifyDecrypt(data: ArrayBuffer,
|
||||
verifyKey?: string): Promise<VerifyDecryptResult>;
|
||||
armor(data: ArrayBuffer, type?: string): Promise<string>;
|
||||
dearmor(data: string): Promise<ArrayBuffer>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.PortControl {
|
||||
interface Mapping {
|
||||
internalIp: string;
|
||||
internalPort: number;
|
||||
externalIp?: string;
|
||||
externalPort: number;
|
||||
lifetime: number;
|
||||
protocol: string;
|
||||
timeoutId?: number;
|
||||
nonce?: number[];
|
||||
errInfo?: string;
|
||||
}
|
||||
|
||||
// A collection of Mappings
|
||||
interface ActiveMappings {
|
||||
[extPort: string]: Mapping;
|
||||
}
|
||||
|
||||
// An object returned by probeProtocolSupport()
|
||||
interface ProtocolSupport {
|
||||
natPmp: boolean;
|
||||
pcp: boolean;
|
||||
upnp: boolean;
|
||||
}
|
||||
|
||||
// Main interface for the module
|
||||
interface PortControl {
|
||||
addMapping(intPort: number, extPort: number, lifetime: number): Promise<Mapping>;
|
||||
deleteMapping(extPort: number): Promise<boolean>;
|
||||
probeProtocolSupport(): Promise<ProtocolSupport>;
|
||||
|
||||
probePmpSupport(): Promise<boolean>;
|
||||
addMappingPmp(intPort: number, extPort: number, lifetime: number): Promise<Mapping>;
|
||||
deleteMappingPmp(extPort: number): Promise<boolean>;
|
||||
|
||||
probePcpSupport(): Promise<boolean>;
|
||||
addMappingPcp(intPort: number, extPort: number, lifetime: number): Promise<Mapping>;
|
||||
deleteMappingPcp(extPort: number): Promise<boolean>;
|
||||
|
||||
probeUpnpSupport(): Promise<boolean>;
|
||||
addMappingUpnp(intPort: number, extPort: number, lifetime: number,
|
||||
controlUrl?: string): Promise<Mapping>;
|
||||
deleteMappingUpnp(extPort: number): Promise<boolean>;
|
||||
|
||||
getActiveMappings(): Promise<ActiveMappings>;
|
||||
getPrivateIps(): Promise<string[]>;
|
||||
close(): Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module freedom.Social {
|
||||
// Status of a client connected to a social network.
|
||||
interface ClientState {
|
||||
userId: string;
|
||||
clientId: string;
|
||||
status: string; // Either ONLINE, OFFLINE, or ONLINE_WITH_OTHER_APP
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
// The profile of a user on a social network.
|
||||
interface UserProfile {
|
||||
userId: string;
|
||||
name: string;
|
||||
url?: string;
|
||||
// Image URI (e.g. data:image/png;base64,adkwe329...)
|
||||
imageData?: string;
|
||||
timestamp?: number;
|
||||
}
|
||||
|
||||
interface Users {
|
||||
[userId: string]: UserProfile;
|
||||
}
|
||||
|
||||
interface Clients {
|
||||
[clientId: string]: ClientState;
|
||||
}
|
||||
|
||||
// Event for an incoming messages
|
||||
interface IncomingMessage {
|
||||
// UserID/ClientID/status of user from whom the message comes from.
|
||||
from: ClientState;
|
||||
// Message contents.
|
||||
message: string;
|
||||
}
|
||||
|
||||
// A request to login to a specific network as a specific agent
|
||||
interface LoginRequest {
|
||||
// Name of the application connecting to the network. Other logins with
|
||||
// the same agent field will be listed as having status |ONLINE|, where
|
||||
// those with different agents will be listed as
|
||||
// |ONLINE_WITH_OTHER_CLIENT|
|
||||
agent: string;
|
||||
// Version of application
|
||||
version: string;
|
||||
// URL of application
|
||||
url: string;
|
||||
// When |interactive === true| social will always prompt user for login.
|
||||
// Promise fails if the user did not login or provided invalid
|
||||
// credentials. When |interactive === false|, promise fails unless the
|
||||
// social provider has cached tokens/credentials.
|
||||
interactive: boolean;
|
||||
// When true, social provider will remember the token/credentials.
|
||||
rememberLogin: boolean;
|
||||
}
|
||||
|
||||
interface Social {
|
||||
// Generic Freedom Event stuff. |on| binds an event handler to event type
|
||||
// |eventType|. Every time |eventType| event is raised, the function |f|
|
||||
// will be called.
|
||||
//
|
||||
// Message type |onMessage| happens when the user receives a message from
|
||||
// another contact.
|
||||
on(eventType: string, f: Function) : void;
|
||||
on(eventType: 'onMessage', f: (message: IncomingMessage) => void): void;
|
||||
// Message type |onRosterProfile| events are received when another user's
|
||||
// profile is received or when a client changes status.
|
||||
on(eventType: 'onUserProfile', f: (profile: UserProfile) => void): void;
|
||||
// Message type |onMyStatus| is received when the user's client's status
|
||||
// changes, e.g. when disconnected and online status becomes offline.
|
||||
on(eventType: 'onClientState', f: (status: ClientState) => void): void;
|
||||
|
||||
// Do a singleton event binding: |f| will only be called once, on the next
|
||||
// event of type |eventType|. Same events as above.
|
||||
once(eventType: string, f: Function): void;
|
||||
|
||||
login(loginRequest: LoginRequest): Promise<ClientState>;
|
||||
getUsers(): Promise<Users>;
|
||||
getClients(): Promise<Clients>;
|
||||
|
||||
// Send a message to user on your network
|
||||
// If the message is sent to a userId, it is sent to all clients
|
||||
// If the message is sent to a clientId, it is sent to just that one client
|
||||
// If the destination id is not specified or invalid, promise rejects.
|
||||
sendMessage(destinationId: string, message: string): Promise<void>;
|
||||
|
||||
// Logs the user out of the social network. After the logout promise, the
|
||||
// user status is OFFLINE.
|
||||
logout(): Promise<void>;
|
||||
|
||||
// Forget any tokens/credentials used for logging in with the last used
|
||||
// userId.
|
||||
clearCachedCredentials(): Promise<void>;
|
||||
}
|
||||
} // declare module Social
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path="gulp-espower.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
|
||||
import espower = require('gulp-espower');
|
||||
import * as gulp from 'gulp';
|
||||
|
||||
gulp.src('src/*.coffee')
|
||||
.pipe(espower())
|
||||
.pipe(gulp.dest('out'));
|
||||
|
||||
|
||||
gulp.src('src/*.coffee')
|
||||
.pipe(espower({ patterns: ['assert(value, [message])'] }))
|
||||
.pipe(gulp.dest('out'));
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for gulp-espower
|
||||
// Project: https://github.com/power-assert-js/gulp-espower
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-espower" {
|
||||
|
||||
namespace espower {
|
||||
interface Espower {
|
||||
/**
|
||||
* @param options Target patterns for power assert feature instrumentation.
|
||||
*/
|
||||
(options?: Options): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
patterns: string[];
|
||||
}
|
||||
}
|
||||
|
||||
var espower: espower.Espower;
|
||||
|
||||
export = espower;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ function testFramework(): NodeJS.ReadWriteStream {
|
||||
return null;
|
||||
}
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.task('test', function (cb: Function) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul()) // Covering files
|
||||
.pipe(gulp.dest('test-tmp/'))
|
||||
@@ -19,7 +19,7 @@ gulp.task('test', function (cb) {
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.task('test', function (cb: Function) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul({includeUntested: true})) // Covering files
|
||||
.pipe(istanbul.hookRequire())
|
||||
@@ -31,7 +31,7 @@ gulp.task('test', function (cb) {
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.task('test', function (cb: Function) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul({includeUntested: true})) // Covering files
|
||||
.pipe(istanbul.hookRequire())
|
||||
@@ -42,4 +42,4 @@ gulp.task('test', function (cb) {
|
||||
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) //
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+4
-2
@@ -7,6 +7,8 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
declare module 'gulp-protractor' {
|
||||
import gulp = require('gulp');
|
||||
|
||||
interface IOptions {
|
||||
configFile?: string;
|
||||
args?: Array<string>;
|
||||
@@ -16,8 +18,8 @@ declare module 'gulp-protractor' {
|
||||
interface IGulpProtractor {
|
||||
getProtractorDir(): string;
|
||||
protractor(options?: IOptions): NodeJS.ReadWriteStream;
|
||||
webdriver_standalone: gulp.ITaskCallback;
|
||||
webdriver_update: gulp.ITaskCallback;
|
||||
webdriver_standalone: gulp.TaskCallback;
|
||||
webdriver_update: gulp.TaskCallback;
|
||||
}
|
||||
|
||||
var protractor: IGulpProtractor;
|
||||
|
||||
@@ -9,7 +9,7 @@ gulp.task("tsd", () => {
|
||||
.pipe(tsd());
|
||||
});
|
||||
|
||||
gulp.task("tsd:options", callback => {
|
||||
gulp.task("tsd:options", (callback: any) => {
|
||||
tsd({
|
||||
command: "reinstall",
|
||||
config: "tsd.json"
|
||||
|
||||
Vendored
+2
-1
@@ -7,6 +7,7 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
declare module "gulp-tsd" {
|
||||
import gulp = require('gulp');
|
||||
|
||||
interface IOptions {
|
||||
command?: string;
|
||||
@@ -15,7 +16,7 @@ declare module "gulp-tsd" {
|
||||
opts?: Object;
|
||||
}
|
||||
|
||||
function tsd(opts?: IOptions, callback?: gulp.ITaskCallback): NodeJS.ReadWriteStream;
|
||||
function tsd(opts?: IOptions, callback?: gulp.TaskCallback): NodeJS.ReadWriteStream;
|
||||
|
||||
export = tsd;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ gulp.task('stream', () =>
|
||||
.pipe(gulp.dest('build'))
|
||||
);
|
||||
|
||||
gulp.task('callback', (cb) =>
|
||||
gulp.task('callback', (cb: Function) =>
|
||||
watch('css/**/*.css', () =>
|
||||
gulp.src('css/**/*.css')
|
||||
.pipe(watch('css/**/*.css'))
|
||||
|
||||
+5
-2
@@ -4,8 +4,8 @@
|
||||
import gulp = require("gulp");
|
||||
import browserSync = require("browser-sync");
|
||||
|
||||
var typescript: IGulpPlugin = null; // this would be the TypeScript compiler
|
||||
var jasmine: IGulpPlugin = null; // this would be the jasmine test runner
|
||||
var typescript: gulp.GulpPlugin = null; // this would be the TypeScript compiler
|
||||
var jasmine: gulp.GulpPlugin = null; // this would be the jasmine test runner
|
||||
|
||||
gulp.task('compile', function()
|
||||
{
|
||||
@@ -31,6 +31,7 @@ gulp.task('test', ['compile', 'compile2'], function()
|
||||
gulp.task('default', ['compile', 'test']);
|
||||
|
||||
|
||||
|
||||
var opts = {};
|
||||
|
||||
gulp.watch('*.html', 'compile');
|
||||
@@ -66,3 +67,5 @@ gulp.task('serve', ['compile'], () => {
|
||||
var browser = browserSync.create();
|
||||
gulp.watch(['*.html', '*.ts'], ['compile', browser.reload]);
|
||||
});
|
||||
|
||||
gulp.start('test', 'compile');
|
||||
|
||||
Vendored
+280
-261
@@ -4,268 +4,287 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module gulp {
|
||||
|
||||
/**
|
||||
* Options to pass to node-glob through glob-stream.
|
||||
* Specifies two options in addition to those used by node-glob:
|
||||
* https://github.com/isaacs/node-glob#options
|
||||
*/
|
||||
interface ISrcOptions {
|
||||
/**
|
||||
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
|
||||
* and not read the file at all.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
read?: boolean;
|
||||
|
||||
/**
|
||||
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
|
||||
* This is useful when working with large files.
|
||||
* Note: Plugins might not implement support for streams.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/**
|
||||
* The base path of a glob.
|
||||
*
|
||||
* Default is everything before a glob starts.
|
||||
*/
|
||||
base?: string;
|
||||
|
||||
/**
|
||||
* The current working directory in which to search.
|
||||
* Defaults to process.cwd().
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* The place where patterns starting with / will be mounted onto.
|
||||
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
|
||||
*/
|
||||
root?: string;
|
||||
|
||||
/**
|
||||
* Include .dot files in normal matches and globstar matches.
|
||||
* Note that an explicit dot in a portion of the pattern will always match dot files.
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
|
||||
* filesystem path is returned. Set this flag to disable that behavior.
|
||||
*/
|
||||
nomount?: boolean;
|
||||
|
||||
/**
|
||||
* Add a / character to directory matches. Note that this requires additional stat calls.
|
||||
*/
|
||||
mark?: boolean;
|
||||
|
||||
/**
|
||||
* Don't sort the results.
|
||||
*/
|
||||
nosort?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
|
||||
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
|
||||
* level sooner in the case of cyclical symbolic links.
|
||||
*/
|
||||
stat?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
|
||||
* Set the silent option to true to suppress these warnings.
|
||||
*/
|
||||
silent?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
|
||||
* search of other matches. Set the strict option to raise an error in these cases.
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
* See cache property above. Pass in a previously generated cache object to save some fs calls.
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* A cache of results of filesystem information, to prevent unnecessary stat calls.
|
||||
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
|
||||
* options object of another, if you know that the filesystem will not change between calls.
|
||||
*/
|
||||
statCache?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a synchronous glob search.
|
||||
*/
|
||||
sync?: boolean;
|
||||
|
||||
/**
|
||||
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
|
||||
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
|
||||
*/
|
||||
nounique?: boolean;
|
||||
|
||||
/**
|
||||
* Set to never return an empty set, instead returning a set containing the pattern itself.
|
||||
* This is the default in glob(3).
|
||||
*/
|
||||
nonull?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
|
||||
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
|
||||
*/
|
||||
nocase?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in minimatch and glob.
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in glob, but not minimatch.
|
||||
*/
|
||||
globDebug?: boolean;
|
||||
}
|
||||
|
||||
interface IDestOptions {
|
||||
/**
|
||||
* The output folder. Only has an effect if provided output folder is relative.
|
||||
* Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Octal permission string specifying mode for any folders that need to be created for output folder.
|
||||
* Default: 0777.
|
||||
*/
|
||||
mode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that are passed to <code>gaze</code>.
|
||||
* https://github.com/shama/gaze
|
||||
*/
|
||||
interface IWatchOptions {
|
||||
/** Interval to pass to fs.watchFile. */
|
||||
interval?: number;
|
||||
/** Delay for events called in succession for the same file/event. */
|
||||
debounceDelay?: number;
|
||||
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
|
||||
mode?: string;
|
||||
/** The current working directory to base file patterns from. Default is process.cwd().. */
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface IWatchEvent {
|
||||
/** The type of change that occurred, either added, changed or deleted. */
|
||||
type: string;
|
||||
/** The path to the file that triggered the event. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be called on each watched file change.
|
||||
*/
|
||||
interface IWatchCallback {
|
||||
(event:IWatchEvent): void;
|
||||
}
|
||||
|
||||
interface ITaskCallback {
|
||||
/**
|
||||
* Defines a task.
|
||||
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
|
||||
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
|
||||
*/
|
||||
(cb?:(err?:any)=>void): any;
|
||||
}
|
||||
|
||||
interface EventEmitter {
|
||||
any: any;
|
||||
}
|
||||
|
||||
interface Gulp {
|
||||
/**
|
||||
* Define a task.
|
||||
*
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, fn:ITaskCallback): any;
|
||||
|
||||
/**
|
||||
* Define a task.
|
||||
*
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param dep an array of tasks to be executed and completed before your task will run.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, dep:string[], fn?:ITaskCallback): any;
|
||||
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob a glob string, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob an array of glob strings, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder the path (output folder) to write files to.
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder a function that converts a vinyl File instance into an output path
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param opt options, that are passed to the gaze library.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with gulp.task().
|
||||
*/
|
||||
watch(glob:string, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string[], fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string[], fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter;
|
||||
watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter;
|
||||
}
|
||||
}
|
||||
/// <reference path="../orchestrator/orchestrator.d.ts" />
|
||||
|
||||
declare module "gulp" {
|
||||
var _tmp:gulp.Gulp;
|
||||
export = _tmp;
|
||||
}
|
||||
import Orchestrator = require("orchestrator");
|
||||
|
||||
interface IGulpPlugin {
|
||||
(...args: any[]): NodeJS.ReadWriteStream;
|
||||
namespace gulp {
|
||||
interface Gulp extends Orchestrator {
|
||||
/**
|
||||
* Define a task
|
||||
* @param name The name of the task.
|
||||
* @param deps An array of task names to be executed and completed before your task will run.
|
||||
* @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete:
|
||||
* <ul>
|
||||
* <li>Take in a callback</li>
|
||||
* <li>Return a stream or a promise</li>
|
||||
* </ul>
|
||||
*/
|
||||
task: Orchestrator.AddMethod;
|
||||
/**
|
||||
* Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins.
|
||||
* @param glob Glob or array of globs to read.
|
||||
* @param opt Options to pass to node-glob through glob-stream.
|
||||
*/
|
||||
src: SrcMethod;
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance.
|
||||
* @param opt
|
||||
*/
|
||||
dest: DestMethod;
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param opt options, that are passed to the gaze library.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
|
||||
*/
|
||||
watch: WatchMethod;
|
||||
}
|
||||
|
||||
interface GulpPlugin {
|
||||
(...args: any[]): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface WatchMethod {
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
|
||||
*/
|
||||
(glob: string|string[], fn: (WatchCallback|string)): NodeJS.EventEmitter;
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
|
||||
*/
|
||||
(glob: string|string[], fn: (WatchCallback|string)[]): NodeJS.EventEmitter;
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param opt options, that are passed to the gaze library.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
|
||||
*/
|
||||
(glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)): NodeJS.EventEmitter;
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param opt options, that are passed to the gaze library.
|
||||
* @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task().
|
||||
*/
|
||||
(glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)[]): NodeJS.EventEmitter;
|
||||
|
||||
}
|
||||
|
||||
interface DestMethod {
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
* Folders that don't exist will be created.
|
||||
*
|
||||
* @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance.
|
||||
* @param opt
|
||||
*/
|
||||
(outFolder: string|((file: string) => string), opt?: DestOptions): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface SrcMethod {
|
||||
/**
|
||||
* Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins.
|
||||
* @param glob Glob or array of globs to read.
|
||||
* @param opt Options to pass to node-glob through glob-stream.
|
||||
*/
|
||||
(glob: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to pass to node-glob through glob-stream.
|
||||
* Specifies two options in addition to those used by node-glob:
|
||||
* https://github.com/isaacs/node-glob#options
|
||||
*/
|
||||
interface SrcOptions {
|
||||
/**
|
||||
* Setting this to <code>false</code> will return <code>file.contents</code> as <code>null</code>
|
||||
* and not read the file at all.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
read?: boolean;
|
||||
|
||||
/**
|
||||
* Setting this to false will return <code>file.contents</code> as a stream and not buffer files.
|
||||
* This is useful when working with large files.
|
||||
* Note: Plugins might not implement support for streams.
|
||||
* Default: <code>true</code>.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/**
|
||||
* The base path of a glob.
|
||||
*
|
||||
* Default is everything before a glob starts.
|
||||
*/
|
||||
base?: string;
|
||||
|
||||
/**
|
||||
* The current working directory in which to search.
|
||||
* Defaults to process.cwd().
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* The place where patterns starting with / will be mounted onto.
|
||||
* Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)
|
||||
*/
|
||||
root?: string;
|
||||
|
||||
/**
|
||||
* Include .dot files in normal matches and globstar matches.
|
||||
* Note that an explicit dot in a portion of the pattern will always match dot files.
|
||||
*/
|
||||
dot?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid
|
||||
* filesystem path is returned. Set this flag to disable that behavior.
|
||||
*/
|
||||
nomount?: boolean;
|
||||
|
||||
/**
|
||||
* Add a / character to directory matches. Note that this requires additional stat calls.
|
||||
*/
|
||||
mark?: boolean;
|
||||
|
||||
/**
|
||||
* Don't sort the results.
|
||||
*/
|
||||
nosort?: boolean;
|
||||
|
||||
/**
|
||||
* Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless
|
||||
* readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one
|
||||
* level sooner in the case of cyclical symbolic links.
|
||||
*/
|
||||
stat?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.
|
||||
* Set the silent option to true to suppress these warnings.
|
||||
*/
|
||||
silent?: boolean;
|
||||
|
||||
/**
|
||||
* When an unusual error is encountered when attempting to read a directory, the process will just continue on in
|
||||
* search of other matches. Set the strict option to raise an error in these cases.
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
* See cache property above. Pass in a previously generated cache object to save some fs calls.
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* A cache of results of filesystem information, to prevent unnecessary stat calls.
|
||||
* While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the
|
||||
* options object of another, if you know that the filesystem will not change between calls.
|
||||
*/
|
||||
statCache?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a synchronous glob search.
|
||||
*/
|
||||
sync?: boolean;
|
||||
|
||||
/**
|
||||
* In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set.
|
||||
* By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior.
|
||||
*/
|
||||
nounique?: boolean;
|
||||
|
||||
/**
|
||||
* Set to never return an empty set, instead returning a set containing the pattern itself.
|
||||
* This is the default in glob(3).
|
||||
*/
|
||||
nonull?: boolean;
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning
|
||||
* results that are case-insensitively matched anyway, since readdir and stat will not raise an error.
|
||||
*/
|
||||
nocase?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in minimatch and glob.
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Set to enable debug logging in glob, but not minimatch.
|
||||
*/
|
||||
globDebug?: boolean;
|
||||
}
|
||||
|
||||
interface DestOptions {
|
||||
/**
|
||||
* The output folder. Only has an effect if provided output folder is relative.
|
||||
* Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* Octal permission string specifying mode for any folders that need to be created for output folder.
|
||||
* Default: 0777.
|
||||
*/
|
||||
mode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that are passed to <code>gaze</code>.
|
||||
* https://github.com/shama/gaze
|
||||
*/
|
||||
interface WatchOptions {
|
||||
/** Interval to pass to fs.watchFile. */
|
||||
interval?: number;
|
||||
/** Delay for events called in succession for the same file/event. */
|
||||
debounceDelay?: number;
|
||||
/** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */
|
||||
mode?: string;
|
||||
/** The current working directory to base file patterns from. Default is process.cwd().. */
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface WatchEvent {
|
||||
/** The type of change that occurred, either added, changed or deleted. */
|
||||
type: string;
|
||||
/** The path to the file that triggered the event. */
|
||||
path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to be called on each watched file change.
|
||||
*/
|
||||
interface WatchCallback {
|
||||
(event: WatchEvent): void;
|
||||
}
|
||||
|
||||
interface TaskCallback {
|
||||
/**
|
||||
* Defines a task.
|
||||
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
|
||||
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
|
||||
*/
|
||||
(cb?: (err?: any) => void): any;
|
||||
}
|
||||
}
|
||||
|
||||
var gulp: gulp.Gulp;
|
||||
|
||||
export = gulp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference path="highcharts-ng.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
var app = angular.module('app', ['highcharts-ng']);
|
||||
|
||||
class AppController {
|
||||
chartConfig: HighChartsNGConfig = {
|
||||
options: {
|
||||
chart: {
|
||||
type: 'bar'
|
||||
},
|
||||
tooltip: {
|
||||
style: {
|
||||
padding: 10,
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
plotOptions: {}
|
||||
},
|
||||
series: [{
|
||||
data: [10, 15, 12, 8, 7]
|
||||
}],
|
||||
title: {
|
||||
text: 'My Awesome Chart'
|
||||
},
|
||||
loading: true
|
||||
};
|
||||
constructor($timeout: ng.ITimeoutService) {
|
||||
var vm = this;
|
||||
$timeout(function() {
|
||||
//Some async action
|
||||
vm.chartConfig.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
app.controller("AppController", AppController);
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for highcharts-ng 0.0.8
|
||||
// Project: https://github.com/pablojim/highcharts-ng
|
||||
// Definitions by: Scott Hatcher <https://github.com/scatcher>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../highcharts/highcharts.d.ts" />
|
||||
|
||||
interface HighChartsNGConfig {
|
||||
options: HighchartsChartOptions;
|
||||
//The below properties are watched separately for changes.
|
||||
|
||||
//Series object (optional) - a list of series using normal highcharts series options.
|
||||
series?: number[]|[number, number][]| HighchartsDataPoint[];
|
||||
//Title configuration (optional)
|
||||
title?: {
|
||||
text?: string;
|
||||
};
|
||||
//Boolean to control showng loading status on chart (optional)
|
||||
//Could be a string if you want to show specific loading text.
|
||||
loading?: boolean;
|
||||
//Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled.
|
||||
//properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum
|
||||
xAxis?: {
|
||||
currentMin?: number;
|
||||
currentMax?: number;
|
||||
title?: { text?: string }
|
||||
},
|
||||
//Whether to use HighStocks instead of HighCharts (optional). Defaults to false.
|
||||
useHighStocks?: boolean;
|
||||
//size (optional) if left out the chart will default to size of the div or something sensible.
|
||||
size?: {
|
||||
width?: number;
|
||||
height?: number;
|
||||
};
|
||||
//function (optional) - setup some logic for the chart
|
||||
func?: (chart: HighchartsChartObject) => void;
|
||||
}
|
||||
|
||||
//Instantiated Chart
|
||||
interface HighChartsNGChart extends HighChartsNGConfig {
|
||||
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
|
||||
getHighcharts(): HighchartsChartObject;
|
||||
}
|
||||
@@ -135,3 +135,11 @@ var highChartSettings: HighchartsOptions = {
|
||||
var container = $("#container").highcharts(highChartSettings, (chart) => {
|
||||
chart.series[0].setVisible(true, true);
|
||||
});
|
||||
|
||||
|
||||
var singleYAxisOptions: HighchartsOptions = {
|
||||
yAxis: {}
|
||||
};
|
||||
var multipleYAxisOptions: HighchartsOptions = {
|
||||
yAxis: [{},{}]
|
||||
};
|
||||
Vendored
+1
-1
@@ -1169,7 +1169,7 @@ interface HighchartsOptions {
|
||||
title?: HighchartsTitleOptions;
|
||||
tooltip?: HighchartsTooltipOptions;
|
||||
xAxis?: HighchartsAxisOptions;
|
||||
yAxis?: HighchartsAxisOptions;
|
||||
yAxis?: HighchartsAxisOptions|HighchartsAxisOptions[];
|
||||
}
|
||||
|
||||
interface HighchartsGlobalOptions extends HighchartsOptions {
|
||||
|
||||
+14
-5
@@ -1207,6 +1207,12 @@ result = <boolean>_(1).isArray();
|
||||
result = <boolean>_<any>([]).isArray();
|
||||
result = <boolean>_({}).isArray();
|
||||
|
||||
// _.isBoolean
|
||||
result = <boolean>_.isBoolean(any);
|
||||
result = <boolean>_(1).isBoolean();
|
||||
result = <boolean>_<any>([]).isBoolean();
|
||||
result = <boolean>_({}).isBoolean();
|
||||
|
||||
// _.isDate
|
||||
result = <boolean>_.isDate(any);
|
||||
result = <boolean>_(42).isDate();
|
||||
@@ -1260,6 +1266,12 @@ result = <boolean>_(undefined).isNaN();
|
||||
result = <boolean>_.isNative(Array.prototype.push);
|
||||
result = <boolean>_(Array.prototype.push).isNative();
|
||||
|
||||
// _.isNull
|
||||
result = <boolean>_.isNull(any);
|
||||
result = <boolean>_(1).isNull();
|
||||
result = <boolean>_<any>([]).isNull();
|
||||
result = <boolean>_({}).isNull();
|
||||
|
||||
// _.isNumber
|
||||
result = <boolean>_.isNumber(any);
|
||||
result = <boolean>_(1).isNumber();
|
||||
@@ -1473,8 +1485,6 @@ interface FirstSecond {
|
||||
}
|
||||
result = <FirstSecond>_.invert({ 'first': 'moe', 'second': 'larry' });
|
||||
|
||||
result = <boolean>_.isBoolean(null);
|
||||
|
||||
result = <boolean>_.isElement(document.body);
|
||||
|
||||
// _.isEqual (alias: _.eq)
|
||||
@@ -1502,9 +1512,6 @@ result = <boolean>_(testEqArray).isEqual(testEqOtherArray, testEqCustomizerFn);
|
||||
result = <boolean>_.eq(testEqArray, testEqOtherArray, testEqCustomizerFn);
|
||||
result = <boolean>_(testEqArray).eq(testEqOtherArray, testEqCustomizerFn);
|
||||
|
||||
result = <boolean>_.isNull(null);
|
||||
result = <boolean>_.isNull(undefined);
|
||||
|
||||
result = <boolean>_.isObject({});
|
||||
result = <boolean>_.isObject([1, 2, 3]);
|
||||
result = <boolean>_.isObject(1);
|
||||
@@ -1755,7 +1762,9 @@ result = <string>_.uniqueId();
|
||||
result = <string>_.camelCase('Foo Bar');
|
||||
result = <string>_('Foo Bar').camelCase();
|
||||
|
||||
// _.capitalize
|
||||
result = <string>_.capitalize('fred');
|
||||
result = <string>_('fred').capitalize();
|
||||
|
||||
// _.deburr
|
||||
result = <string>_.deburr('déjà vu');
|
||||
|
||||
Vendored
+43
-21
@@ -6196,6 +6196,23 @@ declare module _ {
|
||||
isArray(): boolean;
|
||||
}
|
||||
|
||||
//_.isBoolean
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if value is classified as a boolean primitive or object.
|
||||
* @param value The value to check.
|
||||
* @return Returns true if value is correctly classified, else false.
|
||||
**/
|
||||
isBoolean(value?: any): boolean;
|
||||
}
|
||||
|
||||
interface LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.isBoolean
|
||||
*/
|
||||
isBoolean(): boolean;
|
||||
}
|
||||
|
||||
//_.isDate
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -6346,6 +6363,23 @@ declare module _ {
|
||||
isNative(): boolean;
|
||||
}
|
||||
|
||||
//_.isNull
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if value is null.
|
||||
* @param value The value to check.
|
||||
* @return Returns true if value is null, else false.
|
||||
**/
|
||||
isNull(value?: any): boolean;
|
||||
}
|
||||
|
||||
interface LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* see _.isNull
|
||||
*/
|
||||
isNull(): boolean;
|
||||
}
|
||||
|
||||
//_.isNumber
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -7063,16 +7097,6 @@ declare module _ {
|
||||
invert(object: any): any;
|
||||
}
|
||||
|
||||
//_.isBoolean
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if value is a boolean value.
|
||||
* @param value The value to check.
|
||||
* @return True if the value is a boolean value, else false.
|
||||
**/
|
||||
isBoolean(value?: any): boolean;
|
||||
}
|
||||
|
||||
//_.isElement
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -7163,16 +7187,6 @@ declare module _ {
|
||||
thisArg?: any): boolean;
|
||||
}
|
||||
|
||||
//_.isNull
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if value is null.
|
||||
* @param value The value to check.
|
||||
* @return True if the value is null, else false.
|
||||
**/
|
||||
isNull(value?: any): boolean;
|
||||
}
|
||||
|
||||
//_.isObject
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -7583,8 +7597,16 @@ declare module _ {
|
||||
camelCase(): string;
|
||||
}
|
||||
|
||||
//_.capitalize
|
||||
interface LoDashStatic {
|
||||
capitalize(str?: string): string;
|
||||
capitalize(string?: string): string;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @see _.capitalize
|
||||
*/
|
||||
capitalize(): string;
|
||||
}
|
||||
|
||||
//_.deburr
|
||||
|
||||
Vendored
+11
-11
@@ -44,7 +44,7 @@ declare module Matter
|
||||
{
|
||||
/**
|
||||
* Clears the engine including the world, pairs and broadphase.
|
||||
* @param engine
|
||||
* @param engine
|
||||
*/
|
||||
static clear(engine:Engine):void;
|
||||
|
||||
@@ -844,24 +844,24 @@ declare module Matter
|
||||
*/
|
||||
type?:string;
|
||||
}
|
||||
|
||||
|
||||
export class Query
|
||||
{
|
||||
/**
|
||||
* Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided.
|
||||
*
|
||||
* @param bodies
|
||||
* @param startPoint
|
||||
* @param endPoint
|
||||
*
|
||||
* @param bodies
|
||||
* @param startPoint
|
||||
* @param endPoint
|
||||
* @param [rayWidth]
|
||||
*
|
||||
*
|
||||
* @returns Object[] Collisions
|
||||
*/
|
||||
static ray( bodies:Array<Body>, startPoint:Vector, endPoint:Vector, rayWidth?:number ):Array<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies.
|
||||
*
|
||||
*
|
||||
* @param bodies
|
||||
* @param bounds
|
||||
* @returns Body[] The bodies matching the query
|
||||
@@ -1375,7 +1375,7 @@ declare module Matter
|
||||
* @param vertices
|
||||
* @returns The polygon's moment of inertia
|
||||
*/
|
||||
static inertia( vertices:Array<Vector>, mass:number ):number;
|
||||
static inertia ( vertices:Array<Vector>, mass:number ):number;
|
||||
|
||||
/**
|
||||
* Rotates the set of vertices in-place.
|
||||
@@ -1384,7 +1384,7 @@ declare module Matter
|
||||
* @param angle
|
||||
* @param point
|
||||
*/
|
||||
static static ( vertices:Array<Vector>, angle:number, point:Vector ):void;
|
||||
static rotate ( vertices:Array<Vector>, angle:number, point:Vector ):void;
|
||||
|
||||
/**
|
||||
* Scales the vertices from a point (default is centre) in-place.
|
||||
|
||||
@@ -75,3 +75,5 @@ moment.tz.load({
|
||||
});
|
||||
|
||||
moment.tz.names();
|
||||
|
||||
moment.tz.setDefault('America/Los_Angeles');
|
||||
|
||||
Vendored
+2
@@ -68,6 +68,8 @@ interface MomentTimezone {
|
||||
}): void;
|
||||
|
||||
names(): string[];
|
||||
|
||||
setDefault(timezone: string): void;
|
||||
}
|
||||
|
||||
declare module 'moment-timezone' {
|
||||
|
||||
@@ -1,18 +1,63 @@
|
||||
///<reference path='./node-mysql-wrapper.d.ts' />
|
||||
|
||||
import wrapper = require("node-mysql-wrapper");
|
||||
var db = wrapper("mysql://kataras:pass@127.0.0.1/taglub?debug=false&charset=utf8");
|
||||
var db = wrapper.wrap("mysql://kataras:pass@127.0.0.1/taglub?debug=false&charset=utf8");
|
||||
|
||||
|
||||
|
||||
|
||||
class User { //or interface
|
||||
userId: number;
|
||||
username: string;
|
||||
mail: string;
|
||||
comments: Comment[];
|
||||
}
|
||||
|
||||
interface Comment {
|
||||
commentId: number;
|
||||
content: string;
|
||||
|
||||
}
|
||||
|
||||
db.ready(() => {
|
||||
db.table("users").on("insert", (parsedResults) => {
|
||||
var usersDb = db.table<User>("users");
|
||||
|
||||
usersDb.findById(16, (_user) => {
|
||||
console.log("TEST1: \n");
|
||||
console.log("FOUND USER WITH USERNAME: " + _user.username);
|
||||
});
|
||||
|
||||
/* OR usersDb.findById(18).then(_user=> {
|
||||
console.log("FOUND USER WITH USERNAME: " + _user.username);
|
||||
}, (err) => { console.log("ERROR ON FETCHING FINDBY ID: " + err) });
|
||||
*/
|
||||
|
||||
usersDb.find({ userId: 18, comments: { userId: '=' } }, _users=> {
|
||||
var _user = _users[0];
|
||||
console.log("TEST2: \n");
|
||||
console.log(_user.username + " with ");
|
||||
console.log(_user.comments.length + " comments ");
|
||||
_user.comments.forEach(_comment=> {
|
||||
console.log("--------------\n" + _comment.content);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
db.table("users").findAll().then((results) => {
|
||||
console.dir(results);
|
||||
usersDb.safeRemove(5620, answer=> {
|
||||
console.log("TEST 3: \n");
|
||||
console.log(answer.affectedRows + ' (1) has removed from table: ' + answer.table);
|
||||
|
||||
});
|
||||
|
||||
db.table("users").find({ userId: 18 }, (results) => {
|
||||
console.dir(results[0]);
|
||||
var auser = new User();
|
||||
auser.username = ' just a username';
|
||||
auser.mail = ' just an email';
|
||||
|
||||
usersDb.save(auser, newUser=> {
|
||||
console.log("TEST 4: \n");
|
||||
console.log("NEW USER HAS CREATED WITH NEW USER ID: " + newUser.userId);
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
+104
-104
@@ -3,129 +3,129 @@
|
||||
// Definitions by: Makis Maropoulos <https://github.com/kataras>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../mysql/mysql.d.ts' />
|
||||
///<reference path='./../mysql/mysql.d.ts' />
|
||||
///<reference path='./../bluebird/bluebird.d.ts' />
|
||||
|
||||
declare module "node-mysql-wrapper" {
|
||||
import Mysql = require("mysql");
|
||||
import * as Mysql from 'mysql';
|
||||
import * as Promise from 'bluebird';
|
||||
import {EventEmitter} from 'events';
|
||||
|
||||
function MySQLWrapperBuilder(connection: string | Mysql.IConnection, ...useOnlyTables: string[]): MySQLWrapper;
|
||||
var EQUAL_TO_PROPERTY_SYMBOL: string;
|
||||
|
||||
enum EVENT_TYPES {
|
||||
INSERT, UPDATE, DELETE, SAVE
|
||||
interface Map<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
interface MySQLConnection {
|
||||
new (connection: string | Mysql.IConnection): MySQLConnection;
|
||||
class MysqlUtil {
|
||||
constructor();
|
||||
static copyObject<T>(object: T): T;
|
||||
static toObjectProperty(columnKey: string): string;
|
||||
static toRowProperty(objectKey: string): string;
|
||||
static forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
static forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
}
|
||||
|
||||
create(connectionUri: string): void;
|
||||
create(connection: Mysql.IConnection): void;
|
||||
interface ICriteria {
|
||||
rawCriteriaObject: any;
|
||||
tables: string[];
|
||||
noDatabaseProperties: string[];
|
||||
whereClause: string;
|
||||
}
|
||||
|
||||
class Criteria implements ICriteria {
|
||||
rawCriteriaObject: any;
|
||||
tables: string[];
|
||||
noDatabaseProperties: string[];
|
||||
whereClause: string;
|
||||
constructor(rawCriteriaObject: any, tables: string[], noDatabaseProperties: string[], whereClause: string);
|
||||
}
|
||||
|
||||
class CriteriaBuilder<T> {
|
||||
private _table;
|
||||
constructor(table: MysqlTable<T>);
|
||||
build(rawCriteriaObject: any): Criteria;
|
||||
}
|
||||
|
||||
|
||||
class MysqlConnection extends EventEmitter {
|
||||
connection: Mysql.IConnection;
|
||||
eventTypes: string[];
|
||||
tableNamesToUseOnly: any[];
|
||||
tables: MysqlTable<any>[];
|
||||
constructor(connection: string | Mysql.IConnection);
|
||||
create(connection: string | Mysql.IConnection): void;
|
||||
attach(connection: Mysql.IConnection): void;
|
||||
end(callback: () => void): void;
|
||||
end(callback?: (error: any) => void): void;
|
||||
destroy(): void;
|
||||
link<U>(callback?: () => void): Promise<U>;
|
||||
connect<U>(callback?: () => void): Promise<U>;
|
||||
|
||||
useOnly(...useOnlyTables: string[]): void;
|
||||
|
||||
fetchDatabaseInfornation<U>(): Promise<U>;
|
||||
|
||||
link(readyCallback?: () => void): Promise<void>;
|
||||
useOnly(...tables: any[]): void;
|
||||
fetchDatabaseInfornation(): Promise<void>;
|
||||
escape(val: string): string;
|
||||
notice(tableWhichCalled: string, queryStr: string, parsedResults: Object[]): void;
|
||||
fireEvent(tableWhichCalled: string, queryStr: string, parsedResults: Object[]): void;
|
||||
|
||||
watch(tableName: string, evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
|
||||
on(tableName: string, evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
|
||||
unwatch(tableName: string, evtType: EVENT_TYPES | string, callbackToRemove: () => void): void;
|
||||
off(tableName: string, evtType: EVENT_TYPES | string, callbackToRemove: () => void): void;
|
||||
|
||||
query(mysqlQuery: Mysql.IQueryFunction): void;
|
||||
|
||||
table(tableName: string): MySQLTable;
|
||||
notice(tableWhichCalled: string, queryStr: string, parsedResults: any[]): void;
|
||||
watch(tableName: string, evtType: any, callback: (parsedResults: any[]) => void): void;
|
||||
unwatch(tableName: string, evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
|
||||
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
|
||||
table<T>(tableName: string): MysqlTable<T>;
|
||||
}
|
||||
|
||||
interface MySQLTable {
|
||||
new (tableName: string, connection: MySQLConnection): MySQLTable;
|
||||
|
||||
setColumns(columns: string[]): void;
|
||||
|
||||
setPrimaryKey(primaryKeyColumnName: string): void;
|
||||
|
||||
toString(): string;
|
||||
|
||||
model(jsObject: Object): MySQLModel;
|
||||
|
||||
watch(evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
|
||||
on(evtType: EVENT_TYPES | string, callback: (parsedResults: Object[]) => void): void;
|
||||
unwatch(evtType: EVENT_TYPES|string, callbackToRemove: () => void): void;
|
||||
off(evtType: EVENT_TYPES|string, callbackToRemove: () => void): void;
|
||||
|
||||
///START DYNAMIC METHODS FOR TABLES CANNOT BE PRE-DEFINED WITH DYNAMIC WAY, YET, SO:
|
||||
find<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
|
||||
save<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
|
||||
remove<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
|
||||
delete<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
|
||||
safeDelete<U>(jsObject: Object, callback?: (results: Object[]) => void): Promise<U>;
|
||||
///END
|
||||
findAll<U>(callback?: (results: Object[]) => void): Promise<U>;
|
||||
|
||||
extend(functionName: string, functionToBeSupported: () => any): void;
|
||||
|
||||
|
||||
class MysqlTable<T> {
|
||||
private _name;
|
||||
private _connection;
|
||||
private _columns;
|
||||
private _primaryKey;
|
||||
private _criteriaBuilder;
|
||||
constructor(tableName: string, connection: MysqlConnection);
|
||||
columns: string[];
|
||||
primaryKey: string;
|
||||
connection: MysqlConnection;
|
||||
name: string;
|
||||
on(evtType: string, callback: (parsedResults: any[]) => void): void;
|
||||
off(evtType: string, callbackToRemove: (parsedResults: any[]) => void): void;
|
||||
has(extendedFunctionName: string): boolean;
|
||||
|
||||
extend(functionName: string, theFunction: (...args: any[]) => any): void;
|
||||
objectFromRow(row: any): any;
|
||||
rowFromObject(obj: any): any;
|
||||
getRowAsArray(jsObject: any): Array<any>;
|
||||
getPrimaryKeyValue(jsObject: any): number | string;
|
||||
parseQueryResult(result: any, criteria: ICriteria): Promise<any>;
|
||||
find(criteriaRawJsObject: any, callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
findById(id: number | string, callback?: (result: T) => any): Promise<T>;
|
||||
findAll(callback?: (_results: T[]) => any): Promise<T[]>;
|
||||
save(criteriaRawJsObject: any, callback?: (_result: any) => any): Promise<any>;
|
||||
safeRemove(id: number | string, callback?: (_result: {
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}) => any): Promise<{
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}>;
|
||||
remove(criteriaRawJsObject: any, callback?: (_result: {
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}) => any): Promise<{
|
||||
affectedRows: number;
|
||||
table: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
interface MySQLModel {
|
||||
|
||||
new (table: MySQLTable, jsObject: Object): MySQLModel;
|
||||
|
||||
toObjectProperty(columnKey: string): string;
|
||||
toRowProperty(objectKey: string): string;
|
||||
|
||||
create(jsObject: Object): MySQLModel;
|
||||
reUse(jsObject: Object): MySQLModel;
|
||||
|
||||
toRow(): void;
|
||||
getRawObject(): Object;
|
||||
|
||||
parseTable<U>(mysqlTableToSearch: String, parentObject: Object): Promise<U>;
|
||||
parseResult<U>(result: Object, tablesToSearch: string[]): Promise<U>;
|
||||
|
||||
find<U>(parentObj?: Object): Promise<U>;
|
||||
findAll<U>(): Promise<U>;
|
||||
save<U>(): Promise<U>;
|
||||
safeDelete<U>(): Promise<U>;
|
||||
remove<U>(): Promise<U>;
|
||||
delete<U>(): Promise<U>;
|
||||
|
||||
}
|
||||
|
||||
interface MySQLWrapper {
|
||||
new (connection?: MySQLConnection): MySQLWrapper;
|
||||
|
||||
setConnection(connection: MySQLConnection): void;
|
||||
|
||||
useOnly(...useOnlyTables: string[]): void;
|
||||
|
||||
has(tableName: string): boolean;
|
||||
has(tableName: string, methodName: string): boolean;
|
||||
|
||||
class MysqlWrapper {
|
||||
connection: MysqlConnection;
|
||||
readyListenerCallbacks: Function[];
|
||||
constructor(connection?: MysqlConnection);
|
||||
static when(..._promises: Promise<any>[]): Promise<any>;
|
||||
setConnection(connection: MysqlConnection): void;
|
||||
useOnly(...useTables: any[]): void;
|
||||
has(tableName: string, functionName?: string): boolean;
|
||||
ready(callback: () => void): void;
|
||||
table<T>(tableName: string): MysqlTable<T>;
|
||||
noticeReady(): void;
|
||||
removeReadyListener(callback: () => any): void;
|
||||
|
||||
query: Mysql.IQueryFunction;
|
||||
|
||||
removeReadyListener(callback: () => void): void;
|
||||
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
|
||||
destroy(): void;
|
||||
end(callback?: () => void): void;
|
||||
|
||||
when<U>(): Promise<U[]>;
|
||||
|
||||
///START: WE CANNOT PRE-DEFINE THE DYNAMIC TABLES INTO PROPERTIES, SO WE USE INDEX(STRING-TABLENAME) TO GET A TABLE
|
||||
table(tableName: string): MySQLTable;
|
||||
///END
|
||||
end(maybeAcallbackError: (err: any) => void): void;
|
||||
}
|
||||
|
||||
export = MySQLWrapperBuilder;
|
||||
function wrap(mysqlUrlOrObjectOrMysqlAlreadyConnection: Mysql.IConnection | string, ...useTables: any[]): MysqlWrapper;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// Test file for offline-js.
|
||||
/// <reference path="offline-js.d.ts" />
|
||||
|
||||
Offline.options = {
|
||||
checkOnLoad: false,
|
||||
interceptRequests: true,
|
||||
checks: {
|
||||
xhr: { url: '/connection-test' },
|
||||
image: { url: 'my-image.gif' },
|
||||
active: 'image'
|
||||
},
|
||||
reconnect: {
|
||||
initialDelay: 3,
|
||||
delay: 60
|
||||
},
|
||||
requests: true,
|
||||
game: false
|
||||
};
|
||||
|
||||
Offline.check();
|
||||
|
||||
Offline.state;
|
||||
|
||||
var handler = () => { },
|
||||
context = {};
|
||||
|
||||
Offline.on("up", handler, context);
|
||||
Offline.on("down", handler, context);
|
||||
Offline.on("confirmed-up", handler, context);
|
||||
Offline.on("confirmed-down", handler, context);
|
||||
Offline.on("checking", handler, context);
|
||||
Offline.on("reconnect:started", handler, context);
|
||||
Offline.on("reconnect:stopped", handler, context);
|
||||
Offline.on("reconnect:tick", handler, context);
|
||||
Offline.on("reconnect:connecting", handler, context);
|
||||
Offline.on("reconnect:failure", handler, context);
|
||||
Offline.on("requests:flush", handler, context);
|
||||
Offline.on("requests:hold", handler, context);
|
||||
|
||||
Offline.off("up", handler);
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
// Type definitions for Offline 0.7.14
|
||||
// Project: https://github.com/HubSpot/offline
|
||||
// Definitions by: Chris Wrench <https://github.com/cgwrench>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var Offline: {
|
||||
options: OfflineOptions;
|
||||
check: () => void;
|
||||
state: string;
|
||||
|
||||
on(event: "up", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "down", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "confirmed-up", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "confirmed-down", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "checking", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "reconnect:started", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "reconnect:stopped", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "reconnect:tick", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "reconnect:connecting", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "reconnect:failure", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "requests:flush", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: "requests:hold", handler: (e: Event) => any, context?: any): void;
|
||||
on(event: string, handler: (e: Event) => any, context?: any): void;
|
||||
|
||||
off(event: "up", handler?: (e: Event) => any): void;
|
||||
off(event: "down", handler?: (e: Event) => any): void;
|
||||
off(event: "confirmed-up", handler?: (e: Event) => any): void;
|
||||
off(event: "confirmed-down", handler?: (e: Event) => any): void;
|
||||
off(event: "checking", handler?: (e: Event) => any): void;
|
||||
off(event: "reconnect:started", handler?: (e: Event) => any): void;
|
||||
off(event: "reconnect:stopped", handler?: (e: Event) => any): void;
|
||||
off(event: "reconnect:tick", handler?: (e: Event) => any): void;
|
||||
off(event: "reconnect:connecting", handler?: (e: Event) => any): void;
|
||||
off(event: "reconnect:failure", handler?: (e: Event) => any): void;
|
||||
off(event: "requests:flush", handler?: (e: Event) => any): void;
|
||||
off(event: "requests:hold", handler?: (e: Event) => any): void;
|
||||
off(event: string, handler?: (e: Event) => any): void;
|
||||
};
|
||||
|
||||
interface OfflineOptions {
|
||||
// TODO Should these types be `boolean|Function`?
|
||||
// The project documentation is not clear here.
|
||||
checkOnLoad?: boolean;
|
||||
interceptRequests?: boolean;
|
||||
requests?: boolean;
|
||||
game?: boolean;
|
||||
checks?: OfflineChecks;
|
||||
reconnect: {
|
||||
initialDelay: number;
|
||||
delay: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface OfflineChecks {
|
||||
// TODO "xhr" and "image" probably have different options.
|
||||
// However, this is not stated in the project documentation.
|
||||
xhr?: OfflineCheck;
|
||||
image?: OfflineCheck;
|
||||
active?: string;
|
||||
}
|
||||
|
||||
interface OfflineCheck {
|
||||
url: string;
|
||||
}
|
||||
@@ -33,6 +33,7 @@ var featureFormat: ol.format.Feature;
|
||||
var geometry: ol.geom.Geometry;
|
||||
var loadingstrategy: ol.LoadingStrategy;
|
||||
var tilegrid: ol.tilegrid.TileGrid;
|
||||
var vector: ol.source.Vector;
|
||||
|
||||
//
|
||||
// ol.Attribution
|
||||
@@ -112,6 +113,13 @@ geometryResult.getClosestPoint(coordinate, coordinate);
|
||||
extent = geometryResult.getExtent();
|
||||
geometryResult.getExtent(extent);
|
||||
|
||||
//
|
||||
// ol.source
|
||||
//
|
||||
vector = new ol.source.Vector({
|
||||
features: [feature]
|
||||
});
|
||||
|
||||
//
|
||||
// ol.Feature
|
||||
//
|
||||
|
||||
Vendored
+227
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for OpenLayers v3.6.0
|
||||
// Type definitions for OpenLayers v3.6.0
|
||||
// Project: http://openlayers.org/
|
||||
// Definitions by: Wouter Goedhart <https://github.com/woutergd>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -88,6 +88,21 @@ declare module olx {
|
||||
targetSize?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object literal with config options for the map logo.
|
||||
*/
|
||||
interface LogoOptions {
|
||||
/**
|
||||
* Link url for the logo. Will be followed when the logo is clicked.
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* Image src for the logo
|
||||
*/
|
||||
src: string;
|
||||
}
|
||||
|
||||
interface MapOptions {
|
||||
|
||||
/** Controls initially added to the map. If not specified, ol.control.defaults() is used. */
|
||||
@@ -382,6 +397,21 @@ declare module olx {
|
||||
}
|
||||
}
|
||||
|
||||
module interaction {
|
||||
interface DefaultsOptions {
|
||||
altShiftDragRotate?: boolean;
|
||||
doubleClickZoom?: boolean;
|
||||
keyboard?: boolean;
|
||||
mouseWheelZoom?: boolean;
|
||||
shiftDragZoom?: boolean;
|
||||
dragPan?: boolean;
|
||||
pinchRotate?: boolean;
|
||||
pinchZoom?: boolean;
|
||||
zoomDelta?: number;
|
||||
zoomDuration?: number;
|
||||
}
|
||||
}
|
||||
|
||||
module layer {
|
||||
|
||||
interface BaseOptions {
|
||||
@@ -527,6 +557,97 @@ declare module olx {
|
||||
}
|
||||
}
|
||||
|
||||
module source {
|
||||
|
||||
interface VectorOptions {
|
||||
/**
|
||||
* Attributions.
|
||||
*/
|
||||
attributions?: Array<ol.Attribution>;
|
||||
|
||||
/**
|
||||
* Features. If provided as {@link ol.Collection}, the features in the source
|
||||
* and the collection will stay in sync.
|
||||
*/
|
||||
features?: Array<ol.Feature> | ol.Collection<ol.Feature>;
|
||||
|
||||
/**
|
||||
* The feature format used by the XHR feature loader when `url` is set.
|
||||
* Required if `url` is set, otherwise ignored. Default is `undefined`.
|
||||
*/
|
||||
format?: ol.format.Feature;
|
||||
|
||||
/**
|
||||
* The loader function used to load features, from a remote source for example.
|
||||
* Note that the source will create and use an XHR feature loader when `url` is
|
||||
* set.
|
||||
*/
|
||||
loader?: ol.FeatureLoader;
|
||||
|
||||
/**
|
||||
* Logo.
|
||||
*/
|
||||
logo?: string | olx.LogoOptions;
|
||||
|
||||
/**
|
||||
* The loading strategy to use. By default an {@link ol.loadingstrategy.all}
|
||||
* strategy is used, a one-off strategy which loads all features at once.
|
||||
*/
|
||||
strategy?: ol.LoadingStrategy;
|
||||
|
||||
/**
|
||||
* Setting this option instructs the source to use an XHR loader (see
|
||||
* {@link ol.featureloader.xhr}) and an {@link ol.loadingstrategy.all} for a
|
||||
* one-off download of all features from that URL.
|
||||
* Requires `format` to be set as well.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
* By default, an RTree is used as spatial index. When features are removed and
|
||||
* added frequently, and the total number of features is low, setting this to
|
||||
* `false` may improve performance.
|
||||
*/
|
||||
useSpatialIndex?: boolean;
|
||||
|
||||
/**
|
||||
* Wrap the world horizontally. Default is `true`. For vector editing across the
|
||||
* -180° and 180° meridians to work properly, this should be set to `false`. The
|
||||
* resulting geometry coordinates will then exceed the world bounds.
|
||||
*/
|
||||
wrapX?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
module style {
|
||||
|
||||
interface FillOptions {
|
||||
color?: ol.Color | string;
|
||||
}
|
||||
|
||||
interface StyleOptions {
|
||||
geometry?: string | ol.geom.Geometry | ol.style.GeometryFunction;
|
||||
fill?: ol.style.Fill;
|
||||
image?: ol.style.Image;
|
||||
stroke?: ol.style.Stroke;
|
||||
text?: ol.style.Text;
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
interface TextOptions {
|
||||
font?: string;
|
||||
offsetX?: number;
|
||||
offsetY?: number;
|
||||
scale?: number;
|
||||
rotation?: number;
|
||||
text?: string;
|
||||
textAlign?: string;
|
||||
textBaseline?: string;
|
||||
fill?: ol.style.Fill;
|
||||
stroke?: ol.style.Stroke;
|
||||
}
|
||||
}
|
||||
|
||||
module tilegrid {
|
||||
|
||||
interface TileGridOptions {
|
||||
@@ -2551,13 +2672,16 @@ declare module ol {
|
||||
class MultiPolygon {
|
||||
}
|
||||
|
||||
class Point {
|
||||
class Point extends SimpleGeometry {
|
||||
constructor(coordinates: ol.Coordinate, layout?: geom.GeometryLayout);
|
||||
getCoordinates(): ol.Coordinate;
|
||||
setCoordinates(coordinates: ol.Coordinate, opt?: geom.GeometryLayout): void;
|
||||
}
|
||||
|
||||
class Polygon {
|
||||
}
|
||||
|
||||
class SimpleGeometry {
|
||||
class SimpleGeometry extends Geometry {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2625,6 +2749,8 @@ declare module ol {
|
||||
|
||||
class Snap {
|
||||
}
|
||||
|
||||
function defaults(opts: olx.interaction.DefaultsOptions): ol.Collection<ol.interaction.Interaction>;
|
||||
}
|
||||
|
||||
module layer {
|
||||
@@ -3155,6 +3281,14 @@ declare module ol {
|
||||
}
|
||||
|
||||
class Vector {
|
||||
constructor(opts: olx.source.VectorOptions)
|
||||
|
||||
/**
|
||||
* Get the extent of the features currently in the source.
|
||||
*/
|
||||
getExtent(): ol.Extent;
|
||||
|
||||
getFeaturesInExtent(extent: ol.Extent): ol.Feature[];
|
||||
}
|
||||
|
||||
class VectorEvent {
|
||||
@@ -3187,7 +3321,21 @@ declare module ol {
|
||||
class Circle {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fill style for vector features.
|
||||
*/
|
||||
class Fill {
|
||||
|
||||
constructor(opt_options?: olx.style.FillOptions);
|
||||
|
||||
getColor(): ol.Color | string;
|
||||
|
||||
/**
|
||||
* Set the color.
|
||||
*/
|
||||
setColor(color: ol.Color | string): void;
|
||||
|
||||
getChecksum(): string;
|
||||
}
|
||||
|
||||
class Icon {
|
||||
@@ -3196,6 +3344,10 @@ declare module ol {
|
||||
class Image {
|
||||
}
|
||||
|
||||
interface GeometryFunction {
|
||||
(feature: Feature): ol.geom.Geometry
|
||||
}
|
||||
|
||||
class RegularShape {
|
||||
}
|
||||
|
||||
@@ -3203,10 +3355,82 @@ declare module ol {
|
||||
constructor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Container for vector feature rendering styles. Any changes made to the style
|
||||
* or its children through `set*()` methods will not take effect until the
|
||||
* feature, layer or FeatureOverlay that uses the style is re-rendered.
|
||||
*/
|
||||
class Style {
|
||||
constructor(opts: olx.style.StyleOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text style for vector features.
|
||||
*/
|
||||
class Text {
|
||||
constructor(opt?: olx.style.TextOptions);
|
||||
|
||||
getFont(): string;
|
||||
getOffsetX(): number;
|
||||
getOffsetY(): number;
|
||||
getFill(): Fill;
|
||||
getRotation(): number;
|
||||
getScale(): number;
|
||||
getStroke(): Stroke;
|
||||
getText(): string;
|
||||
getTextAlign(): string;
|
||||
getTextBaseline(): string;
|
||||
|
||||
/**
|
||||
* Set the font.
|
||||
*/
|
||||
setFont(font: string): void;
|
||||
|
||||
/**
|
||||
* Set the x offset.
|
||||
*/
|
||||
setOffsetX(offsetX: number): void;
|
||||
|
||||
/**
|
||||
* Set the y offset.
|
||||
*/
|
||||
setOffsetY(offsetY: number): void;
|
||||
|
||||
/**
|
||||
* Set the fill.
|
||||
*/
|
||||
setFill(fill: Fill): void;
|
||||
|
||||
/**
|
||||
* Set the rotation.
|
||||
*/
|
||||
setRotation(rotation: number): void;
|
||||
|
||||
/**
|
||||
* Set the scale.
|
||||
*/
|
||||
setScale(scale: number): void;
|
||||
|
||||
/**
|
||||
* Set the stroke.
|
||||
*
|
||||
*/
|
||||
setStroke(stroke: Stroke): void;
|
||||
|
||||
/**
|
||||
* Set the text.
|
||||
*/
|
||||
setText(text: string): void;
|
||||
|
||||
/**
|
||||
* Set the text alignment.
|
||||
*/
|
||||
setTextAlign(textAlign: string): void;
|
||||
|
||||
/**
|
||||
* Set the text baseline.
|
||||
*/
|
||||
setTextBaseline(textBaseline: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="./os-locale.d.ts" />
|
||||
|
||||
import osLocale, { sync } from 'os-locale';
|
||||
|
||||
osLocale((err: any, locale: string) => {
|
||||
});
|
||||
|
||||
var locale: string = sync();
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for os-locale 1.2.1
|
||||
// Project: https://github.com/sindresorhus/os-locale
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "os-locale" {
|
||||
function osLocale(cb: (err: any, locale: string) => void): void;
|
||||
function osLocaleSync(): string;
|
||||
|
||||
export { osLocaleSync as sync };
|
||||
export default osLocale;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import gulp = require("gulp");
|
||||
import tmp = require("run-sequence");
|
||||
var runSequence = tmp.use(gulp);
|
||||
|
||||
gulp.task("run-sequence", callback => {
|
||||
gulp.task("run-sequence", (callback: any) => {
|
||||
runSequence("task1",
|
||||
["task2", "task3"],
|
||||
"taks4",
|
||||
|
||||
Vendored
+2
-1
@@ -7,9 +7,10 @@
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
declare module "run-sequence" {
|
||||
import gulp = require('gulp');
|
||||
|
||||
interface IRunSequence {
|
||||
(...streams: (string | string[] | gulp.ITaskCallback)[]): NodeJS.ReadWriteStream;
|
||||
(...streams: (string | string[] | gulp.TaskCallback)[]): NodeJS.ReadWriteStream;
|
||||
|
||||
use(gulp: gulp.Gulp): IRunSequence;
|
||||
}
|
||||
|
||||
Vendored
+89
-40
@@ -50,7 +50,6 @@ declare module Rx {
|
||||
export module helpers {
|
||||
function noop(): void;
|
||||
function notDefined(value: any): boolean;
|
||||
function isScheduler(value: any): boolean;
|
||||
function identity<T>(value: T): T;
|
||||
function defaultNow(): number;
|
||||
function defaultComparer(left: any, right: any): boolean;
|
||||
@@ -117,6 +116,7 @@ declare module Rx {
|
||||
|
||||
export interface IScheduler {
|
||||
now(): number;
|
||||
isScheduler(value: any): boolean;
|
||||
|
||||
schedule(action: () => void): IDisposable;
|
||||
scheduleWithState<TState>(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable;
|
||||
@@ -242,6 +242,23 @@ declare module Rx {
|
||||
combineLatest<T2, T3, T4, T5, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, fifth: Observable<T5>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable<TResult>;
|
||||
combineLatest<TOther, TResult>(souces: Observable<TOther>[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
combineLatest<TOther, TResult>(souces: IPromise<TOther>[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, TResult>(second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, TResult>(second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, TResult>(second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, TResult>(second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, TResult>(second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, TResult>(second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, TResult>(second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T2, T3, T4, T5, TResult>(second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, fifth: Observable<T5>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable<TResult>;
|
||||
withLatestFrom<TOther, TResult>(souces: Observable<TOther>[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
withLatestFrom<TOther, TResult>(souces: IPromise<TOther>[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
concat(...sources: Observable<T>[]): Observable<T>;
|
||||
concat(...sources: IPromise<T>[]): Observable<T>;
|
||||
concat(sources: Observable<T>[]): Observable<T>;
|
||||
@@ -292,7 +309,7 @@ declare module Rx {
|
||||
do(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable<T>;
|
||||
doAction(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable<T>; // alias for do
|
||||
tap(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable<T>; // alias for do
|
||||
|
||||
|
||||
doOnNext(onNext: (value: T) => void, thisArg?: any): Observable<T>;
|
||||
doOnError(onError: (exception: any) => void, thisArg?: any): Observable<T>;
|
||||
doOnCompleted(onCompleted: () => void, thisArg?: any): Observable<T>;
|
||||
@@ -306,7 +323,7 @@ declare module Rx {
|
||||
materialize(): Observable<Notification<T>>;
|
||||
repeat(repeatCount?: number): Observable<T>;
|
||||
retry(retryCount?: number): Observable<T>;
|
||||
scan<TAcc>(seed: TAcc, accumulator: (acc: TAcc, value: T) => TAcc): Observable<TAcc>;
|
||||
scan<TAcc>(accumulator: (acc: TAcc, value: T, seed: TAcc) => TAcc): Observable<TAcc>;
|
||||
scan(accumulator: (acc: T, value: T) => T): Observable<T>;
|
||||
skipLast(count: number): Observable<T>;
|
||||
startWith(...values: T[]): Observable<T>;
|
||||
@@ -323,12 +340,34 @@ declare module Rx {
|
||||
selectMany<TResult>(selector: (value: T) => IPromise<TResult>): Observable<TResult>;
|
||||
selectMany<TResult>(other: Observable<TResult>): Observable<TResult>;
|
||||
selectMany<TResult>(other: IPromise<TResult>): Observable<TResult>;
|
||||
selectMany<TResult>(selector: (value: T) => TResult[]): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TOther, TResult>(selector: (value: T) => Observable<TOther>, resultSelector: (item: T, other: TOther) => TResult): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TOther, TResult>(selector: (value: T) => IPromise<TOther>, resultSelector: (item: T, other: TOther) => TResult): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TResult>(selector: (value: T) => Observable<TResult>): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TResult>(selector: (value: T) => IPromise<TResult>): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TResult>(other: Observable<TResult>): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TResult>(other: IPromise<TResult>): Observable<TResult>; // alias for selectMany
|
||||
flatMap<TResult>(selector: (value: T) => TResult[]): Observable<TResult>; // alias for selectMany
|
||||
|
||||
/**
|
||||
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
||||
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
|
||||
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
|
||||
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
|
||||
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
|
||||
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
|
||||
*/
|
||||
selectManyObserver<T2, T3, T4>(onNext: (value: T, index: number) => Observable<T2>, onError: (exception: any) => Observable<T3>, onCompleted: () => Observable<T4>, thisArg?: any): Observable<T2 | T3 | T4>;
|
||||
|
||||
/**
|
||||
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
||||
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
|
||||
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
|
||||
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
|
||||
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
|
||||
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
|
||||
*/
|
||||
flatMapObserver<T2, T3, T4>(onNext: (value: T, index: number) => Observable<T2>, onError: (exception: any) => Observable<T3>, onCompleted: () => Observable<T4>, thisArg?: any): Observable<T2 | T3 | T4>;
|
||||
|
||||
selectConcat<T2, R>(selector: (value: T, index: number) => Observable<T2>, resultSelector: (value1: T, value2: T2, index: number) => R): Observable<R>;
|
||||
selectConcat<T2, R>(selector: (value: T, index: number) => IPromise<T2>, resultSelector: (value1: T, value2: T2, index: number) => R): Observable<R>;
|
||||
@@ -337,30 +376,30 @@ declare module Rx {
|
||||
selectConcat<R>(sequence: Observable<R>): Observable<R>;
|
||||
|
||||
/**
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
||||
* @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
* @param [thisArg] Object to use as this when executing callback.
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
selectSwitch<TResult>(selector: (value: T, index: number, source: Observable<T>) => Observable<TResult>, thisArg?: any): Observable<TResult>;
|
||||
/**
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
||||
* @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
* @param [thisArg] Object to use as this when executing callback.
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
flatMapLatest<TResult>(selector: (value: T, index: number, source: Observable<T>) => Observable<TResult>, thisArg?: any): Observable<TResult>; // alias for selectSwitch
|
||||
/**
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
||||
* @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
* @param [thisArg] Object to use as this when executing callback.
|
||||
* @since 2.2.28
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
switchMap<TResult>(selector: (value: T, index: number, source: Observable<T>) => TResult, thisArg?: any): Observable<TResult>; // alias for selectSwitch
|
||||
@@ -384,7 +423,7 @@ declare module Rx {
|
||||
* Converts an existing observable sequence to an ES6 Compatible Promise
|
||||
* @example
|
||||
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
|
||||
*
|
||||
*
|
||||
* // With config
|
||||
* Rx.config.Promise = RSVP.Promise;
|
||||
* var promise = Rx.Observable.return(42).toPromise();
|
||||
@@ -471,36 +510,12 @@ declare module Rx {
|
||||
fromArray<T>(array: T[], scheduler?: IScheduler): Observable<T>;
|
||||
fromArray<T>(array: { length: number;[index: number]: T; }, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* Converts an iterable into an Observable sequence
|
||||
*
|
||||
* @example
|
||||
* var res = Rx.Observable.fromIterable(new Map());
|
||||
* var res = Rx.Observable.fromIterable(function* () { yield 42; });
|
||||
* var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout);
|
||||
* @param generator Generator to convert from.
|
||||
* @param [scheduler] Scheduler to run the enumeration of the input sequence on.
|
||||
* @returns The observable sequence whose elements are pulled from the given generator sequence.
|
||||
*/
|
||||
fromIterable<T>(generator: () => { next(): { done: boolean; value?: T; }; }, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* Converts an iterable into an Observable sequence
|
||||
*
|
||||
* @example
|
||||
* var res = Rx.Observable.fromIterable(new Map());
|
||||
* var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout);
|
||||
* @param iterable Iterable to convert from.
|
||||
* @param [scheduler] Scheduler to run the enumeration of the input sequence on.
|
||||
* @returns The observable sequence whose elements are pulled from the given generator sequence.
|
||||
*/
|
||||
fromIterable<T>(iterable: {}, scheduler?: IScheduler): Observable<T>; // todo: can't describe ES6 Iterable via TypeScript type system
|
||||
generate<TState, TResult>(initialState: TState, condition: (state: TState) => boolean, iterate: (state: TState) => TState, resultSelector: (state: TState) => TResult, scheduler?: IScheduler): Observable<TResult>;
|
||||
never<T>(): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var res = Rx.Observable.of(1, 2, 3);
|
||||
* @since 2.2.28
|
||||
@@ -509,7 +524,7 @@ declare module Rx {
|
||||
of<T>(...values: T[]): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
||||
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
||||
* @example
|
||||
* var res = Rx.Observable.ofWithScheduler(Rx.Scheduler.timeout, 1, 2, 3);
|
||||
* @since 2.2.28
|
||||
@@ -577,6 +592,38 @@ declare module Rx {
|
||||
combineLatest<TOther, TResult>(souces: Observable<TOther>[], resultSelector: (...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
combineLatest<TOther, TResult>(souces: IPromise<TOther>[], resultSelector: (...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
|
||||
withLatestFrom<T, T2, TResult>(first: Observable<T>, second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, TResult>(first: IPromise<T>, second: Observable<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, TResult>(first: Observable<T>, second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, TResult>(first: IPromise<T>, second: IPromise<T2>, resultSelector: (v1: T, v2: T2) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: Observable<T>, second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: Observable<T>, second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: Observable<T>, second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: IPromise<T>, second: Observable<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: IPromise<T>, second: Observable<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: IPromise<T>, second: IPromise<T2>, third: Observable<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, TResult>(first: IPromise<T>, second: IPromise<T2>, third: IPromise<T3>, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: Observable<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: Observable<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: Observable<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: Observable<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: Observable<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, TResult>(first: IPromise<T>, second: IPromise<T2>, third: IPromise<T3>, fourth: IPromise<T4>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable<TResult>;
|
||||
withLatestFrom<T, T2, T3, T4, T5, TResult>(first: Observable<T>, second: Observable<T2>, third: Observable<T3>, fourth: Observable<T4>, fifth: Observable<T5>, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable<TResult>;
|
||||
withLatestFrom<TOther, TResult>(souces: Observable<TOther>[], resultSelector: (...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
withLatestFrom<TOther, TResult>(souces: IPromise<TOther>[], resultSelector: (...otherValues: TOther[]) => TResult): Observable<TResult>;
|
||||
|
||||
concat<T>(...sources: Observable<T>[]): Observable<T>;
|
||||
concat<T>(...sources: IPromise<T>[]): Observable<T>;
|
||||
concat<T>(sources: Observable<T>[]): Observable<T>;
|
||||
@@ -618,6 +665,8 @@ declare module Rx {
|
||||
* @returns An Observable sequence which wraps the existing promise success and failure.
|
||||
*/
|
||||
fromPromise<T>(promise: IPromise<T>): Observable<T>;
|
||||
|
||||
prototype: any;
|
||||
}
|
||||
|
||||
export var Observable: ObservableStatic;
|
||||
@@ -626,11 +675,11 @@ declare module Rx {
|
||||
hasObservers(): boolean;
|
||||
}
|
||||
|
||||
export interface Subject<T> extends ISubject<T> {
|
||||
}
|
||||
export interface Subject<T> extends ISubject<T> {
|
||||
}
|
||||
|
||||
interface SubjectStatic {
|
||||
new <T>(): Subject<T>;
|
||||
interface SubjectStatic {
|
||||
new <T>(): Subject<T>;
|
||||
create<T>(observer?: Observer<T>, observable?: Observable<T>): ISubject<T>;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-9
@@ -40,17 +40,9 @@ declare module Rx {
|
||||
sequenceEqual(second: T[]): Observable<boolean>;
|
||||
|
||||
elementAt(index: number): Observable<T>;
|
||||
elementAtOrDefault(index: number, defaultValue?: T): Observable<T>;
|
||||
|
||||
single(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
|
||||
singleOrDefault(predicate?: (value: T, index: number, source: Observable<T>) => boolean, defaultValue?: T, thisArg?: any): Observable<T>;
|
||||
|
||||
first(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
|
||||
firstOrDefault(predicate?: (value: T, index: number, source: Observable<T>) => boolean, defaultValue?: T, thisArg?: any): Observable<T>;
|
||||
|
||||
last(predicate?: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
|
||||
lastOrDefault(predicate?: (value: T, index: number, source: Observable<T>) => boolean, defaultValue?: T, thisArg?: any): Observable<T>;
|
||||
|
||||
find(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<T>;
|
||||
findIndex(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg?: any): Observable<number>;
|
||||
}
|
||||
@@ -58,4 +50,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.aggregates" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-2
@@ -65,7 +65,9 @@ declare module Rx {
|
||||
<T>(func: Function, context?: any): (...args: any[]) => Observable<T>;
|
||||
};
|
||||
|
||||
fromEvent<T>(element: any, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
|
||||
fromEventPattern<T>(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable<T>;
|
||||
fromEvent<T>(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
|
||||
fromEvent<T>(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
|
||||
fromEvent<T>(element: {on: (name: string, cb: (e: any) => any) => void; off: (name: string, cb: (e: any) => any) => void}, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
|
||||
fromEventPattern<T>(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable<T>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +81,4 @@ module Rx.Tests.Async {
|
||||
function startAsync() {
|
||||
var o: Rx.Observable<string> = Rx.Observable.startAsync(() => <Rx.IPromise<string>>null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -40,4 +40,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.async" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -8,4 +8,4 @@
|
||||
|
||||
declare module "rx.backpressure" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -44,10 +44,10 @@ declare module Rx {
|
||||
/**
|
||||
* Returns an observable sequence that shares a single subscription to the underlying sequence.
|
||||
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var res = source.share();
|
||||
*
|
||||
*
|
||||
* @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
||||
*/
|
||||
share(): Observable<T>;
|
||||
@@ -58,10 +58,10 @@ declare module Rx {
|
||||
/**
|
||||
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
|
||||
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var res = source.shareValue(42);
|
||||
*
|
||||
*
|
||||
* @param initialValue Initial value received by observers upon subscription.
|
||||
* @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -8,4 +8,4 @@
|
||||
|
||||
declare module "rx.binding" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+9
-9
@@ -9,24 +9,24 @@ declare module Rx {
|
||||
|
||||
interface Observable<T> {
|
||||
/**
|
||||
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
|
||||
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
|
||||
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
|
||||
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
|
||||
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
|
||||
* @returns An observable that triggers on successive pairs of observations from the input observable as an array.
|
||||
*/
|
||||
pairwise(): Observable<T[]>;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns two observables which partition the observations of the source by the given function.
|
||||
* The first will trigger observations for those values for which the predicate returns true.
|
||||
* The second will trigger observations for those values where the predicate returns false.
|
||||
* The predicate is executed once for each subscribed observer.
|
||||
* Both also propagate all error observations arising from the source and each completes
|
||||
* The first will trigger observations for those values for which the predicate returns true.
|
||||
* The second will trigger observations for those values where the predicate returns false.
|
||||
* The predicate is executed once for each subscribed observer.
|
||||
* Both also propagate all error observations arising from the source and each completes
|
||||
* when the source completes.
|
||||
* @param predicate
|
||||
* @param predicate
|
||||
* The function to determine which output Observable will trigger a particular observation.
|
||||
* @returns
|
||||
* An array of observables. The first triggers when the predicate returns true,
|
||||
* An array of observables. The first triggers when the predicate returns true,
|
||||
* and the second triggers when the predicate returns false.
|
||||
*/
|
||||
partition(predicate: (value: T, index: number, source: Observable<T>) => boolean, thisArg: any): Observable<T>[];
|
||||
|
||||
Vendored
+1
-1
@@ -33,4 +33,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.coincidence" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for RxJS v2.2.28
|
||||
// Type definitions for RxJS v2.5.3
|
||||
// Project: http://rx.codeplex.com/
|
||||
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>, Igor Oleinikov <https://github.com/Igorbek>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -39,7 +39,7 @@ declare module Rx {
|
||||
distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable<T>;
|
||||
distinct<TKey>(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable<T>;
|
||||
groupBy<TKey, TElement>(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
|
||||
groupBy<TKey, TElement>(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
|
||||
groupBy<TKey, TElement>(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, TElement>>;
|
||||
groupByUntil<TKey, TDuration>(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable<TKey, T>) => Observable<TDuration>, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, T>>;
|
||||
groupByUntil<TKey, TElement, TDuration>(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, durationSelector: (group: GroupedObservable<TKey, TElement>) => Observable<TDuration>, keySerializer?: (key: TKey) => string): Observable<GroupedObservable<TKey, TElement>>;
|
||||
}
|
||||
|
||||
Vendored
+41
-41
@@ -29,13 +29,13 @@ declare module Rx {
|
||||
/**
|
||||
* Repeats source as long as condition holds emulating a do while loop.
|
||||
* @param condition The condition which determines if the source will be repeated.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
*/
|
||||
doWhile(condition: () => boolean): Observable<T>;
|
||||
|
||||
/**
|
||||
* Expands an observable sequence by recursively invoking selector.
|
||||
*
|
||||
*
|
||||
* @param selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
|
||||
* @param [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
|
||||
* @returns An observable sequence containing all the elements produced by the recursive expansion.
|
||||
@@ -64,7 +64,7 @@ declare module Rx {
|
||||
interface ObservableStatic {
|
||||
/**
|
||||
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.if(condition, obs1, obs2);
|
||||
* @param condition The condition which determines if the thenSource or elseSource will be run.
|
||||
@@ -79,7 +79,7 @@ declare module Rx {
|
||||
|
||||
/**
|
||||
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.if(condition, obs1, scheduler);
|
||||
* @param condition The condition which determines if the thenSource or empty sequence will be run.
|
||||
@@ -92,7 +92,7 @@ declare module Rx {
|
||||
|
||||
/**
|
||||
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.if(condition, obs1, obs2);
|
||||
* @param condition The condition which determines if the thenSource or elseSource will be run.
|
||||
@@ -107,7 +107,7 @@ declare module Rx {
|
||||
|
||||
/**
|
||||
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.if(condition, obs1, scheduler);
|
||||
* @param condition The condition which determines if the thenSource or empty sequence will be run.
|
||||
@@ -123,7 +123,7 @@ declare module Rx {
|
||||
* There is an alias for this method called 'forIn' for browsers <IE9
|
||||
* @param sources An array of values to turn into an observable sequence.
|
||||
* @param resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
|
||||
* @returns An observable sequence from the concatenated observable sequences.
|
||||
* @returns An observable sequence from the concatenated observable sequences.
|
||||
*/
|
||||
for<T, TResult>(sources: T[], resultSelector: (item: T) => Observable<TResult>): Observable<TResult>;
|
||||
|
||||
@@ -132,7 +132,7 @@ declare module Rx {
|
||||
* There is an alias for this method called 'forIn' for browsers <IE9
|
||||
* @param sources An array of values to turn into an observable sequence.
|
||||
* @param resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
|
||||
* @returns An observable sequence from the concatenated observable sequences.
|
||||
* @returns An observable sequence from the concatenated observable sequences.
|
||||
*/
|
||||
forIn<T, TResult>(sources: T[], resultSelector: (item: T) => Observable<TResult>): Observable<TResult>;
|
||||
|
||||
@@ -141,7 +141,7 @@ declare module Rx {
|
||||
* There is an alias for this method called 'whileDo' for browsers <IE9
|
||||
* @param condition The condition which determines if the source will be repeated.
|
||||
* @param source The observable sequence or promise that will be run if the condition function returns true.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
*/
|
||||
while<T>(condition: () => boolean, source: Observable<T>): Observable<T>;
|
||||
while<T>(condition: () => boolean, source: IPromise<T>): Observable<T>;
|
||||
@@ -151,7 +151,7 @@ declare module Rx {
|
||||
* There is an alias for this method called 'whileDo' for browsers <IE9
|
||||
* @param condition The condition which determines if the source will be repeated.
|
||||
* @param source The observable sequence or promise that will be run if the condition function returns true.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
*/
|
||||
whileDo<T>(condition: () => boolean, source: Observable<T>): Observable<T>;
|
||||
whileDo<T>(condition: () => boolean, source: IPromise<T>): Observable<T>;
|
||||
@@ -159,14 +159,14 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
@@ -176,16 +176,16 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
|
||||
*
|
||||
*
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
case<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
case<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
@@ -193,14 +193,14 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
@@ -210,16 +210,16 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
|
||||
*
|
||||
*
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
case<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
case<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
@@ -227,14 +227,14 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
@@ -244,16 +244,16 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
|
||||
*
|
||||
*
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
switchCase<T>(selector: () => string, sources: { [key: string]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
switchCase<T>(selector: () => string, sources: { [key: string]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
@@ -261,14 +261,14 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param elseSource The observable sequence or promise that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, elseSource: Observable<T>): Observable<T>;
|
||||
@@ -278,23 +278,23 @@ declare module Rx {
|
||||
/**
|
||||
* Uses selector to determine which source in sources to use.
|
||||
* There is an alias 'switchCase' for browsers <IE9.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
|
||||
* res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
|
||||
*
|
||||
*
|
||||
* @param selector The function which extracts the value for to test in a case statement.
|
||||
* @param sources A object which has keys which correspond to the case statement labels.
|
||||
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
switchCase<T>(selector: () => number, sources: { [key: number]: Observable<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
switchCase<T>(selector: () => number, sources: { [key: number]: IPromise<T>; }, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* Runs all observable sequences in parallel and collect their last elements.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.forkJoin([obs1, obs2]);
|
||||
* @param sources Array of source sequences or promises.
|
||||
@@ -305,7 +305,7 @@ declare module Rx {
|
||||
|
||||
/**
|
||||
* Runs all observable sequences in parallel and collect their last elements.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.forkJoin(obs1, obs2, ...);
|
||||
* @param args Source sequences or promises.
|
||||
@@ -318,4 +318,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.experimental" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -57,4 +57,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.joinpatterns" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -12,4 +12,4 @@
|
||||
|
||||
declare module "rx.lite" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -61,4 +61,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.testing" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+10
@@ -19,11 +19,21 @@ declare module Rx {
|
||||
export interface Observable<T> {
|
||||
delay(dueTime: Date, scheduler?: IScheduler): Observable<T>;
|
||||
delay(dueTime: number, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
debounce(dueTime: number, scheduler?: IScheduler): Observable<T>;
|
||||
throttleWithTimeout(dueTime: number, scheduler?: IScheduler): Observable<T>;
|
||||
/**
|
||||
* @deprecated use #debounce or #throttleWithTimeout instead.
|
||||
*/
|
||||
throttle(dueTime: number, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
timeInterval(scheduler?: IScheduler): Observable<TimeInterval<T>>;
|
||||
|
||||
timestamp(scheduler?: IScheduler): Observable<Timestamp<T>>;
|
||||
|
||||
sample(interval: number, scheduler?: IScheduler): Observable<T>;
|
||||
sample<TSample>(sampler: Observable<TSample>, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
timeout(dueTime: Date, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
|
||||
timeout(dueTime: number, other?: Observable<T>, scheduler?: IScheduler): Observable<T>;
|
||||
}
|
||||
|
||||
Vendored
+7
-2
@@ -13,7 +13,12 @@ declare module Rx {
|
||||
delayWithSelector(subscriptionDelay: number, delayDurationSelector: (item: T) => number): Observable<T>;
|
||||
|
||||
timeoutWithSelector<TTimeout>(firstTimeout: Observable<TTimeout>, timeoutdurationSelector?: (item: T) => Observable<TTimeout>, other?: Observable<T>): Observable<T>;
|
||||
throttleWithSelector<TTimeout>(throttleDurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;
|
||||
|
||||
debounceWithSelector<TTimeout>(debounceDurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;
|
||||
/**
|
||||
* @deprecated use #debounceWithSelector instead.
|
||||
*/
|
||||
throttleWithSelector<TTimeout>(debounceDurationSelector: (item: T) => Observable<TTimeout>): Observable<T>;
|
||||
|
||||
skipLastWithTime(duration: number, scheduler?: IScheduler): Observable<T>;
|
||||
takeLastWithTime(duration: number, timerScheduler?: IScheduler, loopScheduler?: IScheduler): Observable<T>;
|
||||
@@ -58,4 +63,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.time" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -38,4 +38,4 @@ declare module Rx {
|
||||
|
||||
declare module "rx.virtualtime" {
|
||||
export = Rx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ $("#e6").select2({
|
||||
ajax: {
|
||||
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
|
||||
dataType: 'jsonp',
|
||||
cache: false,
|
||||
data: function (term, page) {
|
||||
return {
|
||||
q: term,
|
||||
@@ -195,4 +196,4 @@ $("#e8").select2("enable", false);
|
||||
$("#e8").select2("readonly", false);
|
||||
$("#e8").select2('container');
|
||||
$("#e8").select2('onSortStart');
|
||||
$("#e8").select2('onSortEnd');
|
||||
$("#e8").select2('onSortEnd');
|
||||
|
||||
Vendored
+1
@@ -26,6 +26,7 @@ interface Select2AjaxOptions {
|
||||
url?: any;
|
||||
dataType?: string;
|
||||
quietMillis?: number;
|
||||
cache?: boolean;
|
||||
data?: (term: string, page: number, context: any) => any;
|
||||
results?: (term: any, page: number, context: any) => any;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,14 @@ interface GTaskAttributes {
|
||||
revision? : number;
|
||||
name? : string;
|
||||
}
|
||||
interface GTaskInstance extends Sequelize.Instance<GTaskInstance, GTaskAttributes> {}
|
||||
interface GTaskInstance extends Sequelize.Instance<GTaskInstance, GTaskAttributes> {
|
||||
upRevision(): void;
|
||||
}
|
||||
var GTask = s.define<GTaskInstance, GTaskAttributes>( 'task', { revision : Sequelize.INTEGER, name : Sequelize.STRING });
|
||||
|
||||
GUser.hasMany(GTask);
|
||||
|
||||
GTask.create({ revision: 1, name: 'test' }).then( (gtask) => gtask.upRevision() );
|
||||
|
||||
|
||||
//
|
||||
Vendored
+188
-188
@@ -256,13 +256,13 @@ declare module "sequelize" {
|
||||
* user.getProfilePicture() // gets you only the profile picture
|
||||
*
|
||||
* User.findAll({
|
||||
* where: ...,
|
||||
* include: [
|
||||
* { model: Picture }, // load all pictures
|
||||
* { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be
|
||||
* the exact same as the one in the association
|
||||
* ]
|
||||
* })
|
||||
* where: ...,
|
||||
* include: [
|
||||
* { model: Picture }, // load all pictures
|
||||
* { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be
|
||||
* the exact same as the one in the association
|
||||
* ]
|
||||
* })
|
||||
* ```
|
||||
* To get full control over the foreign key column added by sequelize, you can use the `foreignKey` option. It
|
||||
* can either be a string, that specifies the name, or and object type definition,
|
||||
@@ -276,11 +276,11 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* User.hasMany(Picture, {
|
||||
* foreignKey: {
|
||||
* name: 'uid',
|
||||
* allowNull: false
|
||||
* }
|
||||
* })
|
||||
* foreignKey: {
|
||||
* name: 'uid',
|
||||
* allowNull: false
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* This specifies that the `uid` column can not be null. In most cases this will already be covered by the
|
||||
@@ -293,10 +293,10 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* user.getPictures({
|
||||
* where: {
|
||||
* format: 'jpg'
|
||||
* }
|
||||
* })
|
||||
* where: {
|
||||
* format: 'jpg'
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* There are several ways to update and add new assoications. Continuing with our example of users and
|
||||
@@ -371,8 +371,8 @@ declare module "sequelize" {
|
||||
* started yet:
|
||||
* ```js
|
||||
* var UserProjects = sequelize.define('userprojects', {
|
||||
* started: Sequelize.BOOLEAN
|
||||
* })
|
||||
* started: Sequelize.BOOLEAN
|
||||
* })
|
||||
* User.hasMany(Project, { through: UserProjects })
|
||||
* Project.hasMany(User, { through: UserProjects })
|
||||
* ```
|
||||
@@ -387,8 +387,8 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* p1.userprojects {
|
||||
* started: true
|
||||
* }
|
||||
* started: true
|
||||
* }
|
||||
* user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that.
|
||||
* ```
|
||||
*
|
||||
@@ -396,9 +396,9 @@ declare module "sequelize" {
|
||||
* available as an object with the name of the through model.
|
||||
* ```js
|
||||
* user.getProjects().then(function (projects) {
|
||||
* var p1 = projects[0]
|
||||
* p1.userprojects.started // Is this project started yet?
|
||||
* })
|
||||
* var p1 = projects[0]
|
||||
* p1.userprojects.started // Is this project started yet?
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param target The model that will be associated with hasOne relationship
|
||||
@@ -421,8 +421,8 @@ declare module "sequelize" {
|
||||
* the project has been started yet:
|
||||
* ```js
|
||||
* var UserProjects = sequelize.define('userprojects', {
|
||||
* started: Sequelize.BOOLEAN
|
||||
* })
|
||||
* started: Sequelize.BOOLEAN
|
||||
* })
|
||||
* User.belongsToMany(Project, { through: UserProjects })
|
||||
* Project.belongsToMany(User, { through: UserProjects })
|
||||
* ```
|
||||
@@ -436,8 +436,8 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* p1.userprojects {
|
||||
* started: true
|
||||
* }
|
||||
* started: true
|
||||
* }
|
||||
* user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that.
|
||||
* ```
|
||||
*
|
||||
@@ -445,9 +445,9 @@ declare module "sequelize" {
|
||||
* available as an object with the name of the through model.
|
||||
* ```js
|
||||
* user.getProjects().then(function (projects) {
|
||||
* var p1 = projects[0]
|
||||
* p1.userprojects.started // Is this project started yet?
|
||||
* })
|
||||
* var p1 = projects[0]
|
||||
* p1.userprojects.started // Is this project started yet?
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param target The model that will be associated with hasOne relationship
|
||||
@@ -813,15 +813,15 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* sequelize.define('Model', {
|
||||
* foreign_id: {
|
||||
* type: Sequelize.INTEGER,
|
||||
* references: {
|
||||
* model: OtherModel,
|
||||
* key: 'id',
|
||||
* deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
* foreign_id: {
|
||||
* type: Sequelize.INTEGER,
|
||||
* references: {
|
||||
* model: OtherModel,
|
||||
* key: 'id',
|
||||
* deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* The constraints can be configured in a transaction like this. It will
|
||||
@@ -1074,16 +1074,16 @@ declare module "sequelize" {
|
||||
* ```js
|
||||
* // Method 1
|
||||
* sequelize.define(name, { attributes }, {
|
||||
* hooks: {
|
||||
* beforeBulkCreate: function () {
|
||||
* // can be a single function
|
||||
* },
|
||||
* beforeValidate: [
|
||||
* function () {},
|
||||
* function() {} // Or an array of several
|
||||
* ]
|
||||
* }
|
||||
* })
|
||||
* hooks: {
|
||||
* beforeBulkCreate: function () {
|
||||
* // can be a single function
|
||||
* },
|
||||
* beforeValidate: [
|
||||
* function () {},
|
||||
* function() {} // Or an array of several
|
||||
* ]
|
||||
* }
|
||||
* })
|
||||
*
|
||||
* // Method 2
|
||||
* Model.hook('afterDestroy', function () {})
|
||||
@@ -1563,7 +1563,7 @@ declare module "sequelize" {
|
||||
* @param options.plain If set to true, included instances will be returned as plain objects
|
||||
*/
|
||||
get( key : string, options? : { plain? : boolean, clone? : boolean } ) : any;
|
||||
get( options? : { plain? : boolean, clone? : boolean } ) : Object;
|
||||
get( options? : { plain? : boolean, clone? : boolean } ) : TAttributes;
|
||||
|
||||
/**
|
||||
* Set is used to update values on the instance (the sequelize representation of the instance that is,
|
||||
@@ -1716,7 +1716,7 @@ declare module "sequelize" {
|
||||
* Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all
|
||||
* values gotten from the DB, and apply all custom getters.
|
||||
*/
|
||||
toJSON() : Object;
|
||||
toJSON() : TAttributes;
|
||||
|
||||
}
|
||||
|
||||
@@ -2439,32 +2439,32 @@ declare module "sequelize" {
|
||||
* Apply a scope created in `define` to the model. First let's look at how to create scopes:
|
||||
* ```js
|
||||
* var Model = sequelize.define('model', attributes, {
|
||||
* defaultScope: {
|
||||
* where: {
|
||||
* username: 'dan'
|
||||
* },
|
||||
* limit: 12
|
||||
* },
|
||||
* scopes: {
|
||||
* isALie: {
|
||||
* where: {
|
||||
* stuff: 'cake'
|
||||
* }
|
||||
* },
|
||||
* complexFunction: function(email, accessLevel) {
|
||||
* return {
|
||||
* where: {
|
||||
* email: {
|
||||
* $like: email
|
||||
* },
|
||||
* accesss_level {
|
||||
* $gte: accessLevel
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* defaultScope: {
|
||||
* where: {
|
||||
* username: 'dan'
|
||||
* },
|
||||
* limit: 12
|
||||
* },
|
||||
* scopes: {
|
||||
* isALie: {
|
||||
* where: {
|
||||
* stuff: 'cake'
|
||||
* }
|
||||
* },
|
||||
* complexFunction: function(email, accessLevel) {
|
||||
* return {
|
||||
* where: {
|
||||
* email: {
|
||||
* $like: email
|
||||
* },
|
||||
* accesss_level {
|
||||
* $gte: accessLevel
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* Now, since you defined a default scope, every time you do Model.find, the default scope is appended to
|
||||
* your query. Here's a couple of examples:
|
||||
@@ -2490,11 +2490,11 @@ declare module "sequelize" {
|
||||
* __Simple search using AND and =__
|
||||
* ```js
|
||||
* Model.findAll({
|
||||
* where: {
|
||||
* attr1: 42,
|
||||
* attr2: 'cake'
|
||||
* }
|
||||
* })
|
||||
* where: {
|
||||
* attr1: 42,
|
||||
* attr2: 'cake'
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```sql
|
||||
* WHERE attr1 = 42 AND attr2 = 'cake'
|
||||
@@ -2504,21 +2504,21 @@ declare module "sequelize" {
|
||||
* ```js
|
||||
*
|
||||
* Model.findAll({
|
||||
* where: {
|
||||
* attr1: {
|
||||
* gt: 50
|
||||
* },
|
||||
* attr2: {
|
||||
* lte: 45
|
||||
* },
|
||||
* attr3: {
|
||||
* in: [1,2,3]
|
||||
* },
|
||||
* attr4: {
|
||||
* ne: 5
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* where: {
|
||||
* attr1: {
|
||||
* gt: 50
|
||||
* },
|
||||
* attr2: {
|
||||
* lte: 45
|
||||
* },
|
||||
* attr3: {
|
||||
* in: [1,2,3]
|
||||
* },
|
||||
* attr4: {
|
||||
* ne: 5
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```sql
|
||||
* WHERE attr1 > 50 AND attr2 <= 45 AND attr3 IN (1,2,3) AND attr4 != 5
|
||||
@@ -2529,14 +2529,14 @@ declare module "sequelize" {
|
||||
* __Queries using OR__
|
||||
* ```js
|
||||
* Model.findAll({
|
||||
* where: Sequelize.and(
|
||||
* { name: 'a project' },
|
||||
* Sequelize.or(
|
||||
* { id: [1,2,3] },
|
||||
* { id: { gt: 10 } }
|
||||
* )
|
||||
* )
|
||||
* })
|
||||
* where: Sequelize.and(
|
||||
* { name: 'a project' },
|
||||
* Sequelize.or(
|
||||
* { id: [1,2,3] },
|
||||
* { id: { gt: 10 } }
|
||||
* )
|
||||
* )
|
||||
* })
|
||||
* ```
|
||||
* ```sql
|
||||
* WHERE name = 'a project' AND (id` IN (1,2,3) OR id > 10)
|
||||
@@ -2587,12 +2587,12 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* Model.findAndCountAll({
|
||||
* where: ...,
|
||||
* limit: 12,
|
||||
* offset: 12
|
||||
* }).then(function (result) {
|
||||
* ...
|
||||
* })
|
||||
* where: ...,
|
||||
* limit: 12,
|
||||
* offset: 12
|
||||
* }).then(function (result) {
|
||||
* ...
|
||||
* })
|
||||
* ```
|
||||
* In the above example, `result.rows` will contain rows 13 through 24, while `result.count` will return
|
||||
* the
|
||||
@@ -2605,11 +2605,11 @@ declare module "sequelize" {
|
||||
* Suppose you want to find all users who have a profile attached:
|
||||
* ```js
|
||||
* User.findAndCountAll({
|
||||
* include: [
|
||||
* { model: Profile, required: true}
|
||||
* ],
|
||||
* limit 3
|
||||
* });
|
||||
* include: [
|
||||
* { model: Profile, required: true}
|
||||
* ],
|
||||
* limit 3
|
||||
* });
|
||||
* ```
|
||||
* Because the include for `Profile` has `required` set it will result in an inner join, and only the users
|
||||
* who have a profile will be counted. If we remove `required` from the include, both users with and
|
||||
@@ -3123,7 +3123,7 @@ declare module "sequelize" {
|
||||
/**
|
||||
* If this column references another table, provide it here as a Model, or a string
|
||||
*/
|
||||
model?: Model<any, any>;
|
||||
model?: string | Model<any, any>;
|
||||
|
||||
/**
|
||||
* The column of the foreign table that this column references
|
||||
@@ -3149,7 +3149,7 @@ declare module "sequelize" {
|
||||
/**
|
||||
* A string or a data type
|
||||
*/
|
||||
type: string | DataTypeAbstract;
|
||||
type: string | DataTypeAbstract;
|
||||
|
||||
/**
|
||||
* If true, the column will get a unique constraint. If a string is provided, the column will be part of a
|
||||
@@ -3218,11 +3218,11 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* sequelize.define('model', {
|
||||
* states: {
|
||||
* type: Sequelize.ENUM,
|
||||
* values: ['active', 'pending', 'deleted']
|
||||
* }
|
||||
* })
|
||||
* states: {
|
||||
* type: Sequelize.ENUM,
|
||||
* values: ['active', 'pending', 'deleted']
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
values? : Array<string>;
|
||||
@@ -3265,7 +3265,7 @@ declare module "sequelize" {
|
||||
* The type of query you are executing. The query type affects how results are formatted before they are
|
||||
* passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts.
|
||||
*/
|
||||
type?: string;
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* If true, transforms objects with `.` separated property names into nested objects using
|
||||
@@ -4042,8 +4042,8 @@ declare module "sequelize" {
|
||||
* Convert a user's username to upper case
|
||||
* ```js
|
||||
* instance.updateAttributes({
|
||||
* username: self.sequelize.fn('upper', self.sequelize.col('username'))
|
||||
* })
|
||||
* username: self.sequelize.fn('upper', self.sequelize.col('username'))
|
||||
* })
|
||||
* ```
|
||||
* @param fn The function you want to call
|
||||
* @param args All further arguments will be passed as arguments to the function
|
||||
@@ -4211,22 +4211,22 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* sequelize.define('modelName', {
|
||||
* columnA: {
|
||||
* type: Sequelize.BOOLEAN,
|
||||
* validate: {
|
||||
* is: ["[a-z]",'i'], // will only allow letters
|
||||
* max: 23, // only allow values <= 23
|
||||
* isIn: {
|
||||
* args: [['en', 'zh']],
|
||||
* msg: "Must be English or Chinese"
|
||||
* }
|
||||
* },
|
||||
* field: 'column_a'
|
||||
* // Other attributes here
|
||||
* },
|
||||
* columnB: Sequelize.STRING,
|
||||
* columnC: 'MY VERY OWN COLUMN TYPE'
|
||||
* })
|
||||
* columnA: {
|
||||
* type: Sequelize.BOOLEAN,
|
||||
* validate: {
|
||||
* is: ["[a-z]",'i'], // will only allow letters
|
||||
* max: 23, // only allow values <= 23
|
||||
* isIn: {
|
||||
* args: [['en', 'zh']],
|
||||
* msg: "Must be English or Chinese"
|
||||
* }
|
||||
* },
|
||||
* field: 'column_a'
|
||||
* // Other attributes here
|
||||
* },
|
||||
* columnB: Sequelize.STRING,
|
||||
* columnC: 'MY VERY OWN COLUMN TYPE'
|
||||
* })
|
||||
*
|
||||
* sequelize.models.modelName // The model will now be available in models under the name given to define
|
||||
* ```
|
||||
@@ -4297,12 +4297,12 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* sequelize.query('SELECT...').spread(function (results, metadata) {
|
||||
* // Raw query - use spread
|
||||
* });
|
||||
* // Raw query - use spread
|
||||
* });
|
||||
*
|
||||
* sequelize.query('SELECT...', { type: sequelize.QueryTypes.SELECT }).then(function (results) {
|
||||
* // SELECT query - use then
|
||||
* })
|
||||
* // SELECT query - use then
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param sql
|
||||
@@ -4417,12 +4417,12 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* sequelize.transaction().then(function (t) {
|
||||
* return User.find(..., { transaction: t}).then(function (user) {
|
||||
* return user.updateAttributes(..., { transaction: t});
|
||||
* })
|
||||
* .then(t.commit.bind(t))
|
||||
* .catch(t.rollback.bind(t));
|
||||
* })
|
||||
* return User.find(..., { transaction: t}).then(function (user) {
|
||||
* return user.updateAttributes(..., { transaction: t});
|
||||
* })
|
||||
* .then(t.commit.bind(t))
|
||||
* .catch(t.rollback.bind(t));
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* A syntax for automatically committing or rolling back based on the promise chain resolution is also
|
||||
@@ -4430,15 +4430,15 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* sequelize.transaction(function (t) { // Note that we use a callback rather than a promise.then()
|
||||
* return User.find(..., { transaction: t}).then(function (user) {
|
||||
* return user.updateAttributes(..., { transaction: t});
|
||||
* });
|
||||
* }).then(function () {
|
||||
* // Commited
|
||||
* }).catch(function (err) {
|
||||
* // Rolled back
|
||||
* console.error(err);
|
||||
* });
|
||||
* return User.find(..., { transaction: t}).then(function (user) {
|
||||
* return user.updateAttributes(..., { transaction: t});
|
||||
* });
|
||||
* }).then(function () {
|
||||
* // Commited
|
||||
* }).catch(function (err) {
|
||||
* // Rolled back
|
||||
* console.error(err);
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* If you have [CLS](https://github.com/othiym23/node-continuation-local-storage) enabled, the transaction
|
||||
@@ -4555,27 +4555,27 @@ declare module "sequelize" {
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* READ_UNCOMMITTED: "READ UNCOMMITTED",
|
||||
* READ_COMMITTED: "READ COMMITTED",
|
||||
* REPEATABLE_READ: "REPEATABLE READ",
|
||||
* SERIALIZABLE: "SERIALIZABLE"
|
||||
* }
|
||||
* READ_UNCOMMITTED: "READ UNCOMMITTED",
|
||||
* READ_COMMITTED: "READ COMMITTED",
|
||||
* REPEATABLE_READ: "REPEATABLE READ",
|
||||
* SERIALIZABLE: "SERIALIZABLE"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Pass in the desired level as the first argument:
|
||||
*
|
||||
* ```js
|
||||
* return sequelize.transaction({
|
||||
* isolationLevel: Sequelize.Transaction.SERIALIZABLE
|
||||
* }, function (t) {
|
||||
*
|
||||
* // your transactions
|
||||
*
|
||||
* }).then(function(result) {
|
||||
* // transaction has been committed. Do something after the commit if required.
|
||||
* }).catch(function(err) {
|
||||
* // do something with the err.
|
||||
* });
|
||||
* isolationLevel: Sequelize.Transaction.SERIALIZABLE
|
||||
* }, function (t) {
|
||||
*
|
||||
* // your transactions
|
||||
*
|
||||
* }).then(function(result) {
|
||||
* // transaction has been committed. Do something after the commit if required.
|
||||
* }).catch(function(err) {
|
||||
* // do something with the err.
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @see ISOLATION_LEVELS
|
||||
@@ -4597,23 +4597,23 @@ declare module "sequelize" {
|
||||
* ```js
|
||||
* t1 // is a transaction
|
||||
* Model.findAll({
|
||||
* where: ...,
|
||||
* transaction: t1,
|
||||
* lock: t1.LOCK...
|
||||
* });
|
||||
* where: ...,
|
||||
* transaction: t1,
|
||||
* lock: t1.LOCK...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Postgres also supports specific locks while eager loading by using OF:
|
||||
* ```js
|
||||
* UserModel.findAll({
|
||||
* where: ...,
|
||||
* include: [TaskModel, ...],
|
||||
* transaction: t1,
|
||||
* lock: {
|
||||
* level: t1.LOCK...,
|
||||
* of: UserModel
|
||||
* }
|
||||
* });
|
||||
* where: ...,
|
||||
* include: [TaskModel, ...],
|
||||
* transaction: t1,
|
||||
* lock: {
|
||||
* level: t1.LOCK...,
|
||||
* of: UserModel
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
* UserModel will be locked but TaskModel won't!
|
||||
*/
|
||||
|
||||
Vendored
+5
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for stripe
|
||||
// Project: https://stripe.com/
|
||||
// Definitions by: Eric J. Smith <https://github.com/ejsmith/>
|
||||
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface StripeStatic {
|
||||
@@ -11,6 +11,7 @@ interface StripeStatic {
|
||||
cardType(cardNumber: string): string;
|
||||
getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
|
||||
card: StripeCardData;
|
||||
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
|
||||
}
|
||||
|
||||
interface StripeTokenData {
|
||||
@@ -57,8 +58,9 @@ interface StripeCardData {
|
||||
address_state?: string;
|
||||
address_zip?: string;
|
||||
address_country?: string;
|
||||
|
||||
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
|
||||
}
|
||||
|
||||
declare var Stripe: StripeStatic;
|
||||
declare module "Stripe" {
|
||||
export = StripeStatic;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="ui-router-extras.d.ts"/>
|
||||
|
||||
var myApp = angular.module('testModule')
|
||||
|
||||
myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: angular.ui.IStickyStateProvider) => {
|
||||
var state: angular.ui.IStickyState = {
|
||||
name: 'test',
|
||||
sticky: true,
|
||||
controller: ($previousState: angular.ui.IPreviousStateService) => {
|
||||
$previousState.memo('test-memo1');
|
||||
$previousState.memo('test-memo2', 'test-state-name2');
|
||||
$previousState.memo('test-memo3', 'test-state-name3', {});
|
||||
$previousState.forget('test-memo3');
|
||||
$previousState.go('test-memo2', {
|
||||
location: true,
|
||||
notify: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$stickyStateProvider.enableDebug(true);
|
||||
$stateProvider.state(state);
|
||||
});
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
// Type definitions for UI-Router Extras 0.0.14+ (ct.ui.router.extras module)
|
||||
// Project: https://github.com/christopherthielen/ui-router-extras
|
||||
// Definitions by: Michael Putters <https://github.com/mputters>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
|
||||
|
||||
// Support for AMD require
|
||||
declare module 'angular-ui-router-extras' {
|
||||
var _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module angular.ui {
|
||||
|
||||
/**
|
||||
* Previous state
|
||||
*/
|
||||
interface IPreviousState {
|
||||
state: IState;
|
||||
params?: {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous state service
|
||||
*/
|
||||
interface IPreviousStateService {
|
||||
|
||||
/**
|
||||
* Get a previous state
|
||||
* @param memoName Memo name
|
||||
* @return Previous state
|
||||
*/
|
||||
get(memoName?: string): IPreviousState;
|
||||
|
||||
/**
|
||||
* Go to a state
|
||||
* @param memoName Memo name
|
||||
* @param options State options
|
||||
* @return Promise
|
||||
*/
|
||||
go(memoName: string, options?: IStateOptions): angular.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Memorize a state
|
||||
* @param memoName Memo name
|
||||
* @param defaultStateName Default state name
|
||||
* @param defaultStateParams Default state parameters
|
||||
*/
|
||||
memo(memoName: string, defaultStateName?: string, defaultStateParams?: {}): void;
|
||||
|
||||
/**
|
||||
* Forget a memorized name
|
||||
* @param memoName Memo name
|
||||
*/
|
||||
forget(memoName: string): void;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sticky state
|
||||
*/
|
||||
interface IStickyState extends angular.ui.IState {
|
||||
sticky?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sticky state service
|
||||
*/
|
||||
interface IStickyStateService {
|
||||
getInactiveStates(): IStickyState[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sticky state provider
|
||||
*/
|
||||
interface IStickyStateProvider extends angular.IServiceProvider {
|
||||
debugMode(): boolean;
|
||||
enableDebug(enabled: boolean): boolean;
|
||||
registerStickyState(state: IStickyState): void;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ var tqos = new dds.TopicQos();
|
||||
var chatTopic = new dds.Topic(0, 'ChatMessage', tqos);
|
||||
runtime.registerTopic(chatTopic);
|
||||
|
||||
var writerQos = new dds.DataWriterQos();
|
||||
var writerQos = new dds.DataWriterQos(dds.Partition("chatroom"), dds.Reliability.Reliable, dds.Durability.Persistent);
|
||||
var writer = new dds.DataWriter(runtime, chatTopic, writerQos);
|
||||
|
||||
writer.write({
|
||||
@@ -15,7 +15,7 @@ writer.write({
|
||||
msg : "Hello World!"
|
||||
});
|
||||
|
||||
var readerQos = new dds.DataReaderQos();
|
||||
var readerQos = new dds.DataReaderQos(dds.Partition("chatroom"), dds.Reliability.Reliable, dds.Durability.Persistent);
|
||||
var reader = new dds.DataReader(runtime, chatTopic, readerQos);
|
||||
|
||||
reader.addListener(function(msg) {
|
||||
|
||||
+25
-39
@@ -39,11 +39,11 @@ declare module DDS {
|
||||
/**
|
||||
* KeepAll - KEEP_ALL qos policy
|
||||
*/
|
||||
KeepAll:any;
|
||||
static KeepAll:any;
|
||||
/**
|
||||
* KeepLast - KEEP_LAST qos policy
|
||||
*/
|
||||
KeepLast:any;
|
||||
static KeepLast:any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,51 +62,37 @@ declare module DDS {
|
||||
/**
|
||||
* Reliable - 'Reliable' reliability policy
|
||||
*/
|
||||
Reliable:any;
|
||||
static Reliable:any;
|
||||
/**
|
||||
* BestEffort - 'BestEffort' reliability policy
|
||||
*/
|
||||
BestEffort:any;
|
||||
static BestEffort:any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Partition policy
|
||||
* Create new partition policy
|
||||
*
|
||||
* @param policies - partition names
|
||||
* @example var qos = Partition('p1', 'p2')
|
||||
*/
|
||||
export class Partition implements Policy {
|
||||
/**
|
||||
* Create new partition policy
|
||||
*
|
||||
* @param policies - partition names
|
||||
* @example var qos = Partition('p1', 'p2')
|
||||
*/
|
||||
constructor(...policies:string[]);
|
||||
}
|
||||
export function Partition(...policies:string[]):Policy;
|
||||
|
||||
/**
|
||||
* Content Filter policy
|
||||
* Create new content filter policy
|
||||
*
|
||||
* @param expr - filter expression
|
||||
* @example var filter = ContentFilter("x>10 AND y<50")
|
||||
*/
|
||||
export class ContentFilter implements Policy {
|
||||
/**
|
||||
* Create new content filter policy
|
||||
*
|
||||
* @param expr - filter expression
|
||||
* @example var filter = ContentFilter("x>10 AND y<50")
|
||||
*/
|
||||
constructor(expr:string);
|
||||
}
|
||||
export function ContentFilter(expr:string):Policy;
|
||||
|
||||
|
||||
/**
|
||||
* Time Filter policy
|
||||
* Create new time filter policy
|
||||
*
|
||||
* @param period - time duration (unit ?)
|
||||
* @example var filter = TimeFilter(100)
|
||||
*/
|
||||
export class TimeFilter implements Policy {
|
||||
/**
|
||||
* Create new content filter policy
|
||||
*
|
||||
* @param period - time duration (unit ?)
|
||||
* @example var filter = TimeFilter(100)
|
||||
*/
|
||||
constructor(period:number);
|
||||
}
|
||||
export function TimeFilter(period:number):Policy;
|
||||
|
||||
/**
|
||||
* Durability Policy
|
||||
@@ -125,19 +111,19 @@ declare module DDS {
|
||||
/**
|
||||
* Volatile - Volatile durability policy
|
||||
*/
|
||||
Volatile:any;
|
||||
static Volatile:any;
|
||||
/**
|
||||
* TransientLocal - TransientLocal durability policy
|
||||
*/
|
||||
TransientLocal:any;
|
||||
static TransientLocal:any;
|
||||
/**
|
||||
* Transient - Transient durability policy
|
||||
*/
|
||||
Transient:any;
|
||||
static Transient:any;
|
||||
/**
|
||||
* Persistent - Persistent durability policy
|
||||
*/
|
||||
Persistent:any;
|
||||
static Persistent:any;
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +459,7 @@ declare module DDS {
|
||||
|
||||
export var runtime:{
|
||||
Runtime : Runtime;
|
||||
}
|
||||
};
|
||||
|
||||
export var VERSION:string;
|
||||
}
|
||||
|
||||
Vendored
+18
-1
@@ -1541,7 +1541,24 @@ declare module Windows {
|
||||
device,
|
||||
printTaskSettings,
|
||||
cameraSettings,
|
||||
webAuthenticationBrokerContinuation
|
||||
restrictedLaunch,
|
||||
appointmentsProvider,
|
||||
contact,
|
||||
lockScreenCall,
|
||||
voiceCommand,
|
||||
lockScreen,
|
||||
pickerReturned,
|
||||
walletAction,
|
||||
pickFileContinuation,
|
||||
pickSaveFileContinuation,
|
||||
pickFolderContinuation,
|
||||
webAuthenticationBrokerContinuation,
|
||||
webAccountProvider,
|
||||
componentUI,
|
||||
protocolForResults,
|
||||
toastNotification,
|
||||
print3DWorkflow,
|
||||
dialReceiver
|
||||
}
|
||||
export interface IActivatedEventArgs {
|
||||
kind: Windows.ApplicationModel.Activation.ActivationKind;
|
||||
|
||||
Reference in New Issue
Block a user