mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge upstream into express-router
This commit is contained in:
@@ -97,6 +97,7 @@ List of Definitions
|
||||
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
|
||||
* [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
* [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Html2Canvas.js](https://github.com/niklasvh/html2canvas/) (by [Richard Hepburn](https://github.com/rwhepburn))
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter))
|
||||
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
|
||||
|
||||
Vendored
+2
-2
@@ -19,8 +19,8 @@ declare module ng.ui {
|
||||
params?: any[];
|
||||
views?: {};
|
||||
abstract?: boolean;
|
||||
onEnter?: Function;
|
||||
onExit?: Function;
|
||||
onEnter?: any;
|
||||
onExit?: any;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
|
||||
+139
-135
@@ -43,11 +43,11 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa
|
||||
**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces.
|
||||
|
||||
Bellow is an example of how to use the interfaces:
|
||||
|
||||
function MainController($scope: ng.IScope, $http: ng.IHttpService) {
|
||||
// code assistance will now be available for $scope and $http
|
||||
}
|
||||
|
||||
```ts
|
||||
function MainController($scope: ng.IScope, $http: ng.IHttpService) {
|
||||
// code assistance will now be available for $scope and $http
|
||||
}
|
||||
```
|
||||
|
||||
## Services and other injectables
|
||||
|
||||
@@ -71,156 +71,160 @@ The **$httpProvider**, thus, is defined by **ng.IHttpProvider**.
|
||||
TypeScript allows for static checking. Among other obvious things, that means you're gonna have to extend interfaces when you need to augment an object whose interface has been defined, because otherwise the compiler will see it as an error to try to assign a value to a unspecified member.
|
||||
|
||||
Consider the following ordinary code:
|
||||
|
||||
function Controller($scope) {
|
||||
$scope.$broadcast('myEvent');
|
||||
$scope.title = 'Yabadabadu';
|
||||
}
|
||||
|
||||
```ts
|
||||
function Controller($scope) {
|
||||
$scope.$broadcast('myEvent');
|
||||
$scope.title = 'Yabadabadu';
|
||||
}
|
||||
```
|
||||
That will not produce any compilation error because the compiler does not know the first thing about $scope to do any checking. For that same reason, you will not get any assistance either.
|
||||
|
||||
Now consider this:
|
||||
|
||||
function Controller($scope: ng.IScope) {
|
||||
$scope.$broadcast('myEvent');
|
||||
$scope.title = 'Yabadabadu';
|
||||
}
|
||||
```ts
|
||||
function Controller($scope: ng.IScope) {
|
||||
$scope.$broadcast('myEvent');
|
||||
$scope.title = 'Yabadabadu';
|
||||
}
|
||||
```
|
||||
|
||||
Now we annotated `$scope` with the interface `ng.IScope`. The compiler now knows that, among other members, `$scope` has a method called `$broadcast`. That interface, however, does not define a `title` property. The compiler will complain about it.
|
||||
|
||||
Since you are augmenting the $scope object, you should let the compiler know what to expect then:
|
||||
```ts
|
||||
interface ICustomScope extends ng.IScope {
|
||||
title: string;
|
||||
}
|
||||
|
||||
interface ICustomScope extends ng.IScope {
|
||||
title: string;
|
||||
}
|
||||
|
||||
function Controller($scope: ng.ICustomScope) {
|
||||
$scope.$broadcast('myEvent');
|
||||
$scope.title = 'Yabadabadu';
|
||||
}
|
||||
function Controller($scope: ng.ICustomScope) {
|
||||
$scope.$broadcast('myEvent');
|
||||
$scope.title = 'Yabadabadu';
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Working with $resource
|
||||
```ts
|
||||
/// <reference path="angular.d.ts" />
|
||||
/// <reference path="angular-resource.d.ts" />
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
/// <reference path="angular-resource.d.ts" />
|
||||
// We have the option to define arguments for a custom resource
|
||||
interface IArticleParameters {
|
||||
id: number;
|
||||
}
|
||||
|
||||
// We have the option to define arguments for a custom resource
|
||||
interface IArticleParameters {
|
||||
id: number;
|
||||
interface IArticleResource extends ng.resource.IResource<IArticleResource> {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
|
||||
// Although all actions defined on IArticleResourceClass are avaiable with
|
||||
// the '$' prefix, we have the choice to expose only what we will use
|
||||
$publish(): IArticleResource;
|
||||
$unpublish(): IArticleResource;
|
||||
}
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResource> {
|
||||
// Overload get to accept our custom parameters
|
||||
get(): ng.resource.IResource;
|
||||
get(params: IArticleParameters, onSuccess: Function): IArticleResource;
|
||||
|
||||
// Add our custom resource actions
|
||||
publish(): IArticleResource;
|
||||
publish(params: IArticleParameters): IArticleResource;
|
||||
unpublish(params: IArticleParameters): IArticleResource;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass {
|
||||
// Overload get to accept our custom parameters
|
||||
get(): ng.resource.IResource;
|
||||
get(params: IArticleParameters, onSuccess: Function): IArticleResource;
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articleResource = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Add our custom resource actions
|
||||
publish(): IArticleResource;
|
||||
publish(params: IArticleParameters): IArticleResource;
|
||||
unpublish(params: IArticleParameters): IArticleResource;
|
||||
}
|
||||
|
||||
interface IArticleResource extends ng.resource.IResource {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
|
||||
// Although all actions defined on IArticleResourceClass are avaiable with
|
||||
// the '$' prefix, we have the choice to expose only what we will use
|
||||
$publish(): IArticleResource;
|
||||
$unpublish(): IArticleResource;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articleResource = <IArticleResourceClass> $resource('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article: IArticleResource = articleResource.get({id: 1}, function success() {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
});
|
||||
}
|
||||
|
||||
### Working with $resource in angular-1.0 definitions
|
||||
|
||||
/// <reference path="angular-1.0.d.ts" />
|
||||
/// <reference path="angular-resource-1.0.d.ts" />
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass {
|
||||
publish: ng.resource.IActionCall;
|
||||
unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
interface IArticleResource extends ng.resource.IResource {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
$publish: ng.resource.IActionCall;
|
||||
$unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articles = <IArticleResourceClass> $resource('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articles.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article = <IArticleResource> articles.get({id: 1});
|
||||
// Now we can do this
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article: IArticleResource = articleResource.get({id: 1}, function success() {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Working with $resource in angular-1.0 definitions
|
||||
```ts
|
||||
/// <reference path="angular-1.0.d.ts" />
|
||||
/// <reference path="angular-resource-1.0.d.ts" />
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass {
|
||||
publish: ng.resource.IActionCall;
|
||||
unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
interface IArticleResource extends ng.resource.IResource {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
$publish: ng.resource.IActionCall;
|
||||
$unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articles = <IArticleResourceClass> $resource('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articles.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article = <IArticleResource> articles.get({id: 1});
|
||||
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/// <reference path="angular-resource.d.ts" />
|
||||
|
||||
interface IMyResource extends ng.resource.IResource<IMyResource> { };
|
||||
interface IMyResourceClass extends ng.resource.IResourceClass<IMyResource> { };
|
||||
|
||||
///////////////////////////////////////
|
||||
// IActionDescriptor
|
||||
///////////////////////////////////////
|
||||
@@ -14,9 +17,9 @@ actionDescriptor.params = { key: 'value' };
|
||||
///////////////////////////////////////
|
||||
// IResourceClass
|
||||
///////////////////////////////////////
|
||||
var resourceClass: ng.resource.IResourceClass;
|
||||
var resource: ng.resource.IResource;
|
||||
var resourceArray: ng.resource.IResource[];
|
||||
var resourceClass: IMyResourceClass;
|
||||
var resource: IMyResource;
|
||||
var resourceArray: IMyResource[];
|
||||
|
||||
resource = resourceClass.delete();
|
||||
resource = resourceClass.delete({ key: 'value' });
|
||||
@@ -63,13 +66,22 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' });
|
||||
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { });
|
||||
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { });
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceService
|
||||
///////////////////////////////////////
|
||||
var resourceService: ng.resource.IResourceService;
|
||||
resourceClass = resourceService<IMyResource, IMyResourceClass>('test');
|
||||
resourceClass = resourceService<IMyResource>('test');
|
||||
resourceClass = resourceService('test');
|
||||
|
||||
///////////////////////////////////////
|
||||
// IModule
|
||||
///////////////////////////////////////
|
||||
var mod: ng.IModule;
|
||||
var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction;
|
||||
var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction<IMyResource>;
|
||||
var resourceService: ng.resource.IResourceService;
|
||||
|
||||
resourceClass = resourceServiceFactoryFunction<IMyResourceClass>(resourceService);
|
||||
|
||||
resourceServiceFactoryFunction = function (resourceService) { return resourceClass };
|
||||
mod = mod.factory('factory name', resourceServiceFactoryFunction);
|
||||
|
||||
Vendored
+69
-60
@@ -1,7 +1,6 @@
|
||||
// Type definitions for Angular JS 1.2 (ngResource module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions: https://github.com/daptiv/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
|
||||
@@ -19,10 +18,19 @@ declare module ng.resource {
|
||||
// that deeply.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IResourceService {
|
||||
|
||||
<T extends IResource<T>, U extends IResourceClass<T>>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): U;
|
||||
<T extends IResource<T>>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<T>;
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass;
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<IResource<any>>;
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
@@ -42,65 +50,66 @@ declare module ng.resource {
|
||||
// PATCH (in other words, methods with body). Otherwise, it's going
|
||||
// to be considered as parameters to the request.
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
interface IResourceClass {
|
||||
get(): IResource;
|
||||
get(dataOrParams: any): IResource;
|
||||
get(dataOrParams: any, success: Function): IResource;
|
||||
get(success: Function, error?: Function): IResource;
|
||||
get(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
save(): IResource;
|
||||
save(dataOrParams: any): IResource;
|
||||
save(dataOrParams: any, success: Function): IResource;
|
||||
save(success: Function, error?: Function): IResource;
|
||||
save(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
query(): IResource[];
|
||||
query(dataOrParams: any): IResource[];
|
||||
query(dataOrParams: any, success: Function): IResource[];
|
||||
query(success: Function, error?: Function): IResource[];
|
||||
query(params: any, data: any, success?: Function, error?: Function): IResource[];
|
||||
remove(): IResource;
|
||||
remove(dataOrParams: any): IResource;
|
||||
remove(dataOrParams: any, success: Function): IResource;
|
||||
remove(success: Function, error?: Function): IResource;
|
||||
remove(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
delete(): IResource;
|
||||
delete(dataOrParams: any): IResource;
|
||||
delete(dataOrParams: any, success: Function): IResource;
|
||||
delete(success: Function, error?: Function): IResource;
|
||||
delete(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
interface IResourceClass<T extends IResource<T>> {
|
||||
get(): T;
|
||||
get(dataOrParams: any): T;
|
||||
get(dataOrParams: any, success: Function): T;
|
||||
get(success: Function, error?: Function): T;
|
||||
get(params: any, data: any, success?: Function, error?: Function): T;
|
||||
save(): T;
|
||||
save(dataOrParams: any): T;
|
||||
save(dataOrParams: any, success: Function): T;
|
||||
save(success: Function, error?: Function): T;
|
||||
save(params: any, data: any, success?: Function, error?: Function): T;
|
||||
query(): T[];
|
||||
query(dataOrParams: any): T[];
|
||||
query(dataOrParams: any, success: Function): T[];
|
||||
query(success: Function, error?: Function): T[];
|
||||
query(params: any, data: any, success?: Function, error?: Function): T[];
|
||||
remove(): T;
|
||||
remove(dataOrParams: any): T;
|
||||
remove(dataOrParams: any, success: Function): T;
|
||||
remove(success: Function, error?: Function): T;
|
||||
remove(params: any, data: any, success?: Function, error?: Function): T;
|
||||
delete(): T;
|
||||
delete(dataOrParams: any): T;
|
||||
delete(dataOrParams: any, success: Function): T;
|
||||
delete(success: Function, error?: Function): T;
|
||||
delete(params: any, data: any, success?: Function, error?: Function): T;
|
||||
}
|
||||
|
||||
interface IResource {
|
||||
$get(): IResource;
|
||||
$get(dataOrParams: any): IResource;
|
||||
$get(dataOrParams: any, success: Function): IResource;
|
||||
$get(success: Function, error?: Function): IResource;
|
||||
$get(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
$save(): IResource;
|
||||
$save(dataOrParams: any): IResource;
|
||||
$save(dataOrParams: any, success: Function): IResource;
|
||||
$save(success: Function, error?: Function): IResource;
|
||||
$save(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
$query(): IResource[];
|
||||
$query(dataOrParams: any): IResource[];
|
||||
$query(dataOrParams: any, success: Function): IResource[];
|
||||
$query(success: Function, error?: Function): IResource[];
|
||||
$query(params: any, data: any, success?: Function, error?: Function): IResource[];
|
||||
$remove(): IResource;
|
||||
$remove(dataOrParams: any): IResource;
|
||||
$remove(dataOrParams: any, success: Function): IResource;
|
||||
$remove(success: Function, error?: Function): IResource;
|
||||
$remove(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
$delete(): IResource;
|
||||
$delete(dataOrParams: any): IResource;
|
||||
$delete(dataOrParams: any, success: Function): IResource;
|
||||
$delete(success: Function, error?: Function): IResource;
|
||||
$delete(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
interface IResource<T extends IResource<T>> {
|
||||
$get(): T;
|
||||
$get(dataOrParams: any): T;
|
||||
$get(dataOrParams: any, success: Function): T;
|
||||
$get(success: Function, error?: Function): T;
|
||||
$get(params: any, data: any, success?: Function, error?: Function): T;
|
||||
$save(): T;
|
||||
$save(dataOrParams: any): T;
|
||||
$save(dataOrParams: any, success: Function): T;
|
||||
$save(success: Function, error?: Function): T;
|
||||
$save(params: any, data: any, success?: Function, error?: Function): T;
|
||||
$query(): T[];
|
||||
$query(dataOrParams: any): T[];
|
||||
$query(dataOrParams: any, success: Function): T[];
|
||||
$query(success: Function, error?: Function): T[];
|
||||
$query(params: any, data: any, success?: Function, error?: Function): T[];
|
||||
$remove(): T;
|
||||
$remove(dataOrParams: any): T;
|
||||
$remove(dataOrParams: any, success: Function): T;
|
||||
$remove(success: Function, error?: Function): T;
|
||||
$remove(params: any, data: any, success?: Function, error?: Function): T;
|
||||
$delete(): T;
|
||||
$delete(dataOrParams: any): T;
|
||||
$delete(dataOrParams: any, success: Function): T;
|
||||
$delete(success: Function, error?: Function): T;
|
||||
$delete(params: any, data: any, success?: Function, error?: Function): T;
|
||||
}
|
||||
|
||||
/** when creating a resource factory via IModule.factory */
|
||||
interface IResourceServiceFactoryFunction {
|
||||
($resource: ng.resource.IResourceService): ng.resource.IResourceClass;
|
||||
interface IResourceServiceFactoryFunction<T extends IResource<T>> {
|
||||
($resource: ng.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: ng.resource.IResourceService): U;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +118,6 @@ declare module ng {
|
||||
|
||||
interface IModule {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule;
|
||||
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+22
-19
@@ -3,10 +3,13 @@
|
||||
// Definitions by: [RomanoLindano]
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module angularScenario {
|
||||
export interface AngularModel {
|
||||
declare module ng {
|
||||
export interface IAngularStatic {
|
||||
scenario: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module angularScenario {
|
||||
|
||||
export interface RunFunction {
|
||||
(functionToRun: any): any;
|
||||
@@ -46,25 +49,25 @@ declare module angularScenario {
|
||||
reload(): void;
|
||||
window(): testWindow;
|
||||
location(): testLocation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface Matchers {
|
||||
toEqual(value: any): void;
|
||||
toBe(value: any): void;
|
||||
toBeDefined(): void;
|
||||
toBeTruthy(): void;
|
||||
toBeFalsy(): void;
|
||||
toMatch(regularExpression: any): void;
|
||||
toBeNull(): void;
|
||||
toBe(value: any): void;
|
||||
toBeDefined(): void;
|
||||
toBeTruthy(): void;
|
||||
toBeFalsy(): void;
|
||||
toMatch(regularExpression: any): void;
|
||||
toBeNull(): void;
|
||||
toContain(value: any): void;
|
||||
toBeLessThan(value: any): void;
|
||||
toBeGreaterThan(value: any): void;
|
||||
toBeLessThan(value: any): void;
|
||||
toBeGreaterThan(value: any): void;
|
||||
}
|
||||
|
||||
export interface CustomMatchers extends Matchers{
|
||||
export interface CustomMatchers extends Matchers {
|
||||
}
|
||||
|
||||
export interface Expect extends CustomMatchers {
|
||||
export interface Expect extends CustomMatchers {
|
||||
not(): angularScenario.CustomMatchers;
|
||||
}
|
||||
|
||||
@@ -77,7 +80,7 @@ declare module angularScenario {
|
||||
}
|
||||
|
||||
export interface Input {
|
||||
enter(value: any);
|
||||
enter(value: any): any;
|
||||
check(): any;
|
||||
select(radioButtonValue: any): any;
|
||||
val(): Future;
|
||||
@@ -92,12 +95,12 @@ declare module angularScenario {
|
||||
export interface Select {
|
||||
option(value: any): any;
|
||||
option(...listOfValues: any[]): any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Element {
|
||||
count(): Future;
|
||||
click(): any;
|
||||
query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) =>any): any;
|
||||
query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) => any): any;
|
||||
val(): Future;
|
||||
text(): Future;
|
||||
html(): Future;
|
||||
@@ -111,7 +114,7 @@ declare module angularScenario {
|
||||
scrollLeft(): Future;
|
||||
scrollTop(): Future;
|
||||
offset(): Future;
|
||||
|
||||
|
||||
val(value: any): void;
|
||||
text(value: any): void;
|
||||
html(value: any): void;
|
||||
@@ -154,4 +157,4 @@ declare function input(ngModelBinding: string): angularScenario.Input;
|
||||
declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater;
|
||||
declare function select(ngModelBinding: string): angularScenario.Select;
|
||||
declare function element(selector: string, elementDescription?: string): angularScenario.Element;
|
||||
declare var angular: angularScenario.AngularModel;
|
||||
declare var angular: ng.IAngularStatic;
|
||||
|
||||
Vendored
+15
-14
@@ -127,15 +127,15 @@ declare module ng {
|
||||
// this is necessary to be able to access the scoped attributes. it's not very elegant
|
||||
// because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way
|
||||
// this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656
|
||||
[name: string]: any;
|
||||
|
||||
// Adds the CSS class value specified by the classVal parameter to the
|
||||
// element. If animations are enabled then an animation will be triggered
|
||||
[name: string]: any;
|
||||
|
||||
// Adds the CSS class value specified by the classVal parameter to the
|
||||
// element. If animations are enabled then an animation will be triggered
|
||||
// for the class addition.
|
||||
$addClass(classVal: string): void;
|
||||
|
||||
// Removes the CSS class value specified by the classVal parameter from the
|
||||
// element. If animations are enabled then an animation will be triggered for
|
||||
// Removes the CSS class value specified by the classVal parameter from the
|
||||
// element. If animations are enabled then an animation will be triggered for
|
||||
// the class removal.
|
||||
$removeClass(classVal: string): void;
|
||||
|
||||
@@ -143,12 +143,12 @@ declare module ng {
|
||||
$set(key: string, value: any): void;
|
||||
|
||||
// Observes an interpolated attribute.
|
||||
// The observer function will be invoked once during the next $digest
|
||||
// following compilation. The observer is then invoked whenever the
|
||||
// The observer function will be invoked once during the next $digest
|
||||
// following compilation. The observer is then invoked whenever the
|
||||
// interpolated value changes.
|
||||
$observe(name: string, fn:(value?:any)=>any): Function;
|
||||
|
||||
// A map of DOM element attribute names to the normalized name. This is needed
|
||||
// A map of DOM element attribute names to the normalized name. This is needed
|
||||
// to do reverse lookup from normalized name back to actual name.
|
||||
$attr: Object;
|
||||
}
|
||||
@@ -451,12 +451,12 @@ declare module ng {
|
||||
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
|
||||
|
||||
|
||||
|
||||
catch<TResult>(onRejected: (reason: any) => IHttpPromise<TResult>): IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>): IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (reason: any) => TResult): IPromise<TResult>;
|
||||
|
||||
|
||||
finally<TResult>(finallyCallback: ()=>any):IPromise<TResult>;
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ declare module ng {
|
||||
valueOf(value: any): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEDelegateProvider
|
||||
// see http://docs.angularjs.org/api/ng.$sceDelegateProvider
|
||||
@@ -709,7 +709,7 @@ declare module ng {
|
||||
resourceUrlBlacklist(blacklist: any[]): void;
|
||||
resourceUrlWhitelist(whitelist: any[]): void;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Directive
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
|
||||
@@ -793,6 +793,7 @@ declare module ng {
|
||||
annotate(inlineAnnotadedFunction: any[]): string[];
|
||||
get (name: string): any;
|
||||
instantiate(typeConstructor: Function, locals?: any): any;
|
||||
invoke(inlineAnnotadedFunction: any[]): any;
|
||||
invoke(func: Function, context?: any, locals?: any): any;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
-2
@@ -10,7 +10,7 @@
|
||||
declare module Backbone {
|
||||
|
||||
interface AddOptions extends Silenceable {
|
||||
at: number;
|
||||
at?: number;
|
||||
}
|
||||
|
||||
interface HistoryOptions extends Silenceable {
|
||||
@@ -19,7 +19,7 @@ declare module Backbone {
|
||||
}
|
||||
|
||||
interface NavigateOptions {
|
||||
trigger: boolean;
|
||||
trigger?: boolean;
|
||||
}
|
||||
|
||||
interface RouterOptions {
|
||||
@@ -158,7 +158,9 @@ declare module Backbone {
|
||||
comparator(compare: Model, to?: Model): any;
|
||||
|
||||
add(model: Model, options?: AddOptions): Collection;
|
||||
add(model: any, options?: AddOptions): Collection;
|
||||
add(models: Model[], options?: AddOptions): Collection;
|
||||
add(models: any[], options?: AddOptions): Collection;
|
||||
at(index: number): Model;
|
||||
get(id: any): Model;
|
||||
create(attributes: any, options?: ModelSaveOptions): Model;
|
||||
@@ -168,6 +170,7 @@ declare module Backbone {
|
||||
remove(model: Model, options?: Silenceable): Model;
|
||||
remove(models: Model[], options?: Silenceable): Model[];
|
||||
reset(models?: Model[], options?: Silenceable): Model[];
|
||||
reset(models?: any[], options?: Silenceable): Model[];
|
||||
shift(options?: Silenceable): Model;
|
||||
sort(options?: Silenceable): Collection;
|
||||
unshift(model: Model, options?: AddOptions): Model;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
Vendored
+14
-17
@@ -208,7 +208,7 @@ declare module DevExpress.data {
|
||||
}
|
||||
export interface StoreOptions {
|
||||
key?: any;
|
||||
errorHandler: ErrorHandler;
|
||||
errorHandler?: ErrorHandler;
|
||||
loaded?: JQueryCallback;
|
||||
loading?: JQueryCallback;
|
||||
modified?: JQueryCallback;
|
||||
@@ -294,14 +294,6 @@ declare module DevExpress.data {
|
||||
export class ODataStore extends Store {
|
||||
constructor(options?: ODataStoreOptions);
|
||||
}
|
||||
interface IODataContextBase {
|
||||
get(operationName: string, params: { [key: string]: any }): JQueryDeferred<Array<any>>;
|
||||
invoke(operationName: string, params: { [key: string]: any }, httpMethod?: string): JQueryDeferred<Array<any>>;
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; }
|
||||
}
|
||||
interface IODataContext extends IODataContextBase {
|
||||
[entitySetName: string]: Store;
|
||||
}
|
||||
export interface ODataContextOptions {
|
||||
url: string;
|
||||
jsonp?: boolean;
|
||||
@@ -310,11 +302,11 @@ declare module DevExpress.data {
|
||||
beforeSend?: () => any;
|
||||
entities?: Array<any>;
|
||||
}
|
||||
export class ODataContext implements IODataContextBase {
|
||||
export class ODataContext {
|
||||
constructor(options?: ODataContextOptions);
|
||||
get(operationName: string, params: { [key: string]: any }): JQueryDeferred<Array<any>>;
|
||||
invoke(operationName: string, params: { [key: string]: any }, httpMethod?: string): JQueryDeferred<Array<any>>;
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; }
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; };
|
||||
}
|
||||
}
|
||||
declare module DevExpress.ui {
|
||||
@@ -1030,7 +1022,12 @@ declare module DevExpress.viz.charts.series {
|
||||
hoverStyle?: AreaSeriesStyle;
|
||||
point?: BasePointOptions;
|
||||
}
|
||||
export interface RangeBarSeriesOptions extends z_BaseRangeSeriesOptions, z_BaseBarSeriesOptions { }
|
||||
export interface RangeBarSeriesOptions extends z_BaseBarSeriesOptions {
|
||||
rangeValue1Field?: string;
|
||||
rangeValue2Field?: string;
|
||||
pane?: string;
|
||||
axis?: string;
|
||||
}
|
||||
export interface SplineSeriesOptions extends LineSeriesOptions { }
|
||||
export interface SplineAreaSeries extends AreaSeriesOptions { }
|
||||
export interface StackedLineSeries extends LineSeriesOptions { }
|
||||
@@ -1373,8 +1370,8 @@ declare module DevExpress.viz.map {
|
||||
borderColor?: string;
|
||||
color?: string;
|
||||
};
|
||||
dataSource?: any;
|
||||
area?: {
|
||||
mapData?: any;
|
||||
areaSettings?: {
|
||||
borderColor?: string;
|
||||
color?: string;
|
||||
hoveredBorderColor?: string;
|
||||
@@ -1389,8 +1386,8 @@ declare module DevExpress.viz.map {
|
||||
click?: (arg: Proxy) => void;
|
||||
selectionChanged?: (arg: Proxy) => void;
|
||||
};
|
||||
markerDataSource?: any;
|
||||
marker?: {
|
||||
markers?: any;
|
||||
markerSettings?: {
|
||||
borderColor?: string;
|
||||
color?: string;
|
||||
hoveredBorderColor?: string;
|
||||
@@ -1448,7 +1445,7 @@ declare module DevExpress.viz.map {
|
||||
}
|
||||
export class Proxy {
|
||||
type: string;
|
||||
attr(name: string): any;
|
||||
attribute(name: string): any;
|
||||
selected(state: boolean): void;
|
||||
selected(): boolean;
|
||||
}
|
||||
|
||||
Vendored
+88
-88
@@ -10,77 +10,77 @@ declare module CodeMirror {
|
||||
|
||||
/** If you want to define extra methods in terms of the CodeMirror API, it is possible to use defineExtension.
|
||||
This will cause the given value(usually a method) to be added to all CodeMirror instances created from then on. */
|
||||
function defineExtension(name: string, value: any);
|
||||
function defineExtension(name: string, value: any): void;
|
||||
|
||||
/** Like defineExtension, but the method will be added to the interface for Doc objects instead. */
|
||||
function defineDocExtension(name: string, value: any);
|
||||
function defineDocExtension(name: string, value: any): void;
|
||||
|
||||
/** Similarly, defineOption can be used to define new options for CodeMirror.
|
||||
The updateFunc will be called with the editor instance and the new value when an editor is initialized,
|
||||
and whenever the option is modified through setOption. */
|
||||
function defineOption(name: string, default_: any, updateFunc: Function);
|
||||
function defineOption(name: string, default_: any, updateFunc: Function): void;
|
||||
|
||||
/** If your extention just needs to run some code whenever a CodeMirror instance is initialized, use CodeMirror.defineInitHook.
|
||||
Give it a function as its only argument, and from then on, that function will be called (with the instance as argument)
|
||||
whenever a new CodeMirror instance is initialized. */
|
||||
function defineInitHook(func: Function);
|
||||
function defineInitHook(func: Function): void;
|
||||
|
||||
|
||||
|
||||
function on(element: any, eventName: string, handler: Function);
|
||||
function off(element: any, eventName: string, handler: Function);
|
||||
function on(element: any, eventName: string, handler: Function): void;
|
||||
function off(element: any, eventName: string, handler: Function): void;
|
||||
|
||||
/** Fired whenever a change occurs to the document. changeObj has a similar type as the object passed to the editor's "change" event,
|
||||
but it never has a next property, because document change events are not batched (whereas editor change events are). */
|
||||
function on(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void );
|
||||
function off(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void );
|
||||
function on(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void ): void;
|
||||
function off(doc: Doc, eventName: 'change', handler: (instance: Doc, change: EditorChange) => void ): void;
|
||||
|
||||
/** See the description of the same event on editor instances. */
|
||||
function on(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void );
|
||||
function off(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void );
|
||||
function on(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void ): void;
|
||||
function off(doc: Doc, eventName: 'beforeChange', handler: (instance: Doc, change: EditorChangeCancellable) => void ): void;
|
||||
|
||||
/** Fired whenever the cursor or selection in this document changes. */
|
||||
function on(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void );
|
||||
function off(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void );
|
||||
function on(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
function off(doc: Doc, eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** Equivalent to the event by the same name as fired on editor instances. */
|
||||
function on(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void );
|
||||
function off(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void );
|
||||
function on(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void ): void;
|
||||
function off(doc: Doc, eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: Position; anchor: Position; }) => void ): void;
|
||||
|
||||
/** Will be fired when the line object is deleted. A line object is associated with the start of the line.
|
||||
Mostly useful when you need to find out when your gutter markers on a given line are removed. */
|
||||
function on(line: LineHandle, eventName: 'delete', handler: () => void );
|
||||
function off(line: LineHandle, eventName: 'delete', handler: () => void );
|
||||
function on(line: LineHandle, eventName: 'delete', handler: () => void ): void;
|
||||
function off(line: LineHandle, eventName: 'delete', handler: () => void ): void;
|
||||
|
||||
/** Fires when the line's text content is changed in any way (but the line is not deleted outright).
|
||||
The change object is similar to the one passed to change event on the editor object. */
|
||||
function on(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void );
|
||||
function off(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void );
|
||||
function on(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void ): void;
|
||||
function off(line: LineHandle, eventName: 'change', handler: (line: LineHandle, change: EditorChange) => void ): void;
|
||||
|
||||
/** Fired when the cursor enters the marked range. From this event handler, the editor state may be inspected but not modified,
|
||||
with the exception that the range on which the event fires may be cleared. */
|
||||
function on(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void );
|
||||
function off(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void );
|
||||
function on(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void ): void;
|
||||
function off(marker: TextMarker, eventName: 'beforeCursorEnter', handler: () => void ): void;
|
||||
|
||||
/** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method.
|
||||
Will only be fired once per handle. Note that deleting the range through text editing does not fire this event,
|
||||
because an undo action might bring the range back into existence. */
|
||||
function on(marker: TextMarker, eventName: 'clear', handler: () => void );
|
||||
function off(marker: TextMarker, eventName: 'clear', handler: () => void );
|
||||
function on(marker: TextMarker, eventName: 'clear', handler: () => void ): void;
|
||||
function off(marker: TextMarker, eventName: 'clear', handler: () => void ): void;
|
||||
|
||||
/** Fired when the last part of the marker is removed from the document by editing operations. */
|
||||
function on(marker: TextMarker, eventName: 'hide', handler: () => void );
|
||||
function off(marker: TextMarker, eventName: 'hide', handler: () => void );
|
||||
function on(marker: TextMarker, eventName: 'hide', handler: () => void ): void;
|
||||
function off(marker: TextMarker, eventName: 'hide', handler: () => void ): void;
|
||||
|
||||
/** Fired when, after the marker was removed by editing, a undo operation brought the marker back. */
|
||||
function on(marker: TextMarker, eventName: 'unhide', handler: () => void );
|
||||
function off(marker: TextMarker, eventName: 'unhide', handler: () => void );
|
||||
function on(marker: TextMarker, eventName: 'unhide', handler: () => void ): void;
|
||||
function off(marker: TextMarker, eventName: 'unhide', handler: () => void ): void;
|
||||
|
||||
/** Fired whenever the editor re-adds the widget to the DOM. This will happen once right after the widget is added (if it is scrolled into view),
|
||||
and then again whenever it is scrolled out of view and back in again, or when changes to the editor options
|
||||
or the line the widget is on require the widget to be redrawn. */
|
||||
function on(line: LineWidget, eventName: 'redraw', handler: () => void );
|
||||
function off(line: LineWidget, eventName: 'redraw', handler: () => void );
|
||||
function on(line: LineWidget, eventName: 'redraw', handler: () => void ): void;
|
||||
function off(line: LineWidget, eventName: 'redraw', handler: () => void ): void;
|
||||
|
||||
interface Editor {
|
||||
|
||||
@@ -100,7 +100,7 @@ declare module CodeMirror {
|
||||
|
||||
|
||||
/** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */
|
||||
setOption(option: string, value: any);
|
||||
setOption(option: string, value: any): void;
|
||||
|
||||
/** Retrieves the current value of the given option for this editor instance. */
|
||||
getOption(option: string): any;
|
||||
@@ -110,21 +110,21 @@ declare module CodeMirror {
|
||||
Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them,
|
||||
the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed,
|
||||
in which case they end up below other keymaps added with this method. */
|
||||
addKeyMap(map: any, bottom?: boolean);
|
||||
addKeyMap(map: any, bottom?: boolean): void;
|
||||
|
||||
/** Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string,
|
||||
which will be compared against the name property of the active keymaps. */
|
||||
removeKeyMap(map: any);
|
||||
removeKeyMap(map: any): void;
|
||||
|
||||
/** Enable a highlighting overlay.This is a stateless mini - mode that can be used to add extra highlighting.
|
||||
For example, the search add - on uses it to highlight the term that's currently being searched.
|
||||
mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object.
|
||||
Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null,
|
||||
to override the styling of the base mode entirely, instead of the two being applied together. */
|
||||
addOverlay(mode: any, options?: any);
|
||||
addOverlay(mode: any, options?: any): void;
|
||||
|
||||
/** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */
|
||||
removeOverlay(mode: any);
|
||||
removeOverlay(mode: any): void;
|
||||
|
||||
|
||||
/** Retrieve the currently active document from an editor. */
|
||||
@@ -140,7 +140,7 @@ declare module CodeMirror {
|
||||
setGutterMarker(line: any, gutterID: string, value: HTMLElement): CodeMirror.LineHandle;
|
||||
|
||||
/** Remove all gutter markers in the gutter with the given ID. */
|
||||
clearGutter(gutterID: string);
|
||||
clearGutter(gutterID: string): void;
|
||||
|
||||
/** Set a CSS class name for the given line.line can be a number or a line handle.
|
||||
where determines to which element this class should be applied, can can be one of "text" (the text element, which lies in front of the selection),
|
||||
@@ -171,7 +171,7 @@ declare module CodeMirror {
|
||||
/** Puts node, which should be an absolutely positioned DOM node, into the editor, positioned right below the given { line , ch } position.
|
||||
When scrollIntoView is true, the editor will ensure that the entire node is visible (if possible).
|
||||
To remove the widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent). */
|
||||
addWidget(pos: CodeMirror.Position, node: HTMLElement, scrollIntoView: boolean);
|
||||
addWidget(pos: CodeMirror.Position, node: HTMLElement, scrollIntoView: boolean): void;
|
||||
|
||||
/** Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards.
|
||||
line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line.
|
||||
@@ -192,10 +192,10 @@ declare module CodeMirror {
|
||||
/** Programatically set the size of the editor (overriding the applicable CSS rules).
|
||||
width and height height can be either numbers(interpreted as pixels) or CSS units ("100%", for example).
|
||||
You can pass null for either of them to indicate that that dimension should not be changed. */
|
||||
setSize(width: any, height: any);
|
||||
setSize(width: any, height: any): void;
|
||||
|
||||
/** Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect. */
|
||||
scrollTo(x: number, y: number);
|
||||
scrollTo(x: number, y: number): void;
|
||||
|
||||
/** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area,
|
||||
and the size of the visible area(minus scrollbars). */
|
||||
@@ -210,11 +210,11 @@ declare module CodeMirror {
|
||||
|
||||
/** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: CodeMirror.Position, margin?: number);
|
||||
scrollIntoView(pos: CodeMirror.Position, margin?: number): void;
|
||||
|
||||
/** Scrolls the given element into view. pos is a { left , top , right , bottom } object, in editor-local coordinates.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number);
|
||||
scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number): void;
|
||||
|
||||
/** Returns an { left , top , bottom } object containing the coordinates of the cursor position.
|
||||
If mode is "local" , they will be relative to the top-left corner of the editable document.
|
||||
@@ -251,7 +251,7 @@ declare module CodeMirror {
|
||||
|
||||
/** If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it,
|
||||
you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */
|
||||
refresh();
|
||||
refresh(): void;
|
||||
|
||||
|
||||
/** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */
|
||||
@@ -285,11 +285,11 @@ declare module CodeMirror {
|
||||
"smart" Use the mode's smart indentation if available, behave like "prev" otherwise.
|
||||
"add" Increase the indentation of the line by one indent unit.
|
||||
"subtract" Reduce the indentation of the line. */
|
||||
indentLine(line: number, dir?: string);
|
||||
indentLine(line: number, dir?: string): void;
|
||||
|
||||
|
||||
/** Give the editor focus. */
|
||||
focus();
|
||||
focus(): void;
|
||||
|
||||
/** Returns the hidden textarea used to read input. */
|
||||
getInputField(): HTMLTextAreaElement;
|
||||
@@ -308,61 +308,61 @@ declare module CodeMirror {
|
||||
/** Events are registered with the on method (and removed with the off method).
|
||||
These are the events that fire on the instance object. The name of the event is followed by the arguments that will be passed to the handler.
|
||||
The instance argument always refers to the editor instance. */
|
||||
on(eventName: string, handler: (instance: CodeMirror.Editor) => void );
|
||||
off(eventName: string, handler: (instance: CodeMirror.Editor) => void );
|
||||
on(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** Fires every time the content of the editor is changed. */
|
||||
on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void );
|
||||
off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void );
|
||||
on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
|
||||
off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
|
||||
|
||||
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
|
||||
The changeObj never has a next property, since this is fired for each individual change, and not batched per operation.
|
||||
Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization.
|
||||
Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation,
|
||||
probably cause the editor to become corrupted. */
|
||||
on(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void );
|
||||
off(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void );
|
||||
on(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void;
|
||||
off(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void;
|
||||
|
||||
/** Will be fired when the cursor or selection moves, or any change is made to the editor content. */
|
||||
on(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void );
|
||||
off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void );
|
||||
on(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** This event is fired before the selection is moved. Its handler may modify the resulting selection head and anchor.
|
||||
Handlers for this event have the same restriction as "beforeChange" handlers � they should not do anything to directly update the state of the editor. */
|
||||
on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void );
|
||||
off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void );
|
||||
on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void;
|
||||
off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void;
|
||||
|
||||
/** Fires whenever the view port of the editor changes (due to scrolling, editing, or any other factor).
|
||||
The from and to arguments give the new start and end of the viewport. */
|
||||
on(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void );
|
||||
off(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void );
|
||||
on(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void;
|
||||
off(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void;
|
||||
|
||||
/** Fires when the editor gutter (the line-number area) is clicked. Will pass the editor instance as first argument,
|
||||
the (zero-based) number of the line that was clicked as second argument, the CSS class of the gutter that was clicked as third argument,
|
||||
and the raw mousedown event object as fourth argument. */
|
||||
on(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void );
|
||||
off(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void );
|
||||
on(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void;
|
||||
off(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void;
|
||||
|
||||
/** Fires whenever the editor is focused. */
|
||||
on(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void );
|
||||
off(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void );
|
||||
on(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** Fires whenever the editor is unfocused. */
|
||||
on(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void );
|
||||
off(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void );
|
||||
on(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** Fires when the editor is scrolled. */
|
||||
on(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void );
|
||||
off(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void );
|
||||
on(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** Will be fired whenever CodeMirror updates its DOM display. */
|
||||
on(eventName: 'update', handler: (instance: CodeMirror.Editor) => void );
|
||||
off(eventName: 'update', handler: (instance: CodeMirror.Editor) => void );
|
||||
on(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
/** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document.
|
||||
The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */
|
||||
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void );
|
||||
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void );
|
||||
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
|
||||
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
|
||||
}
|
||||
|
||||
class Doc {
|
||||
@@ -372,7 +372,7 @@ declare module CodeMirror {
|
||||
getValue(seperator?: string): string;
|
||||
|
||||
/** Set the editor content. */
|
||||
setValue(content: string);
|
||||
setValue(content: string): void;
|
||||
|
||||
/** Get the text between the given points in the editor, which should be {line, ch} objects.
|
||||
An optional third argument can be given to indicate the line separator string to use (defaults to "\n"). */
|
||||
@@ -380,16 +380,16 @@ declare module CodeMirror {
|
||||
|
||||
/** Replace the part of the document between from and to with the given string.
|
||||
from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */
|
||||
replaceRange(replacement: string, from: CodeMirror.Position, to: CodeMirror.Position);
|
||||
replaceRange(replacement: string, from: CodeMirror.Position, to: CodeMirror.Position): void;
|
||||
|
||||
/** Get the content of line n. */
|
||||
getLine(n: number): string;
|
||||
|
||||
/** Set the content of line n. */
|
||||
setLine(n: number, text: string);
|
||||
setLine(n: number, text: string): void;
|
||||
|
||||
/** Remove the given line from the document. */
|
||||
removeLine(n: number);
|
||||
removeLine(n: number): void;
|
||||
|
||||
/** Get the number of lines in the editor. */
|
||||
lineCount(): number;
|
||||
@@ -410,16 +410,16 @@ declare module CodeMirror {
|
||||
/** Iterate over the whole document, and call f for each line, passing the line handle.
|
||||
This is a faster way to visit a range of line handlers than calling getLineHandle for each of them.
|
||||
Note that line handles have a text property containing the line's content (as a string). */
|
||||
eachLine(f: (line: CodeMirror.LineHandle) => void );
|
||||
eachLine(f: (line: CodeMirror.LineHandle) => void ): void;
|
||||
|
||||
/** Iterate over the range from start up to (not including) end, and call f for each line, passing the line handle.
|
||||
This is a faster way to visit a range of line handlers than calling getLineHandle for each of them.
|
||||
Note that line handles have a text property containing the line's content (as a string). */
|
||||
eachLine(start: number, end: number, f: (line: CodeMirror.LineHandle) => void );
|
||||
eachLine(start: number, end: number, f: (line: CodeMirror.LineHandle) => void ): void;
|
||||
|
||||
/** Set the editor content as 'clean', a flag that it will retain until it is edited, and which will be set again when such an edit is undone again.
|
||||
Useful to track whether the content needs to be saved. */
|
||||
markClean();
|
||||
markClean(): void;
|
||||
|
||||
/** Returns whether the document is currently clean (not modified since initialization or the last call to markClean). */
|
||||
isClean(): boolean;
|
||||
@@ -431,7 +431,7 @@ declare module CodeMirror {
|
||||
|
||||
/** Replace the selection with the given string. By default, the new selection will span the inserted text.
|
||||
The optional collapse argument can be used to change this � passing "start" or "end" will collapse the selection to the start or end of the inserted text. */
|
||||
replaceSelection(replacement: string, collapse?: string)
|
||||
replaceSelection(replacement: string, collapse?: string): void;
|
||||
|
||||
/** start is a an optional string indicating which end of the selection to return.
|
||||
It may be "start" , "end" , "head"(the side of the selection that moves when you press shift + arrow),
|
||||
@@ -442,20 +442,20 @@ declare module CodeMirror {
|
||||
somethingSelected(): boolean;
|
||||
|
||||
/** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */
|
||||
setCursor(pos: CodeMirror.Position);
|
||||
setCursor(pos: CodeMirror.Position): void;
|
||||
|
||||
/** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */
|
||||
setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position);
|
||||
setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void;
|
||||
|
||||
/** Similar to setSelection , but will, if shift is held or the extending flag is set,
|
||||
move the head of the selection while leaving the anchor at its current place.
|
||||
pos2 is optional , and can be passed to ensure a region (for example a word or paragraph) will end up selected
|
||||
(in addition to whatever lies between that region and the current anchor). */
|
||||
extendSelection(from: CodeMirror.Position, to?: CodeMirror.Position);
|
||||
extendSelection(from: CodeMirror.Position, to?: CodeMirror.Position): void;
|
||||
|
||||
/** Sets or clears the 'extending' flag , which acts similar to the shift key,
|
||||
in that it will cause cursor movement and calls to extendSelection to leave the selection anchor in place. */
|
||||
setExtending(value: boolean);
|
||||
setExtending(value: boolean): void;
|
||||
|
||||
|
||||
/** Retrieve the editor associated with a document. May return null. */
|
||||
@@ -481,30 +481,30 @@ declare module CodeMirror {
|
||||
|
||||
/** Break the link between two documents. After calling this , changes will no longer propagate between the documents,
|
||||
and, if they had a shared history, the history will become separate. */
|
||||
unlinkDoc(doc: CodeMirror.Doc);
|
||||
unlinkDoc(doc: CodeMirror.Doc): void;
|
||||
|
||||
/** Will call the given function for all documents linked to the target document. It will be passed two arguments,
|
||||
the linked document and a boolean indicating whether that document shares history with the target. */
|
||||
iterLinkedDocs(fn: (doc: CodeMirror.Doc, sharedHist: boolean) => void );
|
||||
iterLinkedDocs(fn: (doc: CodeMirror.Doc, sharedHist: boolean) => void ): void;
|
||||
|
||||
/** Undo one edit (if any undo events are stored). */
|
||||
undo();
|
||||
undo(): void;
|
||||
|
||||
/** Redo one undone edit. */
|
||||
redo();
|
||||
redo(): void;
|
||||
|
||||
/** Returns an object with {undo, redo } properties , both of which hold integers , indicating the amount of stored undo and redo operations. */
|
||||
historySize(): { undo: number; redo: number; };
|
||||
|
||||
/** Clears the editor's undo history. */
|
||||
clearHistory();
|
||||
clearHistory(): void;
|
||||
|
||||
/** Get a(JSON - serializeable) representation of the undo history. */
|
||||
getHistory(): any;
|
||||
|
||||
/** Replace the editor's undo history with the one provided, which must be a value as returned by getHistory.
|
||||
Note that this will have entirely undefined results if the editor content isn't also the same as it was when getHistory was called. */
|
||||
setHistory(history: any);
|
||||
setHistory(history: any): void;
|
||||
|
||||
|
||||
/** Can be used to mark a range of text with a specific CSS class name. from and to should be { line , ch } objects. */
|
||||
@@ -548,7 +548,7 @@ declare module CodeMirror {
|
||||
|
||||
interface TextMarker {
|
||||
/** Remove the mark. */
|
||||
clear();
|
||||
clear(): void;
|
||||
|
||||
/** Returns a {from, to} object (both holding document positions), indicating the current position of the marked range,
|
||||
or undefined if the marker is no longer in the document. */
|
||||
@@ -564,7 +564,7 @@ declare module CodeMirror {
|
||||
|
||||
/** Call this if you made some change to the widget's DOM node that might affect its height.
|
||||
It'll force CodeMirror to update the height of the line that contains the widget. */
|
||||
changed();
|
||||
changed(): void;
|
||||
}
|
||||
|
||||
interface EditorChange {
|
||||
@@ -585,9 +585,9 @@ declare module CodeMirror {
|
||||
|
||||
interface EditorChangeCancellable extends CodeMirror.EditorChange {
|
||||
/** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. */
|
||||
update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string);
|
||||
update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string): void;
|
||||
|
||||
cancel();
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
|
||||
+52
-47
@@ -1,20 +1,21 @@
|
||||
/// <reference path="ember.d.ts" />
|
||||
/// <reference path="../handlebars/handlebars.d.ts" />
|
||||
|
||||
|
||||
var App;
|
||||
|
||||
App = Em.Application.create();
|
||||
|
||||
App.president = Em.Object.create({
|
||||
name: "Barack Obama"
|
||||
name: 'Barack Obama'
|
||||
});
|
||||
App.country = Em.Object.create({
|
||||
presidentNameBinding: 'MyApp.president.name'
|
||||
});
|
||||
App.country.get('presidentName');
|
||||
App.president = Em.Object.create({
|
||||
firstName: "Barack",
|
||||
lastName: "Obama",
|
||||
firstName: 'Barack',
|
||||
lastName: 'Obama',
|
||||
fullName: function () {
|
||||
return this.get('firstName') + ' ' + this.get('lastName');
|
||||
}.property()
|
||||
@@ -24,47 +25,51 @@ App.president.get('fullName');
|
||||
declare class MyPerson extends Em.Object {
|
||||
static createMan(): MyPerson;
|
||||
}
|
||||
var Person = Em.Object.extend<typeof MyPerson>({
|
||||
|
||||
var Person1 = Em.Object.extend<typeof MyPerson>({
|
||||
say: (thing) => {
|
||||
alert(thing);
|
||||
}
|
||||
});
|
||||
|
||||
declare class MyPerson2 extends Em.Object {
|
||||
helloWorld(): void;
|
||||
}
|
||||
var tom = Person.create<MyPerson2>({
|
||||
name: "Tom Dale",
|
||||
helloWorld: () => {
|
||||
this.say("Hi my name is " + this.get('name'));
|
||||
var tom = Person1.create<MyPerson2>({
|
||||
name: 'Tom Dale',
|
||||
helloWorld: function() {
|
||||
this.say('Hi my name is ' + this.get('name'));
|
||||
}
|
||||
});
|
||||
tom.helloWorld();
|
||||
|
||||
Person.reopen({ isPerson: true });
|
||||
Person.create().get('isPerson');
|
||||
Person1.reopen({ isPerson: true });
|
||||
Person1.create<Em.Object>().get('isPerson');
|
||||
|
||||
Person.reopenClass({
|
||||
Person1.reopenClass({
|
||||
createMan: () => {
|
||||
return Person.create({ isMan: true })
|
||||
return Person1.create({ isMan: true });
|
||||
}
|
||||
});
|
||||
Person.createMan().get('isMan');
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
declare var Person1: typeof MyPerson;
|
||||
Person1.createMan().get('isMan');
|
||||
|
||||
var person = Person.create({
|
||||
firstName: "Yehuda",
|
||||
lastName: "Katz"
|
||||
var person = Person1.create<Em.Object>({
|
||||
firstName: 'Yehuda',
|
||||
lastName: 'Katz'
|
||||
});
|
||||
person.addObserver('fullName', () => { });
|
||||
person.set('firstName', "Brohuda");
|
||||
person.addObserver('fullName', null, () => { });
|
||||
person.set('firstName', 'Brohuda');
|
||||
|
||||
App.todosController = Em.Object.create({
|
||||
todos: [
|
||||
Em.Object.create({ isDone: false })
|
||||
],
|
||||
remaining: () => {
|
||||
remaining: (function() {
|
||||
var todos = this.get('todos');
|
||||
return todos.filterProperty('isDone', false).get('length');
|
||||
}.property('todos.@each.isDone')
|
||||
}).property('todos.@each.isDone')
|
||||
});
|
||||
|
||||
var todos = App.todosController.get('todos');
|
||||
@@ -86,29 +91,29 @@ App.husband.set('householdIncome', 90000);
|
||||
App.wife.get('householdIncome');
|
||||
|
||||
App.user = Em.Object.create({
|
||||
fullName: "Kara Gates"
|
||||
fullName: 'Kara Gates'
|
||||
});
|
||||
App.userView = Em.View.create({
|
||||
userNameBinding: Em.Binding.oneWay('App.user.fullName')
|
||||
});
|
||||
App.user.set('fullName', "Krang Gates");
|
||||
App.userView.set('userName', "Truckasaurus Gates");
|
||||
App.user.set('fullName', 'Krang Gates');
|
||||
App.userView.set('userName', 'Truckasaurus Gates');
|
||||
App.user.get('fullName');
|
||||
|
||||
App = Em.Application.create({
|
||||
rootElement: '#sidebar'
|
||||
});
|
||||
|
||||
var view = Em.View.create({
|
||||
var view = Em.View.create<Em.View>({
|
||||
templateName: 'say-hello',
|
||||
name: "Bob"
|
||||
name: 'Bob'
|
||||
});
|
||||
view.appendTo('#container');
|
||||
view.append();
|
||||
view.remove();
|
||||
|
||||
App.AlertView = Em.View.extend({
|
||||
priority: "p4",
|
||||
priority: 'p4',
|
||||
isUrgent: true
|
||||
});
|
||||
|
||||
@@ -121,21 +126,21 @@ App.ListingView = Em.View.extend({
|
||||
|
||||
App.userController = Em.Object.create({
|
||||
content: Em.Object.create({
|
||||
firstName: "Albert",
|
||||
lastName: "Hofmann",
|
||||
firstName: 'Albert',
|
||||
lastName: 'Hofmann',
|
||||
posts: 25,
|
||||
hobbies: "Riding bicycles"
|
||||
hobbies: 'Riding bicycles'
|
||||
})
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('highlight', (property, options) => {
|
||||
Handlebars.registerHelper('highlight', function(property, options) {
|
||||
var value = Em.Handlebars.get(this, property, options);
|
||||
return new Handlebars.SafeString('<span class="highlight">' + value + '</span>');
|
||||
});
|
||||
|
||||
App.MyText = Em.TextField.extend({
|
||||
formBlurredBinding: 'App.adminController.formBlurred',
|
||||
change: (evt) => {
|
||||
change: function() {
|
||||
this.set('formBlurred', true);
|
||||
}
|
||||
});
|
||||
@@ -145,26 +150,26 @@ var textArea = Em.TextArea.create({
|
||||
});
|
||||
|
||||
App.ClickableView = Em.View.extend({
|
||||
click: (evt) => {
|
||||
alert("ClickableView was clicked!");
|
||||
click: () => {
|
||||
alert('ClickableView was clicked!');
|
||||
}
|
||||
});
|
||||
|
||||
var container = Em.ContainerView.create();
|
||||
var container = Em.ContainerView.create<Em.ContainerView>();
|
||||
container.append();
|
||||
var coolView = App.CoolView.create(),
|
||||
childViews = container.get('childViews');
|
||||
childViews.pushObject(coolView);
|
||||
|
||||
Person = Em.Object.extend({
|
||||
sayHello: () => {
|
||||
console.log("Hello from " + this.get('name'));
|
||||
var Person2 = Em.Object.extend<typeof Em.Object>({
|
||||
sayHello: function() {
|
||||
console.log('Hello from ' + this.get('name'));
|
||||
}
|
||||
});
|
||||
var people = [
|
||||
Person.create({ name: "Juan" }),
|
||||
Person.create({ name: "Charles" }),
|
||||
Person.create({ name: "Majd" })
|
||||
Person2.create({ name: 'Juan' }),
|
||||
Person2.create({ name: 'Charles' }),
|
||||
Person2.create({ name: 'Majd' })
|
||||
];
|
||||
people.invoke('sayHello');
|
||||
|
||||
@@ -172,19 +177,19 @@ var arr = [Em.Object.create(), Em.Object.create()];
|
||||
arr.setEach('name', 'unknown');
|
||||
arr.getEach('name');
|
||||
|
||||
Person = Em.Object.extend({
|
||||
var Person3 = Em.Object.extend<typeof Em.Object>({
|
||||
name: null,
|
||||
isHappy: false
|
||||
});
|
||||
var people2 = [
|
||||
Person.create({ name: 'Yehuda', isHappy: true }),
|
||||
Person.create({ name: 'Majd', isHappy: false })
|
||||
Person3.create({ name: 'Yehuda', isHappy: true }),
|
||||
Person3.create({ name: 'Majd', isHappy: false })
|
||||
];
|
||||
people2.every((person, index, self) => {
|
||||
if (person.get('isHappy')) { return true; }
|
||||
people2.every((person: Em.Object) => {
|
||||
return !!person.get('isHappy');
|
||||
});
|
||||
people2.some((person, index, self) => {
|
||||
if (person.get('isHappy')) { return true; }
|
||||
people2.some((person: Em.Object) => {
|
||||
return !!person.get('isHappy');
|
||||
});
|
||||
people2.everyProperty('isHappy', true);
|
||||
people2.someProperty('isHappy', true);
|
||||
|
||||
Vendored
+151
-771
File diff suppressed because it is too large
Load Diff
+131
-132
@@ -20,7 +20,7 @@ app.use(express.session());
|
||||
|
||||
// Session-persisted message middleware
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response, next) => {
|
||||
var err = req.session.error
|
||||
, msg = req.session.success;
|
||||
delete req.session.error;
|
||||
@@ -40,7 +40,7 @@ var users = <any>{
|
||||
// when you create a user, generate a salt
|
||||
// and hash the password ('foobar' is the pass here)
|
||||
|
||||
hash('foobar', function (err, salt, hash) {
|
||||
hash('foobar', (err, salt, hash) => {
|
||||
if (err) throw err;
|
||||
// store the salt & hash in the "db"
|
||||
users.tj.salt = salt;
|
||||
@@ -58,11 +58,11 @@ function authenticate(name, pass, fn) {
|
||||
// apply the same algorithm to the POSTed password, applying
|
||||
// the hash against the pass / salt, if there is a match we
|
||||
// found the user
|
||||
hash(pass, user.salt, function (err, hash) {
|
||||
hash(pass, user.salt, (err, hash) => {
|
||||
if (err) return fn(err);
|
||||
if (hash == user.hash) return fn(null, user);
|
||||
fn(new Error('invalid password'));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function restrict(req: express.Request, res: express.Response, next?: Function) {
|
||||
@@ -74,32 +74,32 @@ function restrict(req: express.Request, res: express.Response, next?: Function)
|
||||
}
|
||||
}
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.redirect('login');
|
||||
});
|
||||
|
||||
app.get('/restricted', restrict, function (req, res) {
|
||||
app.get('/restricted', restrict, (req: express.Request, res: express.Response) => {
|
||||
res.send('Wahoo! restricted area, click to <a href="/logout">logout</a>');
|
||||
});
|
||||
|
||||
app.get('/logout', function (req, res) {
|
||||
app.get('/logout', (req: express.Request, res: express.Response) => {
|
||||
// destroy the user's session to log them out
|
||||
// will be re-created next request
|
||||
req.session.destroy(function () {
|
||||
req.session.destroy(() => {
|
||||
res.redirect('/');
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/login', function (req, res) {
|
||||
app.get('/login', (req: express.Request, res: express.Response) => {
|
||||
res.render('login');
|
||||
});
|
||||
|
||||
app.post('/login', function (req, res) {
|
||||
authenticate(req.body.username, req.body.password, function (err, user) {
|
||||
app.post('/login', (req: express.Request, res: express.Response) => {
|
||||
authenticate(req.body.username, req.body.password, (err, user) => {
|
||||
if (user) {
|
||||
// Regenerate session when signing in
|
||||
// to prevent fixation
|
||||
req.session.regenerate(function () {
|
||||
req.session.regenerate(() => {
|
||||
// Store the user's primary key
|
||||
// in the session store to be retrieved,
|
||||
// or in this case the entire user object
|
||||
@@ -139,7 +139,7 @@ while (n--) {
|
||||
|
||||
app.use(express.logger('dev'));
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.render('pets', { pets: pets });
|
||||
});
|
||||
|
||||
@@ -148,24 +148,24 @@ console.log('Express listening on port 3000');
|
||||
|
||||
/////////////
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.format({
|
||||
html: function () {
|
||||
res.send('<ul>' + users.map(function (user) {
|
||||
html: () => {
|
||||
res.send('<ul>' + users.map(user => {
|
||||
return '<li>' + user.name + '</li>';
|
||||
}).join('') + '</ul>');
|
||||
},
|
||||
|
||||
text: function () {
|
||||
res.send(users.map(function (user) {
|
||||
text: () => {
|
||||
res.send(users.map(user => {
|
||||
return ' - ' + user.name + '\n';
|
||||
}).join(''));
|
||||
},
|
||||
|
||||
json: function () {
|
||||
json: () => {
|
||||
res.json(users);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
// or you could write a tiny middleware like
|
||||
@@ -173,9 +173,9 @@ app.get('/', function (req, res) {
|
||||
|
||||
function format(mod) {
|
||||
var obj = require(mod);
|
||||
return function (req, res) {
|
||||
return (req: express.Request, res: express.Response) => {
|
||||
res.format(obj);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
app.get('/users', format('./users'));
|
||||
@@ -207,7 +207,7 @@ app.use(express.cookieParser('my secret here'));
|
||||
// parses json, x-www-form-urlencoded, and multipart/form-data
|
||||
app.use(express.bodyParser());
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
if (req.cookies.remember) {
|
||||
res.send('Remembered :). Click to <a href="/forget">forget</a>!.');
|
||||
} else {
|
||||
@@ -217,12 +217,12 @@ app.get('/', function (req, res) {
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/forget', function (req, res) {
|
||||
app.get('/forget', (req: express.Request, res: express.Response) => {
|
||||
res.clearCookie('remember');
|
||||
res.redirect('back');
|
||||
});
|
||||
|
||||
app.post('/', function (req, res) {
|
||||
app.post('/', (req: express.Request, res: express.Response) => {
|
||||
var minute = 60000;
|
||||
if (req.body.remember) res.cookie('remember', 1, { maxAge: minute });
|
||||
res.redirect('back');
|
||||
@@ -248,7 +248,7 @@ app.use(express.cookieSession());
|
||||
app.use(count);
|
||||
|
||||
// custom middleware
|
||||
function count(req, res) {
|
||||
function count(req: express.Request, res: express.Response) {
|
||||
req.session.count = req.session.count || 0;
|
||||
var n = req.session.count++;
|
||||
res.send('viewed ' + n + ' times\n');
|
||||
@@ -274,7 +274,7 @@ api.use(express.bodyParser());
|
||||
* CORS support.
|
||||
*/
|
||||
|
||||
api.all('*', function (req, res, next) {
|
||||
api.all('*', (req: express.Request, res: express.Response, next) => {
|
||||
if (!req.get('Origin')) return next();
|
||||
// use "*" here to accept any origin
|
||||
res.set('Access-Control-Allow-Origin', 'http://localhost:3000');
|
||||
@@ -289,7 +289,7 @@ api.all('*', function (req, res, next) {
|
||||
* POST a user.
|
||||
*/
|
||||
|
||||
api.post('/user', function (req, res) {
|
||||
api.post('/user', (req: express.Request, res: express.Response) => {
|
||||
console.log(req.body);
|
||||
res.send(201);
|
||||
});
|
||||
@@ -302,7 +302,7 @@ console.log('api listening on 3001');
|
||||
|
||||
////////////////////
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send('<ul>'
|
||||
+ '<li>Download <a href="/files/amazing.txt">amazing.txt</a>.</li>'
|
||||
+ '<li>Download <a href="/files/missing.txt">missing.txt</a>.</li>'
|
||||
@@ -311,7 +311,7 @@ app.get('/', function (req, res) {
|
||||
|
||||
// /files/* is accessed via req.params[0]
|
||||
// but here we name it :file
|
||||
app.get('/files/:file(*)', function (req, res, next?) {
|
||||
app.get('/files/:file(*)', (req: express.Request, res: express.Response) => {
|
||||
var file = req.params.file
|
||||
, path = __dirname + '/files/' + file;
|
||||
|
||||
@@ -322,7 +322,7 @@ app.get('/files/:file(*)', function (req, res, next?) {
|
||||
// below our routes, you will be able to
|
||||
// "intercept" errors, otherwise Connect
|
||||
// will respond with 500 "Internal Server Error".
|
||||
app.use(function (err, req, res, next) {
|
||||
app.use((err, req, res: express.Response, next) => {
|
||||
// special-case 404s,
|
||||
// remember you could
|
||||
// render a 404 template here
|
||||
@@ -363,7 +363,7 @@ app.set('views', __dirname + '/views');
|
||||
// ex: res.render('users.html').
|
||||
app.set('view engine', 'html');
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.render('users', {
|
||||
users: users,
|
||||
title: "EJS example",
|
||||
@@ -390,12 +390,12 @@ app.use(app.router);
|
||||
app.use(error);
|
||||
|
||||
// error handling middleware have an arity of 4
|
||||
// instead of the typical (req, res, next),
|
||||
// instead of the typical (req: express.Request, res: express.Response, next),
|
||||
// otherwise they behave exactly like regular
|
||||
// middleware, you may have several of them,
|
||||
// in different orders etc.
|
||||
|
||||
function error(err, req, res, next) {
|
||||
function error(err, req, res: express.Response, next) {
|
||||
// log it
|
||||
if (!test) console.error(err.stack);
|
||||
|
||||
@@ -403,14 +403,14 @@ function error(err, req, res, next) {
|
||||
res.send(500);
|
||||
}
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', () => {
|
||||
// Caught and passed down to the errorHandler middleware
|
||||
throw new Error('something broke!');
|
||||
});
|
||||
|
||||
app.get('/next', function (req, res, next) {
|
||||
app.get('/next', (req: express.Request, res: express.Response, next) => {
|
||||
// We can also pass exceptions to next()
|
||||
process.nextTick(function () {
|
||||
process.nextTick(() => {
|
||||
next(new Error('oh no!'));
|
||||
});
|
||||
});
|
||||
@@ -460,7 +460,7 @@ app.use(app.router);
|
||||
// $ curl http://localhost:3000/notfound -H "Accept: application/json"
|
||||
// $ curl http://localhost:3000/notfound -H "Accept: text/plain"
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response) => {
|
||||
res.status(404);
|
||||
|
||||
// respond with html page
|
||||
@@ -481,7 +481,7 @@ app.use(function (req, res, next) {
|
||||
|
||||
// error-handling middleware, take the same form
|
||||
// as regular middleware, however they require an
|
||||
// arity of 4, aka the signature (err, req, res, next).
|
||||
// arity of 4, aka the signature (err, req, res: express.Response, next).
|
||||
// when connect has an error, it will invoke ONLY error-handling
|
||||
// middleware.
|
||||
|
||||
@@ -491,7 +491,7 @@ app.use(function (req, res, next) {
|
||||
// would remain being executed, however here
|
||||
// we simply respond with an error page.
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
app.use((err, req, res: express.Response) => {
|
||||
// we may use properties of the error object
|
||||
// here and next(err) appropriately, or if
|
||||
// we possibly recovered from the error, simply next().
|
||||
@@ -501,25 +501,25 @@ app.use(function (err, req, res, next) {
|
||||
|
||||
// Routes
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.render('index.jade');
|
||||
});
|
||||
|
||||
app.get('/404', function (req, res, next) {
|
||||
app.get('/404', (req: express.Request, res: express.Response, next) => {
|
||||
// trigger a 404 since no other middleware
|
||||
// will match /404 after this one, and we're not
|
||||
// responding here
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/403', function (req, res, next) {
|
||||
app.get('/403', (req: express.Request, res: express.Response, next) => {
|
||||
// trigger a 403 error
|
||||
var err = <any>new Error('not allowed!');
|
||||
err.status = 403;
|
||||
next(err);
|
||||
});
|
||||
|
||||
app.get('/500', function (req, res, next) {
|
||||
app.get('/500', (req: express.Request, res: express.Response, next) => {
|
||||
// trigger a generic (500) error
|
||||
next(new Error('keyboard cat!'));
|
||||
});
|
||||
@@ -552,7 +552,7 @@ User.prototype.toJSON = function () {
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.name
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
app.use(express.logger('dev'));
|
||||
@@ -563,7 +563,7 @@ app.use(express.logger('dev'));
|
||||
// to the templates, so "expose" will
|
||||
// be present.
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response, next) => {
|
||||
res.locals.expose = {};
|
||||
// you could alias this as req or res.expose
|
||||
// to make it shorter and less annoying
|
||||
@@ -572,16 +572,16 @@ app.use(function (req, res, next) {
|
||||
|
||||
// pretend we loaded a user
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response, next) => {
|
||||
req.user = new User('Tobi');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.redirect('/user');
|
||||
});
|
||||
|
||||
app.get('/user', function (req, res) {
|
||||
app.get('/user', (req: express.Request, res: express.Response) => {
|
||||
// we only want to expose the user
|
||||
// to the client for this route:
|
||||
res.locals.expose.user = req.user;
|
||||
@@ -593,7 +593,7 @@ console.log('app listening on port 3000');
|
||||
|
||||
///////////////////////
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send('Hello World');
|
||||
});
|
||||
|
||||
@@ -604,33 +604,33 @@ console.log('Express started on port 3000');
|
||||
|
||||
// register .md as an engine in express view system
|
||||
|
||||
app.engine('md', function (path, options, fn) {
|
||||
fs.readFile(path, 'utf8', function (err, str) {
|
||||
app.engine('md', (path, options, fn) => {
|
||||
fs.readFile(path, 'utf8', (err, str) => {
|
||||
if (err) return fn(err);
|
||||
try {
|
||||
var html = md(str);
|
||||
html = html.replace(/\{([^}]+)\}/g, function (_, name) {
|
||||
html = html.replace(/\{([^}]+)\}/g, (_, name) => {
|
||||
return options[name] || '';
|
||||
})
|
||||
});
|
||||
fn(null, html);
|
||||
} catch (err) {
|
||||
fn(err);
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
app.set('views', __dirname + '/views');
|
||||
|
||||
// make it the default so we dont need .md
|
||||
app.set('view engine', 'md');
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.render('index', { title: 'Markdown Example' });
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/fail', function (req, res) {
|
||||
app.get('/fail', (req: express.Request, res: express.Response) => {
|
||||
res.render('missing', { title: 'Markdown Example' });
|
||||
})
|
||||
});
|
||||
|
||||
if (!module.parent) {
|
||||
app.listen(3000);
|
||||
@@ -643,9 +643,9 @@ var mformat: any;
|
||||
|
||||
// bodyParser in connect 2.x uses node-formidable to parse
|
||||
// the multipart form data.
|
||||
app.use(express.bodyParser())
|
||||
app.use(express.bodyParser());
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send('<form method="post" enctype="multipart/form-data">'
|
||||
+ '<p>Title: <input type="text" name="title" /></p>'
|
||||
+ '<p>Image: <input type="file" name="image" /></p>'
|
||||
@@ -653,7 +653,7 @@ app.get('/', function (req, res) {
|
||||
+ '</form>');
|
||||
});
|
||||
|
||||
app.post('/', function (req, res, next) {
|
||||
app.post('/', (req: express.Request, res: express.Response) => {
|
||||
// the uploaded file can be found as `req.files.image` and the
|
||||
// title field as `req.body.title`
|
||||
res.send(mformat('\nuploaded %s (%d Kb) to %s as %s'
|
||||
@@ -680,7 +680,6 @@ if (!module.parent) {
|
||||
*/
|
||||
|
||||
var online: any;
|
||||
var redis: any;
|
||||
var db: any;
|
||||
|
||||
// online
|
||||
@@ -690,7 +689,7 @@ online = online(db);
|
||||
// activity tracking, in this case using
|
||||
// the UA string, you would use req.user.id etc
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response, next) => {
|
||||
// fire-and-forget
|
||||
online.add(req.headers['user-agent']);
|
||||
next();
|
||||
@@ -701,7 +700,7 @@ app.use(function (req, res, next) {
|
||||
*/
|
||||
|
||||
function list(ids) {
|
||||
return '<ul>' + ids.map(function (id) {
|
||||
return '<ul>' + ids.map(id => {
|
||||
return '<li>' + id + '</li>';
|
||||
}).join('') + '</ul>';
|
||||
}
|
||||
@@ -710,8 +709,8 @@ function list(ids) {
|
||||
* GET users online.
|
||||
*/
|
||||
|
||||
app.get('/', function (req, res, next) {
|
||||
online.last(5, function (err, ids) {
|
||||
app.get('/', (req: express.Request, res: express.Response, next) => {
|
||||
online.last(5, (err, ids) => {
|
||||
if (err) return next(err);
|
||||
res.send('<p>Users online: ' + ids.length + '</p>' + list(ids));
|
||||
});
|
||||
@@ -724,7 +723,7 @@ console.log('listening on port 3000');
|
||||
|
||||
// Convert :to and :from to integers
|
||||
|
||||
app.param(['to', 'from'], function (req, res, next, num, name) {
|
||||
app.param(['to', 'from'], (req: express.Request, res: express.Response, next, num, name) => {
|
||||
req.params[name] = num = parseInt(num, 10);
|
||||
if (isNaN(num)) {
|
||||
next(new Error('failed to parseInt ' + num));
|
||||
@@ -735,7 +734,7 @@ app.param(['to', 'from'], function (req, res, next, num, name) {
|
||||
|
||||
// Load user by id
|
||||
|
||||
app.param('user', function (req, res, next, id) {
|
||||
app.param('user', (req: express.Request, res: express.Response, next, id) => {
|
||||
if (req.user = users[id]) {
|
||||
next();
|
||||
} else {
|
||||
@@ -747,7 +746,7 @@ app.param('user', function (req, res, next, id) {
|
||||
* GET index.
|
||||
*/
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send('Visit /user/0 or /users/0-2');
|
||||
});
|
||||
|
||||
@@ -755,7 +754,7 @@ app.get('/', function (req, res) {
|
||||
* GET :user.
|
||||
*/
|
||||
|
||||
app.get('/user/:user', function (req, res, next) {
|
||||
app.get('/user/:user', (req: express.Request, res: express.Response) => {
|
||||
res.send('user ' + req.user.name);
|
||||
});
|
||||
|
||||
@@ -763,10 +762,10 @@ app.get('/user/:user', function (req, res, next) {
|
||||
* GET users :from - :to.
|
||||
*/
|
||||
|
||||
app.get('/users/:from-:to', function (req, res, next) {
|
||||
app.get('/users/:from-:to', (req: express.Request, res: express.Response) => {
|
||||
var from = req.params.from
|
||||
, to = req.params.to
|
||||
, names = users.map(function (user) { return user.name; });
|
||||
, names = users.map(user => { return user.name; });
|
||||
res.send('users ' + names.slice(from, to).join(', '));
|
||||
});
|
||||
|
||||
@@ -781,7 +780,7 @@ if (!module.parent) {
|
||||
|
||||
app.resource = function (path, obj) {
|
||||
this.get(path, obj.index);
|
||||
this.get(path + '/:a..:b.:format?', function (req, res) {
|
||||
this.get(path + '/:a..:b.:format?', (req: express.Request, res: express.Response) => {
|
||||
var a = parseInt(req.params.a, 10)
|
||||
, b = parseInt(req.params.b, 10)
|
||||
, format = req.params.format;
|
||||
@@ -794,19 +793,19 @@ app.resource = function (path, obj) {
|
||||
// Fake controller.
|
||||
|
||||
var FUser = {
|
||||
index: function (req, res) {
|
||||
index: (req: express.Request, res: express.Response) => {
|
||||
res.send(users);
|
||||
},
|
||||
show: function (req, res) {
|
||||
show: (req: express.Request, res: express.Response) => {
|
||||
res.send(users[req.params.id] || { error: 'Cannot find user' });
|
||||
},
|
||||
destroy: function (req, res) {
|
||||
destroy: (req: express.Request, res: express.Response) => {
|
||||
var id = req.params.id;
|
||||
var destroyed = id in users;
|
||||
delete users[id];
|
||||
res.send(destroyed ? 'destroyed' : 'Cannot find user');
|
||||
},
|
||||
range: function (req, res, a, b, format) {
|
||||
range: (req: express.Request, res: express.Response, a, b, format) => {
|
||||
var range = users.slice(a, b + 1);
|
||||
switch (format) {
|
||||
case 'json':
|
||||
@@ -814,7 +813,7 @@ var FUser = {
|
||||
break;
|
||||
case 'html':
|
||||
default:
|
||||
var html = '<ul>' + range.map(function (user) {
|
||||
var html = '<ul>' + range.map(user => {
|
||||
return '<li>' + user.name + '</li>';
|
||||
}).join('\n') + '</ul>';
|
||||
res.send(html);
|
||||
@@ -831,7 +830,7 @@ var FUser = {
|
||||
|
||||
app.resource('/users', FUser);
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send([
|
||||
'<h1>Examples:</h1> <ul>'
|
||||
, '<li>GET /users</li>'
|
||||
@@ -854,7 +853,7 @@ if (!module.parent) {
|
||||
|
||||
var verbose: any;
|
||||
|
||||
app.map = function (a, route) {
|
||||
app.map = (a, route) => {
|
||||
route = route || '';
|
||||
for (var key in a) {
|
||||
switch (typeof a[key]) {
|
||||
@@ -872,25 +871,25 @@ app.map = function (a, route) {
|
||||
};
|
||||
|
||||
var users2 = {
|
||||
list: function (req, res) {
|
||||
list: (req: express.Request, res: express.Response) => {
|
||||
res.send('user list');
|
||||
},
|
||||
|
||||
get: function (req, res) {
|
||||
get: (req: express.Request, res: express.Response) => {
|
||||
res.send('user ' + req.params.uid);
|
||||
},
|
||||
|
||||
del: function (req, res) {
|
||||
del: (req: express.Request, res: express.Response) => {
|
||||
res.send('delete users');
|
||||
}
|
||||
};
|
||||
|
||||
var pets2 = {
|
||||
list: function (req, res) {
|
||||
list: (req: express.Request, res: express.Response) => {
|
||||
res.send('user ' + req.params.uid + '\'s pets');
|
||||
},
|
||||
|
||||
del: function (req, res) {
|
||||
del: (req: express.Request, res: express.Response) => {
|
||||
res.send('delete ' + req.params.uid + '\'s pet ' + req.params.pid);
|
||||
}
|
||||
};
|
||||
@@ -922,7 +921,7 @@ app.listen(3000);
|
||||
// curl http://localhost:3000/user/1/edit (unauthorized since this is not you)
|
||||
// curl -X DELETE http://localhost:3000/user/0 (unauthorized since you are not an admin)
|
||||
|
||||
function loadUser(req, res, next) {
|
||||
function loadUser(req: express.Request, res: express.Response, next) {
|
||||
// You would fetch your user from the db
|
||||
var user = users[req.params.id];
|
||||
if (user) {
|
||||
@@ -933,7 +932,7 @@ function loadUser(req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
function andRestrictToSelf(req, res, next) {
|
||||
function andRestrictToSelf(req: express.Request, res: express.Response, next) {
|
||||
// If our authenticated user is the user we are viewing
|
||||
// then everything is fine :)
|
||||
if (req.authenticatedUser.id == req.user.id) {
|
||||
@@ -948,13 +947,13 @@ function andRestrictToSelf(req, res, next) {
|
||||
}
|
||||
|
||||
function andRestrictTo(role) {
|
||||
return function (req, res, next) {
|
||||
return (req: express.Request, res: express.Response, next) => {
|
||||
if (req.authenticatedUser.role == role) {
|
||||
next();
|
||||
} else {
|
||||
next(new Error('Unauthorized'));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Middleware for faux authentication
|
||||
@@ -962,24 +961,24 @@ function andRestrictTo(role) {
|
||||
// but this illustrates how an authenticated user
|
||||
// may interact with middleware
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response, next) => {
|
||||
req.authenticatedUser = users[0];
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.redirect('/user/0');
|
||||
});
|
||||
|
||||
app.get('/user/:id', loadUser, function (req, res) {
|
||||
app.get('/user/:id', loadUser, (req: express.Request, res: express.Response) => {
|
||||
res.send('Viewing user ' + req.user.name);
|
||||
});
|
||||
|
||||
app.get('/user/:id/edit', loadUser, andRestrictToSelf, function (req, res) {
|
||||
app.get('/user/:id/edit', loadUser, andRestrictToSelf, (req: express.Request, res: express.Response) => {
|
||||
res.send('Editing user ' + req.user.name);
|
||||
});
|
||||
|
||||
app.del('/user/:id', loadUser, andRestrictTo('admin'), function (req, res) {
|
||||
app.del('/user/:id', loadUser, andRestrictTo('admin'), (req: express.Request, res: express.Response) => {
|
||||
res.send('Deleted user ' + req.user.name);
|
||||
});
|
||||
|
||||
@@ -1003,7 +1002,7 @@ db.sadd('cat', 'luna');
|
||||
* GET the search page.
|
||||
*/
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.render('search');
|
||||
});
|
||||
|
||||
@@ -1011,9 +1010,9 @@ app.get('/', function (req, res) {
|
||||
* GET search for :query.
|
||||
*/
|
||||
|
||||
app.get('/search/:query?', function (req, res) {
|
||||
app.get('/search/:query?', (req: express.Request, res: express.Response) => {
|
||||
var query = req.params.query;
|
||||
db.smembers(query, function (err, vals) {
|
||||
db.smembers(query, (err, vals) => {
|
||||
if (err) return res.send(500);
|
||||
res.send(vals);
|
||||
});
|
||||
@@ -1026,7 +1025,7 @@ app.get('/search/:query?', function (req, res) {
|
||||
* template.
|
||||
*/
|
||||
|
||||
app.get('/client.js', function (req, res) {
|
||||
app.get('/client.js', (req: express.Request, res: express.Response) => {
|
||||
res.sendfile(__dirname + '/client.js');
|
||||
});
|
||||
|
||||
@@ -1045,7 +1044,7 @@ app.use(express.cookieParser('keyboard cat'));
|
||||
// Populates req.session
|
||||
app.use(express.session());
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
var body = '';
|
||||
if (req.session.views) {
|
||||
++req.session.views;
|
||||
@@ -1118,11 +1117,11 @@ var main = express();
|
||||
|
||||
main.use(express.logger('dev'));
|
||||
|
||||
main.get('/', function (req, res) {
|
||||
res.send('Hello from main app!')
|
||||
main.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send('Hello from main app!');
|
||||
});
|
||||
|
||||
main.get('/:sub', function (req, res) {
|
||||
main.get('/:sub', (req: express.Request, res: express.Response) => {
|
||||
res.send('requsted ' + req.params.sub);
|
||||
});
|
||||
|
||||
@@ -1130,12 +1129,12 @@ main.get('/:sub', function (req, res) {
|
||||
|
||||
var redirect = express();
|
||||
|
||||
redirect.all('*', function (req, res) {
|
||||
redirect.all('*', (req: express.Request, res: express.Response) => {
|
||||
console.log(req.subdomains);
|
||||
res.redirect('http://example.com:3000/' + req.subdomains[0]);
|
||||
});
|
||||
|
||||
app.use(express.vhost('*.example.com', redirect))
|
||||
app.use(express.vhost('*.example.com', redirect));
|
||||
app.use(express.vhost('example.com', main));
|
||||
|
||||
app.listen(3000);
|
||||
@@ -1162,7 +1161,7 @@ function merror(status, msg) {
|
||||
// meaning only paths prefixed with "/api"
|
||||
// will cause this middleware to be invoked
|
||||
|
||||
app.use('/api', function (req, res, next) {
|
||||
app.use('/api', (req, res: express.Response, next) => {
|
||||
var key = req.query['api-key'];
|
||||
|
||||
// key isnt present
|
||||
@@ -1186,7 +1185,7 @@ app.use(app.router);
|
||||
// it will be passed through the defined middleware
|
||||
// in order, but ONLY those with an arity of 4, ignoring
|
||||
// regular middleware.
|
||||
app.use(function (err, req, res, next) {
|
||||
app.use((err, req, res: express.Response) => {
|
||||
// whatever you want here, feel free to populate
|
||||
// properties on `err` to treat it differently in here.
|
||||
res.send(err.status || 500, { error: err.message });
|
||||
@@ -1195,7 +1194,7 @@ app.use(function (err, req, res, next) {
|
||||
// our custom JSON 404 middleware. Since it's placed last
|
||||
// it will be the last middleware called, if all others
|
||||
// invoke next() and do not respond.
|
||||
app.use(function (req, res) {
|
||||
app.use((req: express.Request, res: express.Response) => {
|
||||
res.send(404, { error: "Lame, can't find that" });
|
||||
});
|
||||
|
||||
@@ -1223,15 +1222,15 @@ var userRepos = {
|
||||
// we now can assume the api key is valid,
|
||||
// and simply expose the data
|
||||
|
||||
app.get('/api/users', function (req, res, next) {
|
||||
app.get('/api/users', (req: express.Request, res: express.Response) => {
|
||||
res.send(users);
|
||||
});
|
||||
|
||||
app.get('/api/repos', function (req, res, next) {
|
||||
app.get('/api/repos', (req: express.Request, res: express.Response) => {
|
||||
res.send(repos);
|
||||
});
|
||||
|
||||
app.get('/api/user/:name/repos', function (req, res, next) {
|
||||
app.get('/api/user/:name/repos', (req: express.Request, res: express.Response, next) => {
|
||||
var name = req.params.name
|
||||
, user = userRepos[name];
|
||||
|
||||
@@ -1258,19 +1257,19 @@ router.get('/', function (req, resp, next?) {
|
||||
|
||||
function test_general() {
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
app.use((err, req, res: express.Response) => {
|
||||
console.error(err.stack);
|
||||
res.send(500, 'Something broke!');
|
||||
});
|
||||
app.use(express.bodyParser());
|
||||
app.use(express.methodOverride());
|
||||
app.use(app.router);
|
||||
app.use(function (err, req, res, next) { });
|
||||
app.use(() => {});
|
||||
app.use(express.bodyParser());
|
||||
app.use(express.methodOverride());
|
||||
app.use(app.router);
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
app.get('/', (req: express.Request, res: express.Response) => {
|
||||
res.send('hello world');
|
||||
});
|
||||
|
||||
@@ -1295,18 +1294,18 @@ function test_general() {
|
||||
app.set('db uri', 'localhost/dev');
|
||||
});
|
||||
|
||||
app.configure('stage', 'production', function () { });
|
||||
app.configure('stage', 'production', () => {});
|
||||
|
||||
app.configure('1', '2', '3', function () { });
|
||||
app.configure('1', '2', '3', () => {});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response) => {
|
||||
res.send('Hello World');
|
||||
});
|
||||
|
||||
app.engine('jade', require('jade').__express);
|
||||
|
||||
var User;
|
||||
app.param('user', (req, res, next, id) => {
|
||||
app.param('user', (req: express.Request, res: express.Response, next, id) => {
|
||||
User.find(id, (err, user) =>{
|
||||
if (err) {
|
||||
next(err);
|
||||
@@ -1319,7 +1318,7 @@ function test_general() {
|
||||
});
|
||||
});
|
||||
|
||||
app.get(/^\/commits\/(\d+)(?:\.\.(\d+))?$/, (req, res) => {
|
||||
app.get(/^\/commits\/(\d+)(?:\.\.(\d+))?$/, (req: express.Request, res: express.Response) => {
|
||||
var from = req.params[0];
|
||||
var to = req.params[1] || 'HEAD';
|
||||
res.send('commit range ' + from + '..' + to);
|
||||
@@ -1329,7 +1328,7 @@ function test_general() {
|
||||
app.locals.strftime = require('strftime');
|
||||
|
||||
var requireAuthentication;
|
||||
var loadUser = function () { };
|
||||
var loadUser = () => {};
|
||||
app.all('*', requireAuthentication, loadUser);
|
||||
app.all('*', loadUser);
|
||||
app.all('*', loadUser, loadUser, loadUser);
|
||||
@@ -1341,9 +1340,9 @@ function test_general() {
|
||||
phone: '1-250-858-9990',
|
||||
email: 'me@myapp.com'
|
||||
});
|
||||
app.render('email', function (err, html) { });
|
||||
app.render('email', () => {});
|
||||
|
||||
app.render('email', { name: 'Tobi' }, function (err, html) { });
|
||||
app.render('email', { name: 'Tobi' }, () => {});
|
||||
}
|
||||
|
||||
function test_request() {
|
||||
@@ -1423,24 +1422,24 @@ function test_response() {
|
||||
res.type('application/json');
|
||||
|
||||
res.format({
|
||||
'text/plain': function () {
|
||||
'text/plain': () => {
|
||||
res.send('hey');
|
||||
},
|
||||
'text/html': function () {
|
||||
'text/html': () => {
|
||||
res.send('hey');
|
||||
},
|
||||
'application/json': function () {
|
||||
'application/json': () => {
|
||||
res.send({ message: 'hey' });
|
||||
}
|
||||
});
|
||||
|
||||
res.attachment();
|
||||
res.attachment('path/to/logo.png');
|
||||
app.get('/user/:uid/photos/:file', function (req, res) {
|
||||
app.get('/user/:uid/photos/:file', (req: express.Request, res: express.Response) => {
|
||||
var uid = req.params.uid
|
||||
, file = req.params.file;
|
||||
|
||||
req.user.mayViewFilesFrom(uid, function (yes) {
|
||||
req.user.mayViewFilesFrom(uid, yes => {
|
||||
if (yes) {
|
||||
res.sendfile('/uploads/' + uid + '/' + file);
|
||||
} else {
|
||||
@@ -1451,7 +1450,7 @@ function test_response() {
|
||||
|
||||
res.download('/report-12345.pdf');
|
||||
res.download('/report-12345.pdf', 'report.pdf');
|
||||
res.download('/report-12345.pdf', 'report.pdf', function (err) {
|
||||
res.download('/report-12345.pdf', 'report.pdf', err => {
|
||||
if (err) { } else { }
|
||||
});
|
||||
|
||||
@@ -1460,19 +1459,19 @@ function test_response() {
|
||||
last: 'http://api.example.com/users?page=5'
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
app.use((req: express.Request, res: express.Response, next) => {
|
||||
res.locals.user = req.user;
|
||||
res.locals.authenticated = !req.user.anonymous;
|
||||
next();
|
||||
});
|
||||
res.render('index', function (err, html) { });
|
||||
res.render('user', { name: 'Tobi' }, function (err, html) { });
|
||||
res.render('index', () => {});
|
||||
res.render('user', { name: 'Tobi' }, () => {});
|
||||
|
||||
}
|
||||
|
||||
function test_middleware() {
|
||||
app.use(express.basicAuth('username', 'password'));
|
||||
app.use(express.basicAuth(function (user, pass) {
|
||||
app.use(express.basicAuth((user, pass) => {
|
||||
return 'tj' == user && 'wahoo' == pass;
|
||||
}));
|
||||
app.use(express.bodyParser());
|
||||
|
||||
Vendored
+28
-28
@@ -94,7 +94,7 @@ declare module "express" {
|
||||
*/
|
||||
param(name: string, fn: Function): T;
|
||||
|
||||
param(name: any[], fn: Function): T;
|
||||
param(name: string[], fn: Function): T;
|
||||
|
||||
/**
|
||||
* Special-cased "all" method, applying the given route `path`,
|
||||
@@ -217,6 +217,8 @@ declare module "express" {
|
||||
success: string;
|
||||
|
||||
views: any;
|
||||
|
||||
count: number;
|
||||
}
|
||||
|
||||
interface Request {
|
||||
@@ -248,6 +250,8 @@ declare module "express" {
|
||||
|
||||
header(name: string): string;
|
||||
|
||||
headers: string[];
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
* the best match when true, otherwise `undefined`, in which
|
||||
@@ -327,19 +331,8 @@ declare module "express" {
|
||||
/**
|
||||
* Return an array of Accepted media types
|
||||
* ordered from highest quality to lowest.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* [ { value: 'application/json',
|
||||
* quality: 1,
|
||||
* type: 'application',
|
||||
* subtype: 'json' },
|
||||
* { value: 'text/html',
|
||||
* quality: 0.5,
|
||||
* type: 'text',
|
||||
* subtype: 'html' } ]
|
||||
*/
|
||||
accepted: any[];
|
||||
accepted: MediaType[];
|
||||
|
||||
/**
|
||||
* Return an array of Accepted languages
|
||||
@@ -509,6 +502,8 @@ declare module "express" {
|
||||
|
||||
user: any;
|
||||
|
||||
authenticatedUser: any;
|
||||
|
||||
files: any;
|
||||
|
||||
/**
|
||||
@@ -526,6 +521,20 @@ declare module "express" {
|
||||
signedCookies: any;
|
||||
|
||||
originalUrl: string;
|
||||
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface MediaType {
|
||||
value: string;
|
||||
quality: number;
|
||||
type: string;
|
||||
subtype: string;
|
||||
}
|
||||
|
||||
interface Send {
|
||||
(status: number, body?: any): Response;
|
||||
(body: any): Response;
|
||||
}
|
||||
|
||||
interface Response extends http.ServerResponse {
|
||||
@@ -561,11 +570,7 @@ declare module "express" {
|
||||
* res.send(404, 'Sorry, cant find that');
|
||||
* res.send(404);
|
||||
*/
|
||||
send(status: number): Response;
|
||||
|
||||
send(bodyOrStatus: any): Response;
|
||||
|
||||
send(status: number, body: any): Response;
|
||||
send: Send;
|
||||
|
||||
/**
|
||||
* Send JSON response.
|
||||
@@ -577,11 +582,7 @@ declare module "express" {
|
||||
* res.json(500, 'oh noes!');
|
||||
* res.json(404, 'I dont have that');
|
||||
*/
|
||||
json(status: number): Response;
|
||||
|
||||
json(bodyOrStatus: any): Response;
|
||||
|
||||
json(status: number, body: any): Response;
|
||||
json: Send;
|
||||
|
||||
/**
|
||||
* Send JSON response with JSONP callback support.
|
||||
@@ -593,11 +594,7 @@ declare module "express" {
|
||||
* res.jsonp(500, 'oh noes!');
|
||||
* res.jsonp(404, 'I dont have that');
|
||||
*/
|
||||
jsonp(status: number): Response;
|
||||
|
||||
jsonp(bodyOrStatus: any): Response;
|
||||
|
||||
jsonp(status: number, body: any): Response;
|
||||
jsonp: Send;
|
||||
|
||||
/**
|
||||
* Transfer the file at the given `path`.
|
||||
@@ -945,6 +942,9 @@ declare module "express" {
|
||||
*/
|
||||
engine(ext: string, fn: Function): Application;
|
||||
|
||||
param(name: string, fn: Function): Application;
|
||||
|
||||
param(name: string[], fn: Function): Application;
|
||||
|
||||
/**
|
||||
* Assign `setting` to `val`, or return `setting`'s value.
|
||||
|
||||
Vendored
+944
-14
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
@@ -111,8 +111,8 @@ interface GlobalizeStatic {
|
||||
addCultureInfo(cultureName: string, info: Object): void;
|
||||
addCultureInfo(info: Object): void;
|
||||
findClosestCulture(cultureSelector: string): GlobalizeStatic;
|
||||
format(value: number, format: string, cultureSelector?: string);
|
||||
format(value: Date, format: string, cultureSelector?: string);
|
||||
format(value: number, format: string, cultureSelector?: string): string;
|
||||
format(value: Date, format: string, cultureSelector?: string): string;
|
||||
localize(key: string, cultureSelector?: string): string;
|
||||
|
||||
parseDate(value: string, format?: string, cultureSelector?: string): Date;
|
||||
|
||||
+51
@@ -404,6 +404,57 @@ declare module google {
|
||||
width?: number;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region BarChart
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/barchart#Configuration_Options
|
||||
export interface BarChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
axisTitlesPosition?: string; // in, out, none
|
||||
backgroundColor?: any;
|
||||
bar?: ColumnChartBarOptions;
|
||||
chartArea?: ChartArea;
|
||||
colors?: string[];
|
||||
dataOpacity?: number;
|
||||
enableInteractivity?: boolean;
|
||||
focusTarget?: string;
|
||||
fontSize?: number;
|
||||
fontName?: string;
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
isStacked?: boolean;
|
||||
legend?: ChartLegend;
|
||||
reverseCategories?: boolean;
|
||||
series?: any;
|
||||
theme?: string;
|
||||
title?: string;
|
||||
titlePosition?: string;
|
||||
titleTextStyle?: ChartTextStyle;
|
||||
tooltip?: ChartTooltip;
|
||||
vAxes?: any;
|
||||
vAxis?: ChartAxis;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/barchart
|
||||
export class BarChart {
|
||||
constructor(element: Element);
|
||||
draw(data: DataTable, options: BarChartOptions): void;
|
||||
draw(data: DataView, options: BarChartOptions): void;
|
||||
getBoundingBox(id: string): ChartBoundingBox;
|
||||
getChartAreaBoundingBox(): ChartBoundingBox;
|
||||
getChartLayoutInterface(): ChartLayoutInterface;
|
||||
getHAxisValue(position: number, axisIndex?: number): number;
|
||||
getVAxisValue(position: number, axisIndex?: number): number;
|
||||
getXLocation(position: number, axisIndex?: number): number;
|
||||
getYLocation(position: number, axisIndex?: number): number;
|
||||
getSelection(): any[];
|
||||
setSelection(selection: any[]): void;
|
||||
clearChart(): void;
|
||||
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region Events
|
||||
|
||||
|
||||
@@ -1,77 +1,79 @@
|
||||
/// <reference path="handlebars.d.ts" />
|
||||
import Handlebars = require('handlebars');
|
||||
|
||||
|
||||
var context = {
|
||||
author: { firstName: "Alan", lastName: "Johnson" },
|
||||
body: "I Love Handlebars",
|
||||
author: { firstName: 'Alan', lastName: 'Johnson' },
|
||||
body: 'I Love Handlebars',
|
||||
comments: [{
|
||||
author: { firstName: "Yehuda", lastName: "Katz" },
|
||||
body: "Me too!"
|
||||
author: { firstName: 'Yehuda', lastName: 'Katz' },
|
||||
body: 'Me too!'
|
||||
}]
|
||||
};
|
||||
Handlebars.registerHelper('fullName', (person) => {
|
||||
return person.firstName + " " + person.lastName;
|
||||
return person.firstName + ' ' + person.lastName;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('agree_button', () => {
|
||||
Handlebars.registerHelper('agree_button', function() {
|
||||
return new Handlebars.SafeString(
|
||||
"<button>I agree. I " + this.emotion + " " + this.name + "</button>"
|
||||
'<button>I agree. I ' + this.emotion + ' ' + this.name + '</button>'
|
||||
);
|
||||
});
|
||||
|
||||
var source = "<p>Hello, my name is {{name}}. I am from {{hometown}}. I have " +
|
||||
"{{kids.length}} kids:</p>" +
|
||||
"<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>";
|
||||
var source = '<p>Hello, my name is {{name}}. I am from {{hometown}}. I have ' +
|
||||
'{{kids.length}} kids:</p>' +
|
||||
'<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>';
|
||||
var template = Handlebars.compile(source);
|
||||
var data = { "name": "Alan", "hometown": "Somewhere, TX",
|
||||
"kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
|
||||
var data = { 'name': 'Alan', 'hometown': 'Somewhere, TX',
|
||||
'kids': [{'name': 'Jimmy', 'age': '12'}, {'name': 'Sally', 'age': '4'}]};
|
||||
var result = template(data);
|
||||
|
||||
Handlebars.registerHelper('link_to', (context) => {
|
||||
return "<a href='" + context.url + "'>" + context.body + "</a>";
|
||||
return '<a href="' + context.url + '">' + context.body + '</a>';
|
||||
});
|
||||
|
||||
var context2 = { posts: [{url: "/hello-world", body: "Hello World!"}] };
|
||||
var source2 = "<ul>{{#posts}}<li>{{{link_to this}}}</li>{{/posts}}</ul>"
|
||||
var context2 = { posts: [{url: '/hello-world', body: 'Hello World!'}] };
|
||||
var source2 = '<ul>{{#posts}}<li>{{{link_to this}}}</li>{{/posts}}</ul>';
|
||||
|
||||
var template2 = Handlebars.compile(source2);
|
||||
template2(context2);
|
||||
|
||||
Handlebars.registerHelper('link_to', (title, context) => {
|
||||
return "<a href='/posts" + context.url + "'>" + title + "!</a>"
|
||||
return '<a href="/posts' + context.url + '">' + title + '!</a>';
|
||||
});
|
||||
|
||||
var context3 = { posts: [{url: "/hello-world", body: "Hello World!"}] };
|
||||
var source3 = '<ul>{{#posts}}<li>{{{link_to "Post" this}}}</li>{{/posts}}</ul>'
|
||||
var context3 = { posts: [{url: '/hello-world', body: 'Hello World!'}] };
|
||||
var source3 = '<ul>{{#posts}}<li>{{{link_to "Post" this}}}</li>{{/posts}}</ul>';
|
||||
var template3 = Handlebars.compile(source3);
|
||||
template3(context3);
|
||||
|
||||
var source4 = "<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>";
|
||||
Handlebars.registerHelper('link', (context, options) => {
|
||||
var source4 = '<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>';
|
||||
Handlebars.registerHelper('link', function(context) {
|
||||
return '<a href="/people/' + this.id + '">' + context.fn(this) + '</a>';
|
||||
});
|
||||
var template4 = Handlebars.compile(source4);
|
||||
var data2 = { "people": [
|
||||
{ "name": "Alan", "id": 1 },
|
||||
{ "name": "Yehuda", "id": 2 }
|
||||
var data2 = { 'people': [
|
||||
{ 'name': 'Alan', 'id': 1 },
|
||||
{ 'name': 'Yehuda', 'id': 2 }
|
||||
]};
|
||||
template4(data2);
|
||||
|
||||
var source5 = "<ul>{{#people}}<li>{{> link}}</li>{{/people}}</ul>";
|
||||
Handlebars.registerPartial('link', '<a href="/people/{{id}}">{{name}}</a>')
|
||||
var source5 = '<ul>{{#people}}<li>{{> link}}</li>{{/people}}</ul>';
|
||||
Handlebars.registerPartial('link', '<a href="/people/{{id}}">{{name}}</a>');
|
||||
var template5 = Handlebars.compile(source5);
|
||||
var data3 = { "people": [
|
||||
{ "name": "Alan", "id": 1 },
|
||||
{ "name": "Yehuda", "id": 2 }
|
||||
var data3 = { 'people': [
|
||||
{ 'name': 'Alan', 'id': 1 },
|
||||
{ 'name': 'Yehuda', 'id': 2 }
|
||||
]};
|
||||
template5(data3);
|
||||
|
||||
Handlebars.registerHelper('list', (items, fn) => {
|
||||
var out = "<ul>";
|
||||
var out = '<ul>';
|
||||
for(var i=0, l=items.length; i<l; i++) {
|
||||
out = out + "<li>" + fn(items[i]) + "</li>";
|
||||
out = out + '<li>' + fn(items[i]) + '</li>';
|
||||
}
|
||||
return out + "</ul>";
|
||||
return out + '</ul>';
|
||||
});
|
||||
Handlebars.registerHelper('fullName', (person) => {
|
||||
return person.firstName + " " + person.lastName;
|
||||
});
|
||||
return person.firstName + ' ' + person.lastName;
|
||||
});
|
||||
|
||||
Vendored
+32
-23
@@ -4,30 +4,39 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module Handlebars {
|
||||
function registerHelper(name: string, fn: Function, inverse?: boolean): void;
|
||||
function registerPartial(name: string, str: any): void;
|
||||
function K(): void;
|
||||
function createFrame(object: any): any;
|
||||
function Exception(message: string): void;
|
||||
class SafeString {
|
||||
constructor(str: string);
|
||||
static toString(): string;
|
||||
}
|
||||
function parse(input: string): boolean;
|
||||
var logger: Logger;
|
||||
function log(level: number, obj: any): void;
|
||||
function compile(input: any, options?: any): (context: any, options?: any) => string;
|
||||
declare var Handlebars: HandlebarsStatic;
|
||||
|
||||
interface Logger {
|
||||
DEBUG: number;
|
||||
INFO: number;
|
||||
WARN: number;
|
||||
ERROR: number;
|
||||
level: number;
|
||||
interface HandlebarsStatic {
|
||||
registerHelper(name: string, fn: Function, inverse?: boolean): void;
|
||||
registerPartial(name: string, str: any): void;
|
||||
K(): void;
|
||||
createFrame(object: any): any;
|
||||
Exception(message: string): void;
|
||||
SafeString: typeof SafeString;
|
||||
parse(input: string): boolean;
|
||||
logger: Logger;
|
||||
log(level: number, obj: any): void;
|
||||
compile(input: any, options?: any): (context: any, options?: any) => string;
|
||||
Logger: typeof Logger;
|
||||
}
|
||||
|
||||
methodMap: { [level: number]: string };
|
||||
declare class SafeString {
|
||||
constructor(str: string);
|
||||
static toString(): string;
|
||||
}
|
||||
|
||||
log(level: number, obj: string): void;
|
||||
}
|
||||
interface Logger {
|
||||
DEBUG: number;
|
||||
INFO: number;
|
||||
WARN: number;
|
||||
ERROR: number;
|
||||
level: number;
|
||||
|
||||
methodMap: { [level: number]: string };
|
||||
|
||||
log(level: number, obj: string): void;
|
||||
}
|
||||
|
||||
declare module "handlebars" {
|
||||
export = Handlebars;
|
||||
}
|
||||
|
||||
Vendored
+7
-7
@@ -1011,7 +1011,7 @@ interface HighchartsChartObject {
|
||||
setTitle(title: HighchartsTitleOptions): void;
|
||||
setTitle(title: HighchartsTitleOptions, subtitle: HighchartsSubtitleOptions): void;
|
||||
showLoading(): void;
|
||||
showLoading(str: string);
|
||||
showLoading(str: string): void;
|
||||
xAxis: HighchartsAxisObject[];
|
||||
yAxis: HighchartsAxisObject[];
|
||||
|
||||
@@ -1058,7 +1058,7 @@ interface HighchartsStatic {
|
||||
setOptions(options: HighchartsOptions): HighchartsOptions;
|
||||
getOptions(): HighchartsOptions;
|
||||
|
||||
map(array: any[], any): any[];
|
||||
map(array: any[], fn: Function): any[];
|
||||
}
|
||||
declare var Highcharts: HighchartsStatic;
|
||||
|
||||
@@ -1088,16 +1088,16 @@ interface HighchartsPointObject {
|
||||
}
|
||||
|
||||
interface HighchartsSeriesObject {
|
||||
addPoint(options: any);
|
||||
addPoint(options: any, redraw: boolean, shift: boolean);
|
||||
addPoint(options: any, redraw: boolean, shift: boolean, animation: boolean);
|
||||
addPoint(options: any, redraw: boolean, shift: boolean, animation: HighchartsAnimation);
|
||||
addPoint(options: any): void;
|
||||
addPoint(options: any, redraw: boolean, shift: boolean): void;
|
||||
addPoint(options: any, redraw: boolean, shift: boolean, animation: boolean): void;
|
||||
addPoint(options: any, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void;
|
||||
chart: HighchartsChartObject;
|
||||
data: HighchartsDataPoint[];
|
||||
hide(): void;
|
||||
options: HighchartsSeriesOptions;
|
||||
remove(): void;
|
||||
remove(redraw: boolean);
|
||||
remove(redraw: boolean): void;
|
||||
name: string;
|
||||
points: HighchartsPointObject[];
|
||||
select(): void;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path="html2canvas.d.ts" />
|
||||
|
||||
var element: HTMLElement;
|
||||
|
||||
html2canvas(element);
|
||||
html2canvas(element, {});
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for html2canvas.js v0.4.1
|
||||
// Project: https://github.com/niklasvh/html2canvas
|
||||
// Definitions by: Richard Hepburn <https://github.com/rwhepburn/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module Html2Canvas {
|
||||
interface Html2CanvasOptions {
|
||||
/** Whether to allow cross-origin images to taint the canvas */
|
||||
allowTaint?: boolean;
|
||||
|
||||
/** Canvas background color, if none is specified in DOM. Set undefined for transparent */
|
||||
background?: string;
|
||||
|
||||
/** Define the heigt of the canvas in pixels. If null, renders with full height of the window. */
|
||||
height?: number;
|
||||
|
||||
/** Whether to render each letter seperately. Necessary if letter-spacing is used. */
|
||||
letterRendering?: boolean;
|
||||
|
||||
/** Whether to log events in the console. */
|
||||
logging?: boolean;
|
||||
|
||||
/** Url to the proxy which is to be used for loading cross-origin images. If left empty, cross-origin images won't be loaded. */
|
||||
proxy?: string;
|
||||
|
||||
/** Whether to test each image if it taints the canvas before drawing them */
|
||||
taintTest?: boolean;
|
||||
|
||||
/** Timeout for loading images, in milliseconds. Setting it to 0 will result in no timeout. */
|
||||
timeout?: number;
|
||||
|
||||
/** Define the width of the canvas in pixels. If null, renders with full width of the window. */
|
||||
width?: number;
|
||||
|
||||
/** Whether to attempt to load cross-origin images as CORS served, before reverting back to proxy. */
|
||||
useCORS?: boolean;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface Html2CanvasStatic {
|
||||
|
||||
/**
|
||||
* Renders an HTML element to a canvas so that a screenshot can be generated.
|
||||
*
|
||||
* The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot,
|
||||
* but builds the screenshot based on the information available on the page.
|
||||
*
|
||||
* @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window.
|
||||
*/
|
||||
(element: HTMLElement): void;
|
||||
/**
|
||||
* Renders an HTML element to a canvas so that a screenshot can be generated.
|
||||
*
|
||||
* The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot,
|
||||
* but builds the screenshot based on the information available on the page.
|
||||
*
|
||||
* @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window.
|
||||
* @param {Html2CanvasOptions} options The options object that controls how the element will be rendered.
|
||||
*/
|
||||
(element: HTMLElement, options: Html2Canvas.Html2CanvasOptions): void;
|
||||
}
|
||||
|
||||
declare var html2canvas: Html2CanvasStatic;
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for iScroll Lite 5
|
||||
// Project: http://cubiq.org/iscroll-5-ready-for-beta-test
|
||||
// Definitions by: Christiaan Rakowski <https://github.com/csrakowski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface IScrollOptions {
|
||||
//hScroll?: boolean;
|
||||
//vScroll?: boolean;
|
||||
|
||||
scrollX?: boolean;
|
||||
scrollY?: boolean;
|
||||
|
||||
x?: number;
|
||||
y?: number;
|
||||
bounce?: boolean;
|
||||
bounceLock?: boolean;
|
||||
momentum?: boolean;
|
||||
lockDirection?: boolean;
|
||||
useTransform?: boolean;
|
||||
useTransition?: boolean;
|
||||
}
|
||||
|
||||
declare class IScroll {
|
||||
|
||||
constructor (element: string, options?: IScrollOptions);
|
||||
constructor (element: HTMLElement, options?: IScrollOptions);
|
||||
|
||||
destroy(): void;
|
||||
refresh(): void;
|
||||
scrollTo(x: number, y: number, time?: number, relative?: boolean): void;
|
||||
scrollToElement(element: string, time?: number): void;
|
||||
scrollToElement(element: HTMLElement, time?: number): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
stop(): void;
|
||||
|
||||
// Events
|
||||
on: (type: string, fn: () => void) => void;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/// <reference path="iscroll-5.d.ts" />
|
||||
|
||||
var myScroll1 = new IScroll('#wrapper');
|
||||
var myScroll2 = new IScroll('#wrapper', { hScrollbar: false, vScrollbar: false });
|
||||
var myScroll3 = new IScroll('#wrapper', {
|
||||
snap: true,
|
||||
momentum: false,
|
||||
hScrollbar: false,
|
||||
vScrollbar: false
|
||||
});
|
||||
var myScroll4 = new IScroll('#wrapper', {
|
||||
snap: 'li',
|
||||
momentum: false,
|
||||
hScrollbar: false,
|
||||
vScrollbar: false
|
||||
});
|
||||
var myScroll6 = new IScroll('#wrapper', { scrollbarClass: 'myScrollbar' });
|
||||
var myScroll7 = new IScroll('#wrapper', { bounceEasing: 'elastic', bounceTime: 1200 });
|
||||
|
||||
var myScroll8 = new IScroll('#wrapper', { eventPassthrough: true, scrollX: true, scrollY: false, preventDefault: false });
|
||||
|
||||
myScroll1.refresh();
|
||||
myScroll1.scrollTo(0, 100);
|
||||
myScroll1.scrollTo(0, 100, 200);
|
||||
myScroll1.scrollTo(0, 100, 200, true);
|
||||
|
||||
myScroll1.scrollToElement('selectedElement');
|
||||
myScroll1.scrollToElement('selectedElement', 250);
|
||||
|
||||
myScroll1.scrollToElement(document.getElementById('selectedElement'));
|
||||
myScroll1.scrollToElement(document.getElementById('selectedElement'), 250);
|
||||
|
||||
myScroll2.on('scrollStart', function () { console.log('scroll started'); });
|
||||
|
||||
var myScroll9 = new IScroll(document.getElementById('wrapper'));
|
||||
var myScroll10 = new IScroll(document.getElementById('wrapper'), { scrollbarClass: 'myScrollbar' });
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
// Type definitions for iScroll 5
|
||||
// Project: http://cubiq.org/iscroll-5-ready-for-beta-test
|
||||
// Definitions by: Christiaan Rakowski <https://github.com/csrakowski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface IScrollOptions {
|
||||
//hScroll?: boolean;
|
||||
//vScroll?: boolean;
|
||||
x?: number;
|
||||
y?: number;
|
||||
bounce?: boolean;
|
||||
bounceLock?: boolean;
|
||||
momentum?: boolean;
|
||||
lockDirection?: boolean;
|
||||
useTransform?: boolean;
|
||||
useTransition?: boolean;
|
||||
topOffset?: number;
|
||||
checkDOMChanges?: boolean;
|
||||
handleClick?: boolean;
|
||||
|
||||
// Scrollbar
|
||||
hScrollbar?: boolean;
|
||||
vScrollbar?: boolean;
|
||||
fixedScrollbar?: boolean;
|
||||
hideScrollbar?: boolean;
|
||||
fadeScrollbar?: boolean;
|
||||
scrollbarClass?: string;
|
||||
|
||||
// Zoom
|
||||
zoom?: boolean;
|
||||
zoomMin?: number;
|
||||
zoomMax?: number;
|
||||
doubleTapZoom?: number;
|
||||
wheelAction?: string;
|
||||
|
||||
|
||||
///String or boolean
|
||||
snap?: any;
|
||||
snapThreshold?: number;
|
||||
|
||||
//new in IScroll 5?
|
||||
|
||||
resizeIndicator?: boolean;
|
||||
mouseWheelSpeed?: number;
|
||||
startX?: number;
|
||||
startY?: number;
|
||||
scrollX?: boolean;
|
||||
scrollY?: boolean;
|
||||
directionLockThreshold?: number;
|
||||
|
||||
bounceTime?: number;
|
||||
|
||||
///String or function
|
||||
bounceEasing?: any;
|
||||
|
||||
preventDefault?: boolean;
|
||||
preventDefaultException?: boolean;
|
||||
|
||||
HWCompositing?: boolean;
|
||||
|
||||
freeScroll?: boolean;
|
||||
|
||||
resizePolling?: number;
|
||||
tap?: boolean;
|
||||
click?: boolean;
|
||||
invertWheelDirection?: boolean;
|
||||
|
||||
///Boolean or string
|
||||
eventPassthrough?: any;
|
||||
}
|
||||
|
||||
declare class IScroll {
|
||||
|
||||
constructor (element: string, options?: IScrollOptions);
|
||||
constructor (element: HTMLElement, options?: IScrollOptions);
|
||||
|
||||
destroy(): void;
|
||||
refresh(): void;
|
||||
scrollTo(x: number, y: number, time?: number, relative?: boolean): void;
|
||||
scrollToElement(element: string, time?: number): void;
|
||||
scrollToElement(element: HTMLElement, time?: number): void;
|
||||
scrollToPage(pageX: number, pageY: number, time?: number): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
stop(): void;
|
||||
zoom(x: number, y: number, scale: number, time?: number): void;
|
||||
isReady(): boolean;
|
||||
|
||||
// Events
|
||||
on: (type: string, fn: () => void) => void;
|
||||
}
|
||||
@@ -410,6 +410,11 @@ function test_animatedSelector() {
|
||||
animateIt();
|
||||
}
|
||||
|
||||
function test_easing() {
|
||||
var result: number = $.easing.linear(3);
|
||||
var result: number = $.easing.swing(3);
|
||||
}
|
||||
|
||||
function test_append() {
|
||||
$('.inner').append('<p>Test</p>');
|
||||
$('.container').append($('h2'));
|
||||
|
||||
Vendored
+10
-2
@@ -348,6 +348,13 @@ interface JQueryEventConstructor {
|
||||
new (name: string, eventProperties?: any): JQueryEventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface used to specify easing functions.
|
||||
*/
|
||||
interface JQueryEasing {
|
||||
linear(p: number): number;
|
||||
swing(p: number): number;
|
||||
}
|
||||
|
||||
/*
|
||||
Static members of jQuery (those on $ and jQuery themselves)
|
||||
@@ -647,6 +654,7 @@ interface JQueryStatic {
|
||||
|
||||
Animation(elem: any, properties: any, options: any): any;
|
||||
|
||||
easing: JQueryEasing;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1204,9 +1212,9 @@ interface JQuery {
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
|
||||
*/
|
||||
on(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
|
||||
Vendored
+56
-55
@@ -6,7 +6,7 @@
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQueryMobileEvent { (event: Event, ui): void; }
|
||||
interface JQueryMobileEvent { (event: Event, ui: any): void; }
|
||||
|
||||
interface DialogOptions {
|
||||
closeBtn?: string;
|
||||
@@ -208,7 +208,7 @@ interface JQueryMobileOptions {
|
||||
ajaxEnabled?: boolean;
|
||||
allowCrossDomainPages?: boolean;
|
||||
autoInitializePage?: boolean;
|
||||
buttonMarkup;
|
||||
buttonMarkup: any;
|
||||
defaultDialogTransition?: string;
|
||||
defaultPageTransition?: string;
|
||||
getMaxScrollForTransition?: number;
|
||||
@@ -227,43 +227,43 @@ interface JQueryMobileOptions {
|
||||
pushStateEnabled?: boolean;
|
||||
subPageUrlKey?: string;
|
||||
touchOverflowEnabled?: boolean;
|
||||
transitionFallbacks;
|
||||
transitionFallbacks: any;
|
||||
}
|
||||
|
||||
interface JQueryMobileEvents {
|
||||
tap;
|
||||
taphold;
|
||||
swipe;
|
||||
swipeleft;
|
||||
swiperight;
|
||||
tap: any;
|
||||
taphold: any;
|
||||
swipe: any;
|
||||
swipeleft: any;
|
||||
swiperight: any;
|
||||
|
||||
vmouseover;
|
||||
vmouseout;
|
||||
vmousedown;
|
||||
vmousemove;
|
||||
vmouseup;
|
||||
vclick;
|
||||
vmousecancel;
|
||||
vmouseover: any;
|
||||
vmouseout: any;
|
||||
vmousedown: any;
|
||||
vmousemove: any;
|
||||
vmouseup: any;
|
||||
vclick: any;
|
||||
vmousecancel: any;
|
||||
|
||||
orientationchange;
|
||||
scrollstart;
|
||||
scrollstop;
|
||||
orientationchange: any;
|
||||
scrollstart: any;
|
||||
scrollstop: any;
|
||||
|
||||
pagebeforeload;
|
||||
pageload;
|
||||
pageloadfailed;
|
||||
pagebeforechange;
|
||||
pagechange;
|
||||
pagechangefailed;
|
||||
pagebeforeshow;
|
||||
pagebeforehide;
|
||||
pageshow;
|
||||
pagehide;
|
||||
pagebeforecreate;
|
||||
pagecreate;
|
||||
pageinit;
|
||||
pageremove;
|
||||
updatelayout;
|
||||
pagebeforeload: any;
|
||||
pageload: any;
|
||||
pageloadfailed: any;
|
||||
pagebeforechange: any;
|
||||
pagechange: any;
|
||||
pagechangefailed: any;
|
||||
pagebeforeshow: any;
|
||||
pagebeforehide: any;
|
||||
pageshow: any;
|
||||
pagehide: any;
|
||||
pagebeforecreate: any;
|
||||
pagecreate: any;
|
||||
pageinit: any;
|
||||
pageremove: any;
|
||||
updatelayout: any;
|
||||
}
|
||||
|
||||
interface ChangePageOptions {
|
||||
@@ -307,37 +307,38 @@ interface JQueryMobile extends JQueryMobileOptions {
|
||||
loadPage(url: any, options?: LoadPageOptions): void;
|
||||
loading(command: string, options?: LoaderOptions): void;
|
||||
|
||||
base;
|
||||
base: any;
|
||||
silentScroll(yPos: number): void;
|
||||
activePage;
|
||||
activePage: JQuery;
|
||||
|
||||
options: JQueryMobileOptions;
|
||||
|
||||
transitionFallbacks;
|
||||
showPageLoadingMsg();
|
||||
hidePageLoadingMsg();
|
||||
loader;
|
||||
page;
|
||||
transitionFallbacks: any;
|
||||
showPageLoadingMsg(): void;
|
||||
hidePageLoadingMsg(): void;
|
||||
loader: any;
|
||||
page: any;
|
||||
|
||||
touchOverflow;
|
||||
showCategory;
|
||||
path;
|
||||
touchOverflow: any;
|
||||
showCategory: any;
|
||||
path: any;
|
||||
|
||||
dialog;
|
||||
popup;
|
||||
fixedtoolbar;
|
||||
button;
|
||||
collapsible;
|
||||
collapsibleset;
|
||||
textinput;
|
||||
slider;
|
||||
checkboxradio;
|
||||
selectmenu;
|
||||
listview;
|
||||
dialog: any;
|
||||
popup: any;
|
||||
fixedtoolbar: any;
|
||||
button: any;
|
||||
collapsible: any;
|
||||
collapsibleset: any;
|
||||
textinput: any;
|
||||
slider: any;
|
||||
checkboxradio: any;
|
||||
selectmenu: any;
|
||||
listview: any;
|
||||
defaultHomeScroll: number;
|
||||
}
|
||||
|
||||
interface JQuerySupport {
|
||||
touchOverflow;
|
||||
touchOverflow: any;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference path="karma-jasmine.d.ts" />
|
||||
|
||||
ddescribe("A suite", () => {
|
||||
iit("contains spec with an expectation", () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for karma-jasmine plugin
|
||||
// Project: https://github.com/karma-runner/karma-jasmine
|
||||
// Definitions by: Michel Salib <michelsalib@hotmail.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
declare function ddescribe(description: string, specDefinitions: () => void): void;
|
||||
declare function iit(expectation: string, assertion: () => void): void;
|
||||
@@ -56,13 +56,13 @@ function test_computed() {
|
||||
function MyViewModel1() {
|
||||
this.price = ko.observable(25.99);
|
||||
|
||||
this.formattedPrice = ko.computed({
|
||||
this.formattedPrice = ko.computed<string>({
|
||||
read: function () {
|
||||
return '$' + this.price().toFixed(2);
|
||||
},
|
||||
write: function (value) {
|
||||
value = parseFloat(value.replace(/[^\.\d]/g, ""));
|
||||
this.price(isNaN(value) ? 0 : value);
|
||||
var num = parseFloat(value.replace(/[^\.\d]/g, ""));
|
||||
this.price(isNaN(num) ? 0 : num);
|
||||
},
|
||||
owner: this
|
||||
});
|
||||
@@ -124,7 +124,7 @@ function test_observableArrays() {
|
||||
myObservableArray.unshift('Some new value');
|
||||
myObservableArray.shift();
|
||||
myObservableArray.reverse();
|
||||
myObservableArray.sort(function (left, right) { return left.lastName == right.lastName ? 0 : (left.lastName < right.lastName ? -1 : 1) });
|
||||
myObservableArray.sort(function (left, right) { return left == right ? 0 : (left < right ? -1 : 1) });
|
||||
myObservableArray.splice(1, 3);
|
||||
|
||||
myObservableArray.remove('Blah');
|
||||
@@ -180,8 +180,6 @@ function test_bindings() {
|
||||
init: function (element, valueAccessor) {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor());
|
||||
$(element).toggle(value);
|
||||
},
|
||||
update: function (element, valueAccessor, allBindingsAccessor) {
|
||||
}
|
||||
};
|
||||
ko.bindingHandlers.hasFocus = {
|
||||
|
||||
Vendored
+27
-12
@@ -1158,7 +1158,7 @@ declare module 'mapsjs' {
|
||||
* @param {renderer} r The renderer delegate function with
|
||||
* signature renderer(quadview).
|
||||
*/
|
||||
setRenderer(r: tile.renderer): void;
|
||||
setRenderer(r: any): void;
|
||||
|
||||
/**
|
||||
* Notifies the tile layer to check for changes to its renderer.
|
||||
@@ -1548,7 +1548,7 @@ declare module 'mapsjs' {
|
||||
* This should be called if the data changes or if, due to extent
|
||||
* changes, the density changes.
|
||||
*/
|
||||
notifyRecompute(): void;
|
||||
notifyRecompute(extents?: envelope): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1753,7 +1753,7 @@ declare module 'mapsjs' {
|
||||
* The bitmap or vector tile requestor using MapDotNet REST services.
|
||||
* @class requestorMDN
|
||||
*/
|
||||
export class requestorMDN extends requestor {
|
||||
export class requestorMDNRest extends requestor {
|
||||
constructor(endpoint: string, options?: {
|
||||
dataFormat?: string;
|
||||
timeoutMs?: number;
|
||||
@@ -2249,7 +2249,22 @@ declare module 'mapsjs' {
|
||||
* @param {number} [durationMs] Duration in miliseconds.
|
||||
* @param {function} [completeAction] Callback to perform on animaton complete.
|
||||
*/
|
||||
setMapCenterToGeolocationAnimate(durationMs?: number, completeAction?: () => void): void;
|
||||
setMapCenterToGeolocationAnimate(durationMs?: number, completeAction?: () => void): void;
|
||||
|
||||
/**
|
||||
* Offsets the current map center by the specified deltas in pixels.
|
||||
* @param {number} [dx] offset x in pixels.
|
||||
* @param {number} [dy] offset y in pixels.
|
||||
*/
|
||||
offsetMapCenterByPixelDelta(dx: number, dy: number): void;
|
||||
|
||||
/**
|
||||
* Offsets the current map center by the specified deltas in pixels - animated version.
|
||||
* @param {number} [dx] offset x in pixels.
|
||||
* @param {number} [dy] offset y in pixels.
|
||||
* @param {number} [durationMs] animation duration in mS.
|
||||
*/
|
||||
offsetMapCenterByPixelDeltaAnimate(dx: number, dy: number, durationMs?: number): void;
|
||||
|
||||
/**
|
||||
* Gets the current zoom level.
|
||||
@@ -2382,15 +2397,15 @@ declare module 'mapsjs' {
|
||||
popTileLayer(): tile.layer;
|
||||
|
||||
/**
|
||||
* Removes a tile layer off the display stack by reference
|
||||
* @param {tile.layer} tl - a tile layer
|
||||
*/
|
||||
removeTileLayer(tl: tile.layer): void;
|
||||
* Removes a tile layer off the display stack by reference
|
||||
* @param {tile.layer} tl A tile layer to remove.
|
||||
*/
|
||||
removeTileLayer(tl: tile.layer): void;
|
||||
|
||||
/**
|
||||
* Removes all tile layers off the display stack
|
||||
*/
|
||||
removeAllTileLayers(): void;
|
||||
/**
|
||||
* Removes all tile layers off the display stack
|
||||
*/
|
||||
removeAllTileLayers(): void;
|
||||
|
||||
/**
|
||||
* Gets the current number of tile layers in the display stack.
|
||||
|
||||
Vendored
+10
-10
@@ -140,10 +140,10 @@ declare module "ffi" {
|
||||
* accept C callback functions.
|
||||
*/
|
||||
export var Callback: {
|
||||
new (retType, argTypes: any[], abi: number, fn: Function): NodeBuffer;
|
||||
new (retType, argTypes: any[], fn: Function): NodeBuffer;
|
||||
(retType, argTypes: any[], abi: number, fn: Function): NodeBuffer;
|
||||
(retType, argTypes: any[], fn: Function): NodeBuffer;
|
||||
new (retType: any, argTypes: any[], abi: number, fn: Function): NodeBuffer;
|
||||
new (retType: any, argTypes: any[], fn: Function): NodeBuffer;
|
||||
(retType: any, argTypes: any[], abi: number, fn: Function): NodeBuffer;
|
||||
(retType: any, argTypes: any[], fn: Function): NodeBuffer;
|
||||
}
|
||||
|
||||
export var ffiType: {
|
||||
@@ -200,7 +200,7 @@ declare module "ref" {
|
||||
/** To invoke when `ref.get` is invoked on a buffer of this type. */
|
||||
get(buffer: NodeBuffer, offset: number): any;
|
||||
/** To invoke when `ref.set` is invoked on a buffer of this type. */
|
||||
set(buffer: NodeBuffer, offset: number, value): void;
|
||||
set(buffer: NodeBuffer, offset: number, value: any): void;
|
||||
/** The name to use during debugging for this datatype. */
|
||||
name?: string;
|
||||
/** The alignment of this datatype when placed inside a struct. */
|
||||
@@ -214,9 +214,9 @@ declare module "ref" {
|
||||
/** Get the memory address of buffer. */
|
||||
export function address(buffer: NodeBuffer): number;
|
||||
/** Allocate the memory with the given value written to it. */
|
||||
export function alloc(type: Type, value?): NodeBuffer;
|
||||
export function alloc(type: Type, value?: any): NodeBuffer;
|
||||
/** Allocate the memory with the given value written to it. */
|
||||
export function alloc(type: string, value?): NodeBuffer;
|
||||
export function alloc(type: string, value?: any): NodeBuffer;
|
||||
|
||||
/**
|
||||
* Allocate the memory with the given string written to it with the given
|
||||
@@ -310,9 +310,9 @@ declare module "ref" {
|
||||
offset?: number): NodeBuffer;
|
||||
|
||||
/** Write pointer if the indirection is 1, otherwise write value. */
|
||||
export function set(buffer: NodeBuffer, offset: number, value, type?: Type): void;
|
||||
export function set(buffer: NodeBuffer, offset: number, value: any, type?: Type): void;
|
||||
/** Write pointer if the indirection is 1, otherwise write value. */
|
||||
export function set(buffer: NodeBuffer, offset: number, value, type?: string): void;
|
||||
export function set(buffer: NodeBuffer, offset: number, value: any, type?: string): void;
|
||||
/** Write the string as a NULL terminated. Default encoding is utf8. */
|
||||
export function writeCString(buffer: NodeBuffer, offset: number,
|
||||
string: string, encoding?: string): void;
|
||||
@@ -347,7 +347,7 @@ declare module "ref" {
|
||||
* Attach object to buffer such.
|
||||
* It prevents object from being garbage collected until buffer does.
|
||||
*/
|
||||
export function _attach(buffer: NodeBuffer, object: Object);
|
||||
export function _attach(buffer: NodeBuffer, object: Object): void;
|
||||
|
||||
/** Same as ref.reinterpret, except that this version does not attach buffer. */
|
||||
export function _reinterpret(buffer: NodeBuffer, size: number,
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
Vendored
+57
-51
@@ -15,10 +15,10 @@ declare var global: any;
|
||||
declare var __filename: string;
|
||||
declare var __dirname: string;
|
||||
|
||||
declare function setTimeout(callback: (...args: any[]) => void , ms: number , ...args: any[]): Timer;
|
||||
declare function clearTimeout(timeoutId: Timer): void;
|
||||
declare function setInterval(callback: (...args: any[]) => void , ms: number , ...args: any[]): Timer;
|
||||
declare function clearInterval(intervalId: Timer): void;
|
||||
declare function setTimeout(callback: (...args: any[]) => void , ms: number , ...args: any[]): NodeTimer;
|
||||
declare function clearTimeout(timeoutId: NodeTimer): void;
|
||||
declare function setInterval(callback: (...args: any[]) => void , ms: number , ...args: any[]): NodeTimer;
|
||||
declare function clearInterval(intervalId: NodeTimer): void;
|
||||
declare function setImmediate(callback: (...args: any[]) => void , ...args: any[]): any;
|
||||
declare function clearImmediate(immediateId: any): void;
|
||||
|
||||
@@ -67,6 +67,13 @@ declare var Buffer: {
|
||||
* *
|
||||
************************************************/
|
||||
|
||||
interface ErrnoException extends Error {
|
||||
errno?: any;
|
||||
code?: string;
|
||||
path?: string;
|
||||
syscall?: string;
|
||||
}
|
||||
|
||||
interface EventEmitter {
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
@@ -195,10 +202,9 @@ interface NodeBuffer {
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
|
||||
fill(value: any, offset?: number, end?: number): void;
|
||||
INSPECT_MAX_BYTES: number;
|
||||
}
|
||||
|
||||
interface Timer {
|
||||
interface NodeTimer {
|
||||
ref() : void;
|
||||
unref() : void;
|
||||
}
|
||||
@@ -747,87 +753,87 @@ declare module "fs" {
|
||||
export interface ReadStream extends stream.ReadableStream { }
|
||||
export interface WriteStream extends stream.WritableStream { }
|
||||
|
||||
export function rename(oldPath: string, newPath: string, callback?: Function): void;
|
||||
export function rename(oldPath: string, newPath: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function renameSync(oldPath: string, newPath: string): void;
|
||||
export function truncate(path: string, callback?: Function): void;
|
||||
export function truncate(path: string, len: number, callback?: Function): void;
|
||||
export function truncate(path: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function truncate(path: string, len: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function truncateSync(path: string, len?: number): void;
|
||||
export function ftruncate(fd: number, callback?: Function): void;
|
||||
export function ftruncate(fd: number, len: number, callback?: Function): void;
|
||||
export function ftruncate(fd: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function ftruncate(fd: number, len: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function ftruncateSync(fd: number, len?: number): void;
|
||||
export function chown(path: string, uid: number, gid: number, callback?: Function): void;
|
||||
export function chown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function chownSync(path: string, uid: number, gid: number): void;
|
||||
export function fchown(fd: number, uid: number, gid: number, callback?: Function): void;
|
||||
export function fchown(fd: number, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function fchownSync(fd: number, uid: number, gid: number): void;
|
||||
export function lchown(path: string, uid: number, gid: number, callback?: Function): void;
|
||||
export function lchown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function lchownSync(path: string, uid: number, gid: number): void;
|
||||
export function chmod(path: string, mode: number, callback?: Function): void;
|
||||
export function chmod(path: string, mode: string, callback?: Function): void;
|
||||
export function chmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function chmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function chmodSync(path: string, mode: number): void;
|
||||
export function chmodSync(path: string, mode: string): void;
|
||||
export function fchmod(fd: number, mode: number, callback?: Function): void;
|
||||
export function fchmod(fd: number, mode: string, callback?: Function): void;
|
||||
export function fchmod(fd: number, mode: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function fchmod(fd: number, mode: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function fchmodSync(fd: number, mode: number): void;
|
||||
export function fchmodSync(fd: number, mode: string): void;
|
||||
export function lchmod(path: string, mode: number, callback?: Function): void;
|
||||
export function lchmod(path: string, mode: string, callback?: Function): void;
|
||||
export function lchmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function lchmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function lchmodSync(path: string, mode: number): void;
|
||||
export function lchmodSync(path: string, mode: string): void;
|
||||
export function stat(path: string, callback?: (err: Error, stats: Stats) => any): void;
|
||||
export function lstat(path: string, callback?: (err: Error, stats: Stats) => any): void;
|
||||
export function fstat(fd: number, callback?: (err: Error, stats: Stats) => any): void;
|
||||
export function stat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void;
|
||||
export function lstat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void;
|
||||
export function fstat(fd: number, callback?: (err: ErrnoException, stats: Stats) => any): void;
|
||||
export function statSync(path: string): Stats;
|
||||
export function lstatSync(path: string): Stats;
|
||||
export function fstatSync(fd: number): Stats;
|
||||
export function link(srcpath: string, dstpath: string, callback?: Function): void;
|
||||
export function link(srcpath: string, dstpath: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function linkSync(srcpath: string, dstpath: string): void;
|
||||
export function symlink(srcpath: string, dstpath: string, type?: string, callback?: Function): void;
|
||||
export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
|
||||
export function readlink(path: string, callback?: (err: Error, linkString: string) => any): void;
|
||||
export function readlink(path: string, callback?: (err: ErrnoException, linkString: string) => any): void;
|
||||
export function readlinkSync(path: string): string;
|
||||
export function realpath(path: string, callback?: (err: Error, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string, cache: {[path: string]: string}, callback: (err: Error, resolvedPath: string) =>any): void;
|
||||
export function realpath(path: string, callback?: (err: ErrnoException, resolvedPath: string) => any): void;
|
||||
export function realpath(path: string, cache: {[path: string]: string}, callback: (err: ErrnoException, resolvedPath: string) =>any): void;
|
||||
export function realpathSync(path: string, cache?: {[path: string]: string}): void;
|
||||
export function unlink(path: string, callback?: Function): void;
|
||||
export function unlink(path: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function unlinkSync(path: string): void;
|
||||
export function rmdir(path: string, callback?: Function): void;
|
||||
export function rmdir(path: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function rmdirSync(path: string): void;
|
||||
export function mkdir(path: string, callback?: Function): void;
|
||||
export function mkdir(path: string, mode: number, callback?: Function): void;
|
||||
export function mkdir(path: string, mode: string, callback?: Function): void;
|
||||
export function mkdir(path: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function mkdir(path: string, mode: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function mkdir(path: string, mode: string, callback?: (err?: ErrnoException) => void): void;
|
||||
export function mkdirSync(path: string, mode?: number): void;
|
||||
export function mkdirSync(path: string, mode?: string): void;
|
||||
export function readdir(path: string, callback?: (err: Error, files: string[]) => void): void;
|
||||
export function readdir(path: string, callback?: (err: ErrnoException, files: string[]) => void): void;
|
||||
export function readdirSync(path: string): string[];
|
||||
export function close(fd: number, callback?: Function): void;
|
||||
export function close(fd: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function closeSync(fd: number): void;
|
||||
export function open(path: string, flags: string, callback?: (err: Error, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, mode: number, callback?: (err: Error, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, mode: string, callback?: (err: Error, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, callback?: (err: ErrnoException, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, mode: number, callback?: (err: ErrnoException, fd: number) => any): void;
|
||||
export function open(path: string, flags: string, mode: string, callback?: (err: ErrnoException, fd: number) => any): void;
|
||||
export function openSync(path: string, flags: string, mode?: number): number;
|
||||
export function openSync(path: string, flags: string, mode?: string): number;
|
||||
export function utimes(path: string, atime: number, mtime: number, callback?: Function): void;
|
||||
export function utimes(path: string, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function utimesSync(path: string, atime: number, mtime: number): void;
|
||||
export function futimes(fd: number, atime: number, mtime: number, callback?: Function): void;
|
||||
export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function futimesSync(fd: number, atime: number, mtime: number): void;
|
||||
export function fsync(fd: number, callback?: Function): void;
|
||||
export function fsync(fd: number, callback?: (err?: ErrnoException) => void): void;
|
||||
export function fsyncSync(fd: number): void;
|
||||
export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void;
|
||||
export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, written: number, buffer: NodeBuffer) => void): void;
|
||||
export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
|
||||
export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void;
|
||||
export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, bytesRead: number, buffer: NodeBuffer) => void): void;
|
||||
export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
|
||||
export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: Error, data: any) => void): void;
|
||||
export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void ): void;
|
||||
export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: ErrnoException, data: any) => void): void;
|
||||
export function readFile(filename: string, callback: (err: ErrnoException, data: NodeBuffer) => void ): void;
|
||||
export function readFileSync(filename: string, options?: { flag?: string; }): NodeBuffer;
|
||||
export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string;
|
||||
export function writeFile(filename: string, data: any, callback?: (err: Error) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: Error) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: Error) => void): void;
|
||||
export function writeFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void;
|
||||
export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: Error) => void): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: Error) => void): void;
|
||||
export function appendFile(filename: string, data: any, callback?: (err: Error) => void): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void;
|
||||
export function appendFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void;
|
||||
export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;
|
||||
|
||||
@@ -14,8 +14,8 @@ module Test {
|
||||
namespace: "global",
|
||||
defaultLayout: "slideout",
|
||||
navigation: [
|
||||
{ title: "Home", action: "#home" },
|
||||
{ title: "About", action: "#about" }
|
||||
{ id: "first", title: "Home", action: "#home" },
|
||||
{ id: "second", title: "About", action: "#about" }
|
||||
]
|
||||
});
|
||||
application.router.register(":view/:id", { view: "home", id: undefined });
|
||||
|
||||
Vendored
+17
-32
@@ -208,7 +208,7 @@ declare module DevExpress.data {
|
||||
}
|
||||
export interface StoreOptions {
|
||||
key?: any;
|
||||
errorHandler: ErrorHandler;
|
||||
errorHandler?: ErrorHandler;
|
||||
loaded?: JQueryCallback;
|
||||
loading?: JQueryCallback;
|
||||
modified?: JQueryCallback;
|
||||
@@ -294,14 +294,6 @@ declare module DevExpress.data {
|
||||
export class ODataStore extends Store {
|
||||
constructor(options?: ODataStoreOptions);
|
||||
}
|
||||
interface IODataContextBase {
|
||||
get(operationName: string, params: { [key: string]: any }): JQueryDeferred<Array<any>>;
|
||||
invoke(operationName: string, params: { [key: string]: any }, httpMethod?: string): JQueryDeferred<Array<any>>;
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; }
|
||||
}
|
||||
interface IODataContext extends IODataContextBase {
|
||||
[entitySetName: string]: Store;
|
||||
}
|
||||
export interface ODataContextOptions {
|
||||
url: string;
|
||||
jsonp?: boolean;
|
||||
@@ -310,24 +302,18 @@ declare module DevExpress.data {
|
||||
beforeSend?: () => any;
|
||||
entities?: Array<any>;
|
||||
}
|
||||
export class ODataContext implements IODataContextBase {
|
||||
export class ODataContext {
|
||||
constructor(options?: ODataContextOptions);
|
||||
get(operationName: string, params: { [key: string]: any }): JQueryDeferred<Array<any>>;
|
||||
invoke(operationName: string, params: { [key: string]: any }, httpMethod?: string): JQueryDeferred<Array<any>>;
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; }
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; };
|
||||
}
|
||||
}
|
||||
declare module DevExpress.framework {
|
||||
interface NavigationItem {
|
||||
title: string;
|
||||
icon?: string;
|
||||
root?: boolean;
|
||||
action: any;
|
||||
}
|
||||
export interface dxViewOptions {
|
||||
name: string;
|
||||
title: string;
|
||||
layout: string;
|
||||
title?: string;
|
||||
layout?: string;
|
||||
}
|
||||
export class dxView extends ui.Component {
|
||||
constructor(options?: dxViewOptions);
|
||||
@@ -365,19 +351,19 @@ declare module DevExpress.framework {
|
||||
export class dxContent extends ui.Component {
|
||||
constructor(options?: dxLayoutOptions);
|
||||
}
|
||||
export interface CommandOptions extends ui.ComponentOptions {
|
||||
export interface dxCommandOptions extends ui.ComponentOptions {
|
||||
id: string;
|
||||
action: any;
|
||||
icon: string;
|
||||
title: string;
|
||||
iconSrc: string;
|
||||
visible: boolean;
|
||||
action?: any;
|
||||
icon?: string;
|
||||
title?: string;
|
||||
iconSrc?: string;
|
||||
visible?: boolean;
|
||||
}
|
||||
export class dxCommand extends ui.Component {
|
||||
public beforeExecute: JQueryCallback;
|
||||
public afterExecute: JQueryCallback;
|
||||
constructor(element: JQuery, options?: CommandOptions);
|
||||
constructor(element: Element, options?: CommandOptions);
|
||||
constructor(element: JQuery, options?: dxCommandOptions);
|
||||
constructor(element: Element, options?: dxCommandOptions);
|
||||
execute(): void;
|
||||
}
|
||||
export class dxCommandContainer extends ui.Component {
|
||||
@@ -543,7 +529,7 @@ declare module DevExpress.framework {
|
||||
disableViewCache?: boolean;
|
||||
stateManager?: StateManager;
|
||||
navigationManager?: NavigationManager;
|
||||
navigation?: NavigationItem[];
|
||||
navigation?: dxCommandOptions[];
|
||||
commandMapping?: CommandMap;
|
||||
}
|
||||
export class Application {
|
||||
@@ -552,7 +538,7 @@ declare module DevExpress.framework {
|
||||
public components: any[];
|
||||
public stateManager: StateManager;
|
||||
public commandMapping: CommandMap;
|
||||
public navigation: NavigationItem[];
|
||||
public navigation: dxCommand[];
|
||||
public navigationManager: NavigationManager;
|
||||
public beforeViewSetup: JQueryCallback;
|
||||
public afterViewSetup: JQueryCallback;
|
||||
@@ -669,7 +655,7 @@ declare module DevExpress.framework.html {
|
||||
}
|
||||
export interface HtmlApplicationBaseOptions extends framework.ApplicationOptions {
|
||||
device?: devices.Device;
|
||||
defaultLayout?: string;
|
||||
navigationType?: string;
|
||||
}
|
||||
export class HtmlApplicationBase extends framework.Application {
|
||||
public viewRendered: JQueryCallback;
|
||||
@@ -685,7 +671,6 @@ declare module DevExpress.framework.html {
|
||||
}
|
||||
export class HtmlApplication extends HtmlApplicationBase {
|
||||
public viewEngine: ViewEngineBase;
|
||||
public blankViewRendered: JQueryCallback;
|
||||
constructor(options?: HtmlApplicationOptions);
|
||||
}
|
||||
}
|
||||
@@ -904,7 +889,7 @@ declare module DevExpress.ui {
|
||||
autoPagingEnabled?: boolean;
|
||||
scrollingEnabled?: boolean;
|
||||
showScrollbar?: boolean;
|
||||
useNative?: boolean;
|
||||
useNativeScrolling?: boolean;
|
||||
grouped?: boolean;
|
||||
editEnabled?: boolean;
|
||||
showNextButton?: boolean;
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
///<reference path="promptly.d.ts"/>
|
||||
|
||||
import promptly = require('promptly');
|
||||
|
||||
process.stdin
|
||||
|
||||
// Options
|
||||
var options: promptly.Options = {}
|
||||
options = {
|
||||
default: 'value'
|
||||
}
|
||||
options = {
|
||||
trim: false
|
||||
}
|
||||
options = {
|
||||
retry: false
|
||||
}
|
||||
options = {
|
||||
silent: false
|
||||
}
|
||||
options = {
|
||||
input: process.stdin
|
||||
}
|
||||
options = {
|
||||
output: process.stdout
|
||||
}
|
||||
|
||||
// Validator
|
||||
options = {
|
||||
validator: () => {}
|
||||
}
|
||||
options = {
|
||||
validator: (value: string) => {}
|
||||
}
|
||||
options = {
|
||||
validator: (value: string) => {
|
||||
return 'result';
|
||||
}
|
||||
}
|
||||
options = {
|
||||
validator: [
|
||||
(value: string) => { return 'result' },
|
||||
(value: string) => { return 'result' }
|
||||
]
|
||||
}
|
||||
|
||||
// Prompt
|
||||
promptly.prompt('hello world');
|
||||
promptly.prompt('hello world', options);
|
||||
promptly.prompt('hello world', () => {
|
||||
|
||||
});
|
||||
promptly.prompt('hello world', options, (err: Error, value: string) => {
|
||||
|
||||
});
|
||||
|
||||
// Password
|
||||
promptly.password('hello world');
|
||||
promptly.password('hello world', options);
|
||||
promptly.password('hello world', () => {
|
||||
|
||||
});
|
||||
promptly.password('hello world', options, (err: Error, value: string) => {
|
||||
|
||||
});
|
||||
|
||||
// Confirm
|
||||
promptly.confirm('hello world');
|
||||
promptly.confirm('hello world', options);
|
||||
promptly.confirm('hello world', () => {
|
||||
|
||||
});
|
||||
promptly.confirm('hello world', options, (err: Error, value: string) => {
|
||||
|
||||
});
|
||||
|
||||
// Choose
|
||||
promptly.choose('hello world', ['test1', 'test2']);
|
||||
promptly.choose('hello world', ['test1', 'test2'], options);
|
||||
promptly.choose('hello world', ['test1', 'test2'], () => {
|
||||
|
||||
});
|
||||
promptly.choose('hello world', ['test1', 'test2'], options, (err: Error, value: string) => {
|
||||
|
||||
});
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for node-promptly 1.1.1
|
||||
// Project: https://github.com/IndigoUnited/node-promptly
|
||||
// Definitions by: Dan Spencer <https://github.com/danrspencer>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "promptly" {
|
||||
|
||||
interface Callback {
|
||||
(err: Error, value: string): void;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
default?: string;
|
||||
trim?: boolean;
|
||||
validator?: any;
|
||||
retry?: boolean;
|
||||
silent?: boolean;
|
||||
input?: ReadableStream;
|
||||
output?: WritableStream;
|
||||
}
|
||||
|
||||
export function prompt(message: string, fn?: Callback):any;
|
||||
export function prompt(message: string, opts: Options, fn?: Callback):any;
|
||||
|
||||
export function password(message: string, fn?: Callback):any;
|
||||
export function password(message: string, opts: Options, fn?: Callback):any;
|
||||
|
||||
export function confirm(message: string, fn?: Callback):any;
|
||||
export function confirm(message: string, opts: Options, fn?: Callback):any;
|
||||
|
||||
export function choose(message: string, choices: string[], fn?: Callback):any;
|
||||
export function choose(message: string, choices: string[], opts: Options, fn?: Callback):any;
|
||||
|
||||
}
|
||||
Vendored
+58
-58
@@ -175,13 +175,13 @@ interface QUnitAssert {
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
deepEqual(actual: any, expected: any, message?: string);
|
||||
deepEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A non-strict comparison assertion, roughly equivalent to JUnit assertEquals.
|
||||
*
|
||||
* The equal assertion uses the simple comparison operator (==) to compare the actual
|
||||
* and expected arguments. When they are equal, the assertion passes; otherwise, it fails.
|
||||
* and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails.
|
||||
* When it fails, both actual and expected values are displayed in the test result,
|
||||
* in addition to a given message.
|
||||
*
|
||||
@@ -189,7 +189,7 @@ interface QUnitAssert {
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
equal(actual: any, expected: any, message?: string);
|
||||
equal(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* An inverted deep recursive comparison assertion, working on primitive types,
|
||||
@@ -203,13 +203,13 @@ interface QUnitAssert {
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
notDeepEqual(actual: any, expected: any, message?: string);
|
||||
notDeepEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A non-strict comparison assertion, checking for inequality.
|
||||
*
|
||||
* The notEqual assertion uses the simple inverted comparison operator (!=) to compare
|
||||
* the actual and expected arguments. When they aren't equal, the assertion passes;
|
||||
* the actual and expected arguments. When they aren't equal, the assertion passes: any;
|
||||
* otherwise, it fails. When it fails, both actual and expected values are displayed
|
||||
* in the test result, in addition to a given message.
|
||||
*
|
||||
@@ -217,25 +217,25 @@ interface QUnitAssert {
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
notEqual(actual: any, expected: any, message?: string);
|
||||
notEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
notPropEqual(actual: any, expected: any, message?: string);
|
||||
notPropEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
propEqual(actual: any, expected: any, message?: string);
|
||||
propEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A non-strict comparison assertion, checking for inequality.
|
||||
*
|
||||
* The notStrictEqual assertion uses the strict inverted comparison operator (!==)
|
||||
* to compare the actual and expected arguments. When they aren't equal, the assertion
|
||||
* passes; otherwise, it fails. When it fails, both actual and expected values are
|
||||
* passes: any; otherwise, it fails. When it fails, both actual and expected values are
|
||||
* displayed in the test result, in addition to a given message.
|
||||
*
|
||||
* @param actual Expression being tested
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
notStrictEqual(actual: any, expected: any, message?: string);
|
||||
notStrictEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A boolean assertion, equivalent to CommonJS’s assert.ok() and JUnit’s assertTrue().
|
||||
@@ -248,7 +248,7 @@ interface QUnitAssert {
|
||||
* @param state Expression being tested
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
ok(state: any, message?: string);
|
||||
ok(state: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A strict type and value comparison assertion.
|
||||
@@ -260,7 +260,7 @@ interface QUnitAssert {
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
strictEqual(actual: any, expected: any, message?: string);
|
||||
strictEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* Assertion to test if a callback throws an exception when run.
|
||||
@@ -272,13 +272,13 @@ interface QUnitAssert {
|
||||
* @param expected Error Object to compare
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
throws(block: () => any, expected: any, message?: string);
|
||||
throws(block: () => any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* @param block Function to execute
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
throws(block: () => any, message?: string);
|
||||
throws(block: () => any, message?: string): any;
|
||||
}
|
||||
|
||||
interface QUnitStatic extends QUnitAssert{
|
||||
@@ -291,7 +291,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
*
|
||||
* @param decrement Optional argument to merge multiple start() calls into one. Use with multiple corrsponding stop() calls.
|
||||
*/
|
||||
start(decrement?: number);
|
||||
start(decrement?: number): any;
|
||||
|
||||
/**
|
||||
* Stop the testrunner to wait for async tests to run. Call start() to continue.
|
||||
@@ -302,7 +302,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
*
|
||||
* @param decrement Optional argument to merge multiple stop() calls into one. Use with multiple corrsponding start() calls.
|
||||
*/
|
||||
stop(increment? : number);
|
||||
stop(increment? : number): any;
|
||||
|
||||
/* CALLBACKS */
|
||||
|
||||
@@ -314,14 +314,14 @@ interface QUnitStatic extends QUnitAssert{
|
||||
*
|
||||
* @param callback Callback to execute
|
||||
*/
|
||||
begin(callback: () => any);
|
||||
begin(callback: () => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever the test suite ends.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
done(callback: (details: DoneCallbackObject) => any);
|
||||
done(callback: (details: DoneCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever an assertion completes.
|
||||
@@ -331,35 +331,35 @@ interface QUnitStatic extends QUnitAssert{
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
log(callback: (details: LogCallbackObject) => any);
|
||||
log(callback: (details: LogCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a module ends.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
moduleDone(callback: (details: ModuleDoneCallbackObject) => any);
|
||||
moduleDone(callback: (details: ModuleDoneCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a module begins.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
moduleStart(callback: (details: ModuleStartCallbackObject) => any);
|
||||
moduleStart(callback: (details: ModuleStartCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a test ends.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
testDone(callback: (details: TestDoneCallbackObject) => any);
|
||||
testDone(callback: (details: TestDoneCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a test begins.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
testStart(callback: (details: TestStartCallbackObject) => any);
|
||||
testStart(callback: (details: TestStartCallbackObject) => any): any;
|
||||
|
||||
/* CONFIGURATION */
|
||||
|
||||
@@ -381,7 +381,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
* @param expected Number of assertions in this test
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
asyncTest(name: string, expected: number, test: () => any);
|
||||
asyncTest(name: string, expected: number, test: () => any): any;
|
||||
|
||||
/**
|
||||
* Add an asynchronous test to run. The test must include a call to start().
|
||||
@@ -392,7 +392,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
* @param name Title of unit being tested
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
asyncTest(name: string, test: () => any);
|
||||
asyncTest(name: string, test: () => any): any;
|
||||
|
||||
/**
|
||||
* Specify how many assertions are expected to run within a test.
|
||||
@@ -403,7 +403,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
*
|
||||
* @param amount Number of assertions in this test.
|
||||
*/
|
||||
expect(amount: number);
|
||||
expect(amount: number): any;
|
||||
|
||||
/**
|
||||
* Group related tests under a single label.
|
||||
@@ -415,7 +415,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
* @param name Label for this group of tests
|
||||
* @param lifecycle Callbacks to run before and after each test
|
||||
*/
|
||||
module(name: string, lifecycle?: LifecycleObject);
|
||||
module(name: string, lifecycle?: LifecycleObject): any;
|
||||
|
||||
/**
|
||||
* Add a test to run.
|
||||
@@ -429,18 +429,18 @@ interface QUnitStatic extends QUnitAssert{
|
||||
* @param expected Number of assertions in this test
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
test(title: string, expected: number, test: (assert: QUnitAssert) => any);
|
||||
test(title: string, expected: number, test: (assert: QUnitAssert) => any): any;
|
||||
|
||||
/**
|
||||
* @param title Title of unit being tested
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
test(title: string, test: (assert: QUnitAssert) => any);
|
||||
test(title: string, test: (assert: QUnitAssert) => any): any;
|
||||
|
||||
/**
|
||||
* https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L1568
|
||||
*/
|
||||
equiv(a: any, b: any);
|
||||
equiv(a: any, b: any): any;
|
||||
|
||||
// https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L661
|
||||
raises: any;
|
||||
@@ -448,7 +448,7 @@ interface QUnitStatic extends QUnitAssert{
|
||||
/**
|
||||
* https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L897
|
||||
*/
|
||||
push(result, actual, expected, message): any;
|
||||
push(result: any, actual: any, expected: any, message: string): any;
|
||||
|
||||
/**
|
||||
* https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L839
|
||||
@@ -470,13 +470,13 @@ interface QUnitStatic extends QUnitAssert{
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function deepEqual(actual: any, expected: any, message?: string);
|
||||
declare function deepEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A non-strict comparison assertion, roughly equivalent to JUnit assertEquals.
|
||||
*
|
||||
* The equal assertion uses the simple comparison operator (==) to compare the actual
|
||||
* and expected arguments. When they are equal, the assertion passes; otherwise, it fails.
|
||||
* and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails.
|
||||
* When it fails, both actual and expected values are displayed in the test result,
|
||||
* in addition to a given message.
|
||||
*
|
||||
@@ -484,7 +484,7 @@ declare function deepEqual(actual: any, expected: any, message?: string);
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function equal(actual: any, expected: any, message?: string);
|
||||
declare function equal(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* An inverted deep recursive comparison assertion, working on primitive types,
|
||||
@@ -498,7 +498,7 @@ declare function equal(actual: any, expected: any, message?: string);
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function notDeepEqual(actual: any, expected: any, message?: string);
|
||||
declare function notDeepEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A non-strict comparison assertion, checking for inequality.
|
||||
@@ -512,7 +512,7 @@ declare function notDeepEqual(actual: any, expected: any, message?: string);
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function notEqual(actual: any, expected: any, message?: string);
|
||||
declare function notEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A non-strict comparison assertion, checking for inequality.
|
||||
@@ -526,7 +526,7 @@ declare function notEqual(actual: any, expected: any, message?: string);
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function notStrictEqual(actual: any, expected: any, message?: string);
|
||||
declare function notStrictEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A boolean assertion, equivalent to CommonJS’s assert.ok() and JUnit’s assertTrue().
|
||||
@@ -539,7 +539,7 @@ declare function notStrictEqual(actual: any, expected: any, message?: string);
|
||||
* @param state Expression being tested
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function ok(state: any, message?: string);
|
||||
declare function ok(state: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* A strict type and value comparison assertion.
|
||||
@@ -551,7 +551,7 @@ declare function ok(state: any, message?: string);
|
||||
* @param expected Known comparison value
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function strictEqual(actual: any, expected: any, message?: string);
|
||||
declare function strictEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* Assertion to test if a callback throws an exception when run.
|
||||
@@ -563,13 +563,13 @@ declare function strictEqual(actual: any, expected: any, message?: string);
|
||||
* @param expected Error Object to compare
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function throws(block: () => any, expected: any, message?: string);
|
||||
declare function throws(block: () => any, expected: any, message?: string): any;
|
||||
|
||||
/**
|
||||
* @param block Function to execute
|
||||
* @param message A short description of the assertion
|
||||
*/
|
||||
declare function throws(block: () => any, message?: string);
|
||||
declare function throws(block: () => any, message?: string): any;
|
||||
|
||||
/* ASYNC CONTROL */
|
||||
|
||||
@@ -580,7 +580,7 @@ declare function throws(block: () => any, message?: string);
|
||||
*
|
||||
* @param decrement Optional argument to merge multiple start() calls into one. Use with multiple corrsponding stop() calls.
|
||||
*/
|
||||
declare function start(decrement?: number);
|
||||
declare function start(decrement?: number): any;
|
||||
|
||||
/**
|
||||
* Stop the testrunner to wait for async tests to run. Call start() to continue.
|
||||
@@ -591,7 +591,7 @@ declare function start(decrement?: number);
|
||||
*
|
||||
* @param decrement Optional argument to merge multiple stop() calls into one. Use with multiple corrsponding start() calls.
|
||||
*/
|
||||
declare function stop(increment? : number);
|
||||
declare function stop(increment? : number): any;
|
||||
|
||||
/* CALLBACKS */
|
||||
|
||||
@@ -603,14 +603,14 @@ declare function stop(increment? : number);
|
||||
*
|
||||
* @param callback Callback to execute
|
||||
*/
|
||||
declare function begin(callback: () => any);
|
||||
declare function begin(callback: () => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever the test suite ends.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
declare function done(callback: (details: DoneCallbackObject) => any);
|
||||
declare function done(callback: (details: DoneCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever an assertion completes.
|
||||
@@ -620,35 +620,35 @@ declare function done(callback: (details: DoneCallbackObject) => any);
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
declare function log(callback: (details: LogCallbackObject) => any);
|
||||
declare function log(callback: (details: LogCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a module ends.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
declare function moduleDone(callback: (details: ModuleDoneCallbackObject) => any);
|
||||
declare function moduleDone(callback: (details: ModuleDoneCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a module begins.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
declare function moduleStart(callback: (name: string) => any);
|
||||
declare function moduleStart(callback: (name: string) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a test ends.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
declare function testDone(callback: (details: TestDoneCallbackObject) => any);
|
||||
declare function testDone(callback: (details: TestDoneCallbackObject) => any): any;
|
||||
|
||||
/**
|
||||
* Register a callback to fire whenever a test begins.
|
||||
*
|
||||
* @param callback Callback to execute.
|
||||
*/
|
||||
declare function testStart(callback: (details: TestStartCallbackObject) => any);
|
||||
declare function testStart(callback: (details: TestStartCallbackObject) => any): any;
|
||||
|
||||
/* TEST */
|
||||
|
||||
@@ -662,7 +662,7 @@ declare function testStart(callback: (details: TestStartCallbackObject) => any);
|
||||
* @param expected Number of assertions in this test
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
declare function asyncTest(name: string, expected?: any, test?: () => any);
|
||||
declare function asyncTest(name: string, expected?: any, test?: () => any): any;
|
||||
|
||||
/**
|
||||
* Add an asynchronous test to run. The test must include a call to start().
|
||||
@@ -673,7 +673,7 @@ declare function asyncTest(name: string, expected?: any, test?: () => any);
|
||||
* @param name Title of unit being tested
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
declare function asyncTest(name: string, test: () => any);
|
||||
declare function asyncTest(name: string, test: () => any): any;
|
||||
|
||||
/**
|
||||
* Specify how many assertions are expected to run within a test.
|
||||
@@ -684,7 +684,7 @@ declare function asyncTest(name: string, test: () => any);
|
||||
*
|
||||
* @param amount Number of assertions in this test.
|
||||
*/
|
||||
declare function expect(amount: number);
|
||||
declare function expect(amount: number): any;
|
||||
|
||||
// ** conflict with TypeScript module keyword. Must be used on QUnit namespace
|
||||
//declare var module: (name: string, lifecycle?: LifecycleObject) => any;
|
||||
@@ -701,20 +701,20 @@ declare function expect(amount: number);
|
||||
* @param expected Number of assertions in this test
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
declare function test(title: string, expected: number, test: (assert?: QUnitAssert) => any);
|
||||
declare function test(title: string, expected: number, test: (assert?: QUnitAssert) => any): any;
|
||||
|
||||
/**
|
||||
* @param title Title of unit being tested
|
||||
* @param test Function to close over assertions
|
||||
*/
|
||||
declare function test(title: string, test: (assert?: QUnitAssert) => any);
|
||||
declare function test(title: string, test: (assert?: QUnitAssert) => any): any;
|
||||
|
||||
declare function notPropEqual(actual: any, expected: any, message?: string);
|
||||
declare function notPropEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
declare function propEqual(actual: any, expected: any, message?: string);
|
||||
declare function propEqual(actual: any, expected: any, message?: string): any;
|
||||
|
||||
// https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L1568
|
||||
declare function equiv(a: any, b: any);
|
||||
declare function equiv(a: any, b: any): any;
|
||||
|
||||
// https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L661
|
||||
declare var raises: any;
|
||||
|
||||
Vendored
+2
-2
@@ -290,7 +290,7 @@ interface RequireDefine {
|
||||
* callback param deps module dependencies
|
||||
* callback return module definition
|
||||
**/
|
||||
(deps: string[], ready: (...deps: any[]) => any): void;
|
||||
(deps: string[], ready: Function): void;
|
||||
|
||||
/**
|
||||
* Define module with simplified CommonJS wrapper.
|
||||
@@ -310,7 +310,7 @@ interface RequireDefine {
|
||||
* callback deps module dependencies
|
||||
* callback return module definition
|
||||
**/
|
||||
(name: string, deps: string[], ready: (...deps: any[]) => any): void;
|
||||
(name: string, deps: string[], ready: Function): void;
|
||||
}
|
||||
|
||||
// Ambient declarations for 'require' and 'define'
|
||||
|
||||
Vendored
+26
-20
@@ -43,11 +43,12 @@ interface Response {
|
||||
|
||||
interface Server {
|
||||
use: (... handler: any[]) => any;
|
||||
post: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any;
|
||||
put: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any;
|
||||
del: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any;
|
||||
get: (route: any, routeCallBack: (req: Request, res: Response, next: Function ) => any) => any;
|
||||
head: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any;
|
||||
post: (route: any, routeCallBack: RequestHadler) => any;
|
||||
patch: (route: any, routeCallBack: RequestHadler) => any;
|
||||
put: (route: any, routeCallBack: RequestHadler) => any;
|
||||
del: (route: any, routeCallBack: RequestHadler) => any;
|
||||
get: (route: any, routeCallBack: RequestHadler) => any;
|
||||
head: (route: any, routeCallBack: RequestHadler) => any;
|
||||
on: (event: string, callback: Function) => any;
|
||||
name: string;
|
||||
version: string;
|
||||
@@ -57,7 +58,7 @@ interface Server {
|
||||
address: () => addressInterface;
|
||||
listen: (... args: any[]) => any;
|
||||
close: (... args: any[]) => any;
|
||||
pre: (routeCallBack: (req: Request, res: Response, next: Function) => any) => any;
|
||||
pre: (routeCallBack: RequestHadler) => any;
|
||||
|
||||
}
|
||||
|
||||
@@ -115,13 +116,17 @@ interface ThrottleOptions {
|
||||
overrides?: Object;
|
||||
}
|
||||
|
||||
interface RequestHadler {
|
||||
(req: Request, res: Response, next: Function): any;
|
||||
}
|
||||
|
||||
declare module "restify" {
|
||||
export function createServer(options?: ServerOptions): Server;
|
||||
|
||||
export function createJsonClient(options?: ClientOptions): Client;
|
||||
export function createStringClient(options?: ClientOptions): Client;
|
||||
export function createClient(options?: ClientOptions): HttpClient;
|
||||
|
||||
|
||||
export class ConflictError { constructor(message?: any); }
|
||||
export class InvalidArguementError { constructor(message?: any); }
|
||||
export class RestError { constructor(message?: any); }
|
||||
@@ -140,18 +145,19 @@ declare module "restify" {
|
||||
export class ResourceNotFoundError { constructor(message: any); }
|
||||
export class WrongAcceptError { constructor(message: any); }
|
||||
|
||||
export function acceptParser(parser: any);
|
||||
export function authorizationParser();
|
||||
export function dateParser(skew?: number);
|
||||
export function queryParser(options?: Object);
|
||||
export function urlEncodedBodyParser(options?: Object);
|
||||
export function jsonp(options?: Object);
|
||||
export function gzipResponse(options?: Object);
|
||||
export function bodyParser(options?: Object);
|
||||
export function requestLogger(options?: Object);
|
||||
export function serveStatic(options?: Object);
|
||||
export function throttle(options?: ThrottleOptions);
|
||||
export function conditionalRequest(options?: Object);
|
||||
export function auditLogger(options?: Object);
|
||||
export function acceptParser(parser: any): RequestHadler;
|
||||
export function authorizationParser(): RequestHadler;
|
||||
export function dateParser(skew?: number): RequestHadler;
|
||||
export function queryParser(options?: Object): RequestHadler;
|
||||
export function urlEncodedBodyParser(options?: Object): RequestHadler[];
|
||||
export function jsonp(): RequestHadler;
|
||||
export function gzipResponse(options?: Object): RequestHadler;
|
||||
export function bodyParser(options?: Object): RequestHadler[];
|
||||
export function requestLogger(options?: Object): RequestHadler;
|
||||
export function serveStatic(options?: Object): RequestHadler;
|
||||
export function throttle(options?: ThrottleOptions): RequestHadler;
|
||||
export function conditionalRequest(): RequestHadler[];
|
||||
export function auditLogger(options?: Object): Function;
|
||||
export function fullResponse(): RequestHadler;
|
||||
export var defaultResponseHeaders : any;
|
||||
}
|
||||
|
||||
Vendored
+288
@@ -0,0 +1,288 @@
|
||||
// Type definitions for RxJS/Experimental
|
||||
// Project: https://github.com/Reactive-Extensions/RxJS/
|
||||
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="rx.js.d.ts"/>
|
||||
|
||||
declare module Rx {
|
||||
|
||||
interface IObservable<T> {
|
||||
/**
|
||||
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
|
||||
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
|
||||
*
|
||||
* @param selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
|
||||
* @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
||||
*/
|
||||
let<TResult>(selector: (source: IObservable<T>) => IObservable<TResult>): IObservable<TResult>;
|
||||
|
||||
/**
|
||||
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
|
||||
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
|
||||
*
|
||||
* @param selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
|
||||
* @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
||||
*/
|
||||
letBind<TResult>(selector: (source: IObservable<T>) => IObservable<TResult>): IObservable<TResult>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
doWhile(condition: () => boolean): IObservable<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.
|
||||
*/
|
||||
expand(selector: (item: T) => IObservable<T>, scheduler?: IScheduler): IObservable<T>;
|
||||
|
||||
/**
|
||||
* Runs two observable sequences in parallel and combines their last elemenets.
|
||||
*
|
||||
* @param second Second observable sequence.
|
||||
* @param resultSelector Result selector function to invoke with the last elements of both sequences.
|
||||
* @returns An observable sequence with the result of calling the selector function with the last elements of both input sequences.
|
||||
*/
|
||||
forkJoin<TSecond, TResult>(second: IObservable<TSecond>, resultSelector: (left: T, right: TSecond) => TResult): IObservable<TResult>;
|
||||
|
||||
/**
|
||||
* Comonadic bind operator.
|
||||
* @param selector A transform function to apply to each element.
|
||||
* @param [scheduler] Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
|
||||
* @returns An observable sequence which results from the comonadic bind operation.
|
||||
*/
|
||||
manySelect<TResult>(selector: (item: IObservable<T>, index: number, source: IObservable<T>) => TResult, scheduler?: IScheduler): IObservable<TResult>;
|
||||
}
|
||||
|
||||
interface Observable {
|
||||
/**
|
||||
* 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.
|
||||
* @param thenSource The observable sequence that will be run if the condition function returns true.
|
||||
* @param elseSource The observable sequence that will be run if the condition function returns false.
|
||||
* @returns An observable sequence which is either the thenSource or elseSource.
|
||||
*/
|
||||
if<T>(condition: () => boolean, thenSource: IObservable<T>, elseSource: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param thenSource The observable sequence that will be run if the condition function returns true.
|
||||
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
|
||||
* @returns An observable sequence which is either the thenSource or empty sequence.
|
||||
*/
|
||||
if<T>(condition: () => boolean, thenSource: IObservable<T>, scheduler?: IScheduler): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param thenSource The observable sequence that will be run if the condition function returns true.
|
||||
* @param elseSource The observable sequence that will be run if the condition function returns false.
|
||||
* @returns An observable sequence which is either the thenSource or elseSource.
|
||||
*/
|
||||
ifThen<T>(condition: () => boolean, thenSource: IObservable<T>, elseSource: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param thenSource The observable sequence that will be run if the condition function returns true.
|
||||
* @param scheduler Scheduler used to create Rx.Observabe.Empty.
|
||||
* @returns An observable sequence which is either the thenSource or empty sequence.
|
||||
*/
|
||||
ifThen<T>(condition: () => boolean, thenSource: IObservable<T>, scheduler?: IScheduler): IObservable<T>;
|
||||
|
||||
/**
|
||||
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
|
||||
* 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.
|
||||
*/
|
||||
for<T, TResult>(sources: T[], resultSelector: (item: T) => IObservable<TResult>): IObservable<TResult>;
|
||||
|
||||
/**
|
||||
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
|
||||
* 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.
|
||||
*/
|
||||
forIn<T, TResult>(sources: T[], resultSelector: (item: T) => IObservable<TResult>): IObservable<TResult>;
|
||||
|
||||
/**
|
||||
* Repeats source as long as condition holds emulating a while loop.
|
||||
* 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 that will be run if the condition function returns true.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
*/
|
||||
while<T>(condition: () => boolean, source: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* Repeats source as long as condition holds emulating a while loop.
|
||||
* 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 that will be run if the condition function returns true.
|
||||
* @returns An observable sequence which is repeated as long as the condition holds.
|
||||
*/
|
||||
whileDo<T>(condition: () => boolean, source: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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 that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
case<T>(selector: () => string, sources: { [key: string]: IObservable<T>; }, elseSource: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
case<T>(selector: () => string, sources: { [key: string]: IObservable<T>; }, scheduler?: IScheduler): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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 that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
case<T>(selector: () => number, sources: { [key: number]: IObservable<T>; }, elseSource: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
case<T>(selector: () => number, sources: { [key: number]: IObservable<T>; }, scheduler?: IScheduler): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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 that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
switchCase<T>(selector: () => string, sources: { [key: string]: IObservable<T>; }, elseSource: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
switchCase<T>(selector: () => string, sources: { [key: string]: IObservable<T>; }, scheduler?: IScheduler): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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 that will be run if the sources are not matched.
|
||||
*
|
||||
* @returns An observable sequence which is determined by a case statement.
|
||||
*/
|
||||
switchCase<T>(selector: () => number, sources: { [key: number]: IObservable<T>; }, elseSource: IObservable<T>): IObservable<T>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
switchCase<T>(selector: () => number, sources: { [key: number]: IObservable<T>; }, scheduler?: IScheduler): IObservable<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.
|
||||
* @returns An observable sequence with an array collecting the last elements of all the input sequences.
|
||||
*/
|
||||
forkJoin<T>(sources: IObservable<T>[]): IObservable<T[]>;
|
||||
|
||||
/**
|
||||
* Runs all observable sequences in parallel and collect their last elements.
|
||||
*
|
||||
* @example
|
||||
* res = Rx.Observable.forkJoin(obs1, obs2, ...);
|
||||
* @param args Source sequences.
|
||||
* @returns An observable sequence with an array collecting the last elements of all the input sequences.
|
||||
*/
|
||||
forkJoin<T>(...args: IObservable<T>[]): IObservable<T[]>;
|
||||
}
|
||||
}
|
||||
Vendored
+42741
File diff suppressed because it is too large
Load Diff
Vendored
+5869
-2443
File diff suppressed because it is too large
Load Diff
Vendored
+459
-6
@@ -1600,9 +1600,14 @@ declare module SP {
|
||||
constructor(clientObject: SP.ClientObject, propertyName: string, comparisonOperator: string, valueToCompare: any);
|
||||
constructor(clientObject: SP.ClientObject, propertyName: string, comparisonOperator: string, valueToCompare: any, allowAllActions: boolean);
|
||||
}
|
||||
export class ClientResult {
|
||||
get_value(): any;
|
||||
setValue(value: any): void;
|
||||
//export class ClientResult {
|
||||
// get_value(): any;
|
||||
// setValue(value: any): void;
|
||||
// constructor();
|
||||
//}
|
||||
export class ClientResult<T> {
|
||||
get_value(): T;
|
||||
setValue(value: T): void;
|
||||
constructor();
|
||||
}
|
||||
export class BooleanResult {
|
||||
@@ -1637,8 +1642,8 @@ declare module SP {
|
||||
get_value(): any;
|
||||
constructor();
|
||||
}
|
||||
export class ClientDictionaryResultHandler {
|
||||
constructor(dict: SP.ClientResult);
|
||||
export class ClientDictionaryResultHandler<T> {
|
||||
constructor(dict: SP.ClientResult<T>);
|
||||
}
|
||||
export class ClientUtility {
|
||||
static urlPathEncodeForXmlHttpRequest(url: string): string;
|
||||
@@ -6744,6 +6749,53 @@ declare module SP {
|
||||
}
|
||||
}
|
||||
|
||||
declare module SP {
|
||||
export module DocumentSet {
|
||||
export class DocumentSet extends ClientObject {
|
||||
static create(context: ClientContext, parentFolder: Folder, name: string, ctid: ContentTypeId): StringResult;
|
||||
}
|
||||
}
|
||||
|
||||
export module Video {
|
||||
export class EmbedCodeConfiguration extends ClientValueObject {
|
||||
public get_autoPlay(): boolean;
|
||||
public set_autoPlay(value: boolean): boolean;
|
||||
|
||||
public get_displayTitle(): boolean;
|
||||
public set_displayTitle(value: boolean): boolean;
|
||||
|
||||
public get_linkToOwnerProfilePage(): boolean;
|
||||
public set_linkToOwnerProfilePage(value: boolean): boolean;
|
||||
|
||||
public get_linkToVideoHomePage(): boolean;
|
||||
public set_linkToVideoHomePage(value: boolean): boolean;
|
||||
|
||||
public get_loop(): boolean;
|
||||
public set_loop(value: boolean): boolean;
|
||||
|
||||
public get_pixelHeight(): number;
|
||||
public set_pixelHeight(value: number): number;
|
||||
|
||||
public get_pixelWidth(): number;
|
||||
public set_pixelWidth(value: number): number;
|
||||
|
||||
public get_startTime(): number;
|
||||
public set_startTime(value: number): number;
|
||||
|
||||
public get_previewImagePath(): string;
|
||||
public set_previewImagePath(value: string): string;
|
||||
}
|
||||
|
||||
export class VideoSet extends DocumentSet.DocumentSet {
|
||||
static createVideo(context: ClientContext, parentFolder: Folder, name: string, ctid: ContentTypeId): StringResult;
|
||||
static uploadVideo(context: ClientContext, list: List, fileName: string, file: any[], overwriteIfExists: boolean, parentFolderPath: string): StringResult;
|
||||
static getEmbedCode(context: ClientContext, videoPath: string, properties: EmbedCodeConfiguration): StringResult;
|
||||
static migrateVideo(context: ClientContext, videoFile: File): SP.ListItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare module SP {
|
||||
export module UI {
|
||||
export module ApplicationPages {
|
||||
@@ -8013,7 +8065,7 @@ declare module SP.WorkflowServices {
|
||||
getDesignerActions(web: SP.Web): SP.StringResult;
|
||||
/** Returns an XML representation of a collection of XAML class signatures for workflow definitions.
|
||||
@param lastChanges Date time value representing the latest changes; class signatures older than this time are excluded from the result set. */
|
||||
getActivitySignatures(lastChanged: string): SP.ClientResult;
|
||||
getActivitySignatures(lastChanged: string): SP.ClientResult<any>;
|
||||
/** Saves a SharePoint workflow definition to the workflow store. */
|
||||
saveDefinition(definition: WorkflowDefinition): SP.GuidResult;
|
||||
/** Validates the specified activity against workflow definitions in the workflow store. */
|
||||
@@ -8231,6 +8283,407 @@ declare module SP.WorkflowServices {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare module SP {
|
||||
export module Publishing {
|
||||
export class PublishingWeb extends ClientObject {
|
||||
static getPublishingWeb(context: ClientContext, web: Web): PublishingWeb;
|
||||
|
||||
public get_web(): Web;
|
||||
public addPublishingPage(pageInformation: PublishingPageInformation): PublishingPage;
|
||||
}
|
||||
|
||||
export class PublishingPageInformation extends ClientValueObject {
|
||||
|
||||
public get_folder(): Folder;
|
||||
public set_folder(value: Folder): Folder;
|
||||
|
||||
public get_name(): string;
|
||||
public set_name(value: string): string;
|
||||
|
||||
public get_pageLayoutListItem(): ListItem;
|
||||
public set_pageLayoutListItem(value: ListItem): ListItem;
|
||||
}
|
||||
|
||||
export class PublishingPage extends ScheduledItem {
|
||||
static getPublishingPage(context: ClientContext, sourceListItem: ListItem): PublishingPage;
|
||||
public addFriendlyUrl(friendlyUrlSegment: string, editableParent: Navigation.NavigationTermSetItem, doAddToNavigation: boolean): StringResult;
|
||||
}
|
||||
|
||||
export class ScheduledItem extends ClientObject {
|
||||
public get_listItem(): ListItem;
|
||||
|
||||
public get_startDate(): Date;
|
||||
public set_startDate(value: Date): Date;
|
||||
|
||||
public get_endDate(): Date;
|
||||
public set_endDate(value: Date): Date;
|
||||
|
||||
public schedule(approvalComment: string): void;
|
||||
}
|
||||
|
||||
export class PublishingSite extends ClientObject {
|
||||
static createPageLayout(context: ClientContext, parameters: PageLayoutCreationInformation): void;
|
||||
}
|
||||
|
||||
export class PageLayoutCreationInformation extends ClientValueObject {
|
||||
public get_web(): Web;
|
||||
public set_web(value: Web): Web;
|
||||
|
||||
public get_associatedContentTypeId(): string;
|
||||
public set_associatedContentTypeId(value: string): string;
|
||||
|
||||
public get_masterPageUrl(): string;
|
||||
public set_masterPageUrl(value: string): string;
|
||||
|
||||
public get_newPageLayoutNameWithoutExtension(): string;
|
||||
public set_newPageLayoutNameWithoutExtension(value: string): string;
|
||||
|
||||
public get_newPageLayoutEditablePath(): string;
|
||||
public set_newPageLayoutEditablePath(value: string): string;
|
||||
}
|
||||
|
||||
export class SiteServicesAddins {
|
||||
static getSettings(context: ClientContext, addinId: Guid): AddinSettings;
|
||||
static setSettings(context: ClientContext, addin: AddinSettings): void;
|
||||
static deleteSettings(context: ClientContext, addinId: Guid): void;
|
||||
|
||||
static getPlugin(context: ClientContext, pluginName: string): AddinPlugin;
|
||||
static setPlugin(context: ClientContext, addin: AddinPlugin): void;
|
||||
static deletePlugin(context: ClientContext, pluginName: string): void;
|
||||
}
|
||||
|
||||
export class AddinSettings extends ClientObject {
|
||||
constructor(ctx: ClientContext, id: Guid);
|
||||
|
||||
public get_id(): Guid;
|
||||
|
||||
public get_title(): string;
|
||||
public set_title(value: string): string;
|
||||
|
||||
public get_description(): string;
|
||||
public set_description(value: string): string;
|
||||
|
||||
public get_enabled(): boolean;
|
||||
public set_enabled(value: boolean): boolean;
|
||||
|
||||
public get_namespace(): boolean;
|
||||
public set_namespace(value: boolean): boolean;
|
||||
|
||||
public get_headScript(): string;
|
||||
public set_headScript(value: string): string;
|
||||
|
||||
public get_htmlStartBody(): string;
|
||||
public set_htmlStartBody(value: string): string;
|
||||
|
||||
public get_htmlEndBody(): string;
|
||||
public set_htmlEndBody(value: string): string;
|
||||
|
||||
public get_metaTagPagePropertyMappings(): { [key: string]: string };
|
||||
public set_metaTagPagePropertyMappings(value: { [key: string]: string }): { [key: string]: string };
|
||||
|
||||
}
|
||||
|
||||
export class AddinPlugin extends ClientObject {
|
||||
constructor(ctx: ClientContext);
|
||||
|
||||
public get_description(): string;
|
||||
public set_description(value: string): string;
|
||||
|
||||
public get_markup(): string;
|
||||
public set_markup(value: string): string;
|
||||
|
||||
public get_title(): string;
|
||||
public set_title(value: string): string;
|
||||
}
|
||||
|
||||
|
||||
export class DesignPackage {
|
||||
static install(context: ClientContext, site: Site, info: DesignPackageInfo, path: string): void;
|
||||
static uninstall(context: ClientContext, site: Site, info: DesignPackageInfo): void;
|
||||
static apply(context: ClientContext, site: Site, info: DesignPackageInfo): void;
|
||||
static exportEnterprise(context: ClientContext, site: Site, includeSearchConfiguration: boolean): ClientResult<DesignPackageInfo>;
|
||||
static exportSmallBusiness(context: ClientContext, site: Site, packageName: string, includeSearchConfiguration: boolean): ClientResult<DesignPackageInfo>;
|
||||
}
|
||||
|
||||
export class DesignPackageInfo extends ClientValueObject {
|
||||
public get_packageName(): string;
|
||||
public set_packageName(value: string): string;
|
||||
|
||||
public get_packageGuid(): Guid;
|
||||
public set_packageGuid(value: Guid): Guid;
|
||||
|
||||
public get_majorVersion(): number;
|
||||
public set_majorVersion(value: number): number;
|
||||
|
||||
public get_minorVersion(): number;
|
||||
public set_minorVersion(value: number): number;
|
||||
}
|
||||
|
||||
export class SiteImageRenditions {
|
||||
static getRenditions(context: ClientContext): ImageRendition[];
|
||||
static setRenditions(context: ClientContext, renditions: ImageRendition[]): void;
|
||||
}
|
||||
|
||||
export class ImageRendition extends ClientValueObject {
|
||||
public get_id(): number;
|
||||
public get_version(): number;
|
||||
|
||||
public get_name(): string;
|
||||
public set_name(value: string): string;
|
||||
|
||||
public get_width(): number;
|
||||
public set_width(value: number): number;
|
||||
|
||||
public get_height(): number;
|
||||
public set_height(value: number): number;
|
||||
}
|
||||
|
||||
export class Variations extends ClientObject {
|
||||
static getLabels(context: ClientContext): ClientObjectList<VariationLabel>;
|
||||
static getPeerUrl(context: ClientContext, currentUrl: string, labelTitle: string): StringResult;
|
||||
static updateListItems(context: ClientContext, listId: Guid, itemIds: number[]): void;
|
||||
}
|
||||
|
||||
export class VariationLabel extends ClientObject {
|
||||
public get_displayName(): string;
|
||||
public set_displayName(value: string): string;
|
||||
|
||||
public get_isSource(): boolean;
|
||||
public set_isSource(value: boolean): boolean;
|
||||
|
||||
public get_language(): string;
|
||||
public set_language(value: string): string;
|
||||
|
||||
public get_locale(): string;
|
||||
public set_locale(value: string): string;
|
||||
|
||||
public get_title(): string;
|
||||
public set_title(value: string): string;
|
||||
|
||||
public get_topWebUrl(): string;
|
||||
public set_topWebUrl(value: string): string;
|
||||
}
|
||||
|
||||
export class CustomizableString extends ClientObject {
|
||||
public get_defaultValue(): string;
|
||||
|
||||
public get_value(): string;
|
||||
public set_value(value: string): string;
|
||||
|
||||
public get_usesDefaultValue(): boolean;
|
||||
public set_usesDefaultValue(value: boolean): boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
export module Navigation {
|
||||
export enum NavigationLinkType {
|
||||
root,
|
||||
friendlyUrl,
|
||||
simpleLink
|
||||
}
|
||||
|
||||
export enum StandardNavigationSource {
|
||||
unknown,
|
||||
portalProvider,
|
||||
taxonomyProvider,
|
||||
inheritFromParentWeb
|
||||
}
|
||||
|
||||
export class NavigationTermSetItem extends ClientObject {
|
||||
public get_id(): Guid;
|
||||
|
||||
public get_isReadOnly(): boolean;
|
||||
|
||||
public get_linkType(): NavigationLinkType;
|
||||
public set_linkType(value: NavigationLinkType): NavigationLinkType;
|
||||
|
||||
public get_targetUrlForChildTerms(): CustomizableString;
|
||||
|
||||
public get_catalogTargetUrlForChildTerms(): CustomizableString;
|
||||
|
||||
public get_taxonomyName(): string;
|
||||
|
||||
public get_title(): CustomizableString;
|
||||
|
||||
public get_terms(): NavigationTermCollection;
|
||||
|
||||
public get_view(): NavigationTermSetView;
|
||||
|
||||
public createTerm(termName: string, linkType: NavigationLinkType, termId: Guid);
|
||||
|
||||
public getTaxonomyTermStore(): Taxonomy.TermStore;
|
||||
|
||||
public getResolvedDisplayUrl(browserQueryString: string): StringResult;
|
||||
}
|
||||
|
||||
export class NavigationTermCollection extends ClientObjectCollection<NavigationTerm> {
|
||||
|
||||
}
|
||||
|
||||
export class NavigationTerm extends NavigationTermSetItem {
|
||||
public get_associatedFolderUrl(): string;
|
||||
public set_associatedFolderUrl(value: string): string;
|
||||
|
||||
public get_catalogTargetUrl(): CustomizableString;
|
||||
|
||||
public get_categoryImageUrl(): string;
|
||||
public set_categoryImageUrl(value: string): string;
|
||||
|
||||
public get_excludedProviders(): NavigationTermProviderNameCollection;
|
||||
|
||||
public get_excludeFromCurrentNavigation(): boolean;
|
||||
public set_excludeFromCurrentNavigation(value: boolean): boolean;
|
||||
|
||||
public get_excludeFromGlobalNavigation(): boolean;
|
||||
public set_excludeFromGlobalNavigation(value: boolean): boolean;
|
||||
|
||||
public get_friendlyUrlSegment(): CustomizableString;
|
||||
|
||||
public get_hoverText(): string;
|
||||
public set_hoverText(value: string): string;
|
||||
|
||||
public get_isDeprecated(): boolean;
|
||||
public get_isPinned(): boolean;
|
||||
public get_isPinnedRoot(): boolean;
|
||||
|
||||
public get_parent(): NavigationTerm;
|
||||
|
||||
public get_simpleLinkUrl(): string;
|
||||
|
||||
public set_simpleLinkUrl(value: string): string;
|
||||
|
||||
public get_targetUrl(): CustomizableString;
|
||||
|
||||
public get_termSet(): NavigationTermSet;
|
||||
|
||||
public getAsEditable(taxonomySession: Taxonomy.TaxonomySession): NavigationTerm;
|
||||
|
||||
public getWithNewView(newView: NavigationTermSetView): NavigationTerm;
|
||||
|
||||
public getResolvedTargetUrl(browserQueryString: string, remainingUrlSegments: string[]): StringResult;
|
||||
|
||||
public getResolvedTargetUrlWithoutQuery(): StringResult;
|
||||
|
||||
public getResolvedAssociatedFolderUrl(): StringResult;
|
||||
|
||||
public getWebRelativeFriendlyUrl(); StringResult;
|
||||
|
||||
public getAllParentTerms(): NavigationTermCollection;
|
||||
|
||||
public getTaxonomyTerm(): Taxonomy.Term;
|
||||
|
||||
public move(newParent: NavigationTermSetItem): void;
|
||||
|
||||
public deleteObject(): void;
|
||||
|
||||
static getAsResolvedByWeb(context: ClientContext, term: Taxonomy.Term, web: Web, siteMapProviderName: string): NavigationTerm;
|
||||
static getAsResolvedByView(context: ClientContext, term: Taxonomy.Term, view: NavigationTermSetView): NavigationTerm;
|
||||
}
|
||||
|
||||
|
||||
export class NavigationTermSet extends NavigationTermSetItem {
|
||||
public get_isNavigationTermSet(): boolean;
|
||||
public set_isNavigationTermSet(value: boolean): boolean;
|
||||
|
||||
public get_lcid(): number;
|
||||
|
||||
public get_loadedFromPersistedData(): boolean;
|
||||
|
||||
public get_termGroupId(): Guid;
|
||||
public get_termStoreId(): Guid;
|
||||
|
||||
public getAsEditable(taxonomySession: Taxonomy.TaxonomySession): NavigationTermSet;
|
||||
|
||||
public getWithNewView(newView: NavigationTermSetView): NavigationTermSet;
|
||||
|
||||
public getTaxonomyTermSet(): Taxonomy.TermSet;
|
||||
|
||||
public getAllTerms(): NavigationTermCollection;
|
||||
|
||||
public findTermForUrl(usr: string): NavigationTerm;
|
||||
|
||||
static getAsResolvedByWeb(context: ClientContext, termSet: Taxonomy.TermSet, web: Web, siteMapProviderName: string): NavigationTermSet;
|
||||
static getAsResolvedByView(context: ClientContext, termSet: Taxonomy.TermSet, view: NavigationTermSetView): NavigationTermSet;
|
||||
}
|
||||
|
||||
|
||||
export class NavigationTermProviderNameCollection extends ClientObjectCollection<string> {
|
||||
public Add(item: string): void;
|
||||
public Clear(): void;
|
||||
public Remove(item: string): BooleanResult;
|
||||
}
|
||||
|
||||
export class NavigationTermSetView extends ClientObject {
|
||||
constructor(context: ClientContext, web: Web, siteMapProviderName: string);
|
||||
|
||||
public get_excludeDeprecatedTerms(): boolean;
|
||||
public set_excludeDeprecatedTerms(value: boolean): boolean;
|
||||
|
||||
public get_excludeTermsByPermissions(): boolean;
|
||||
public set_excludeTermsByPermissions(value: boolean): boolean;
|
||||
|
||||
public get_excludeTermsByProvider(): boolean;
|
||||
public set_excludeTermsByProvider(value: boolean): boolean;
|
||||
|
||||
public get_serverRelativeSiteUrl(): string;
|
||||
|
||||
public get_serverRelativeWebUrl(): string;
|
||||
|
||||
public get_siteMapProviderName(): string;
|
||||
public set_siteMapProviderName(value: string): string;
|
||||
|
||||
public get_webId(): Guid;
|
||||
public get_webTitle(): string;
|
||||
|
||||
public getCopy(): NavigationTermSetView;
|
||||
|
||||
static createEmptyInstance(context: ClientContext): NavigationTermSetView;
|
||||
}
|
||||
|
||||
export class TaxonomyNavigation {
|
||||
static getWebNavigationSettings(context: ClientContext, web: Web): WebNavigationSettings;
|
||||
static getTermSetForWeb(context: ClientContext, web: Web, siteMapProviderName: string, includeInheritedSettings: boolean): NavigationTermSet;
|
||||
static setCrawlAsFriendlyUrlPage(context: ClientContext, navigationTerm, crawlAsFriendlyUrlPage): BooleanResult;
|
||||
static getNavigationLcidForWeb(context: ClientContext, web: Web): IntResult;
|
||||
static flushSiteFromCache(context: ClientContext, site: Site): void;
|
||||
static flushWebFromCache(context: ClientContext, web: Web): void;
|
||||
static flushTermSetFromCache(context: ClientContext, webForPermissions, termStoreId: Guid, termSetId: Guid): void;
|
||||
}
|
||||
|
||||
export class WebNavigationSettings extends ClientObject {
|
||||
constructor(context: ClientContext, web: Web);
|
||||
|
||||
public get_addNewPagesToNavigation(): boolean;
|
||||
public set_addNewPagesToNavigation(value: boolean): boolean;
|
||||
|
||||
public get_createFriendlyUrlsForNewPages(): boolean;
|
||||
public set_createFriendlyUrlsForNewPages(value: boolean): boolean;
|
||||
|
||||
public get_currentNavigation(): StandardNavigationSettings;
|
||||
public get_globalNavigation(): StandardNavigationSettings;
|
||||
|
||||
public update(taxonomySession: Taxonomy.TaxonomySession): void;
|
||||
public resetToDefaults(): void;
|
||||
}
|
||||
|
||||
export class StandardNavigationSettings extends ClientObject {
|
||||
public get_termSetId(): Guid;
|
||||
public set_termSetId(value: Guid): Guid;
|
||||
|
||||
public get_termStoreId(): Guid;
|
||||
public set_termStoreId(value: Guid): Guid;
|
||||
|
||||
public get_source(): StandardNavigationSource;
|
||||
|
||||
public set_source(value: StandardNavigationSource): StandardNavigationSource;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
declare class SPClientAutoFill {
|
||||
static MenuOptionType: {
|
||||
Option: number;
|
||||
|
||||
Vendored
+3
@@ -63,3 +63,6 @@ interface SocketManager {
|
||||
on(ns: string, fn: Function): SocketManager;
|
||||
sockets: SocketNamespace;
|
||||
}
|
||||
|
||||
// For client side usage declare io:
|
||||
declare var io:any;
|
||||
|
||||
Vendored
+1
-1
@@ -2707,7 +2707,7 @@ interface _Chain<T> {
|
||||
* Wrapped type `object`.
|
||||
* @see _.keys
|
||||
**/
|
||||
keys(): _Chain<T>;
|
||||
keys(): _Chain<string>;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
|
||||
Vendored
+181
-73
@@ -11,7 +11,52 @@ declare module "websocket" {
|
||||
import net = require('net');
|
||||
import url = require('url');
|
||||
|
||||
export interface IServerConfig {
|
||||
export interface IStringified {
|
||||
toString: (...args: any[]) => string;
|
||||
}
|
||||
|
||||
export interface IConfig {
|
||||
/**
|
||||
* The maximum allowed received frame size in bytes.
|
||||
* Single frame messages will also be limited to this maximum.
|
||||
*/
|
||||
maxReceivedFrameSize?: number;
|
||||
|
||||
/** The maximum allowed aggregate message size (for fragmented messages) in bytes */
|
||||
maxReceivedMessageSize?: number;
|
||||
|
||||
/**
|
||||
* Whether or not to fragment outgoing messages. If true, messages will be
|
||||
* automatically fragmented into chunks of up to `fragmentationThreshold` bytes.
|
||||
* @default true
|
||||
*/
|
||||
fragmentOutgoingMessages?: boolean;
|
||||
|
||||
/**
|
||||
* The maximum size of a frame in bytes before it is automatically fragmented.
|
||||
* @default 16KiB
|
||||
*/
|
||||
fragmentationThreshold?: number;
|
||||
|
||||
/**
|
||||
* If true, fragmented messages will be automatically assembled and the full
|
||||
* message will be emitted via a `message` event. If false, each frame will be
|
||||
* emitted on the `connection` object via a `frame` event and the application
|
||||
* will be responsible for aggregating multiple fragmented frames. Single-frame
|
||||
* messages will emit a `message` event in addition to the `frame` event.
|
||||
* @default true
|
||||
*/
|
||||
assembleFragments?: boolean;
|
||||
|
||||
/**
|
||||
* The number of milliseconds to wait after sending a close frame for an
|
||||
* `acknowledgement` to come back before giving up and just closing the socket.
|
||||
* @default 5000
|
||||
*/
|
||||
closeTimeout?: number;
|
||||
}
|
||||
|
||||
export interface IServerConfig extends IConfig {
|
||||
/** The http server instance to attach to */
|
||||
httpServer: http.Server;
|
||||
|
||||
@@ -28,19 +73,6 @@ declare module "websocket" {
|
||||
*/
|
||||
maxReceivedMessageSize?: number;
|
||||
|
||||
/**
|
||||
* Whether or not to fragment outgoing messages. If true, messages will be
|
||||
* automatically fragmented into chunks of up to `fragmentationThreshold` bytes.
|
||||
* @default true
|
||||
*/
|
||||
fragmentOutgoingMessages?: boolean;
|
||||
|
||||
/**
|
||||
* The maximum size of a frame in bytes before it is automatically fragmented.
|
||||
* @default 16KiB
|
||||
*/
|
||||
fragmentationThreshold?: number;
|
||||
|
||||
/**
|
||||
* If true, the server will automatically send a ping to all clients every
|
||||
* `keepaliveInterval` milliseconds. Each client has an independent `keepalive`
|
||||
@@ -72,16 +104,6 @@ declare module "websocket" {
|
||||
*/
|
||||
keepaliveGracePeriod?: number;
|
||||
|
||||
/**
|
||||
* If true, fragmented messages will be automatically assembled and the full
|
||||
* message will be emitted via a `message` event. If false, each frame will be
|
||||
* emitted on the `connection` object via a `frame` event and the application
|
||||
* will be responsible for aggregating multiple fragmented frames. Single-frame
|
||||
* messages will emit a `message` event in addition to the `frame` event.
|
||||
* @default true
|
||||
*/
|
||||
assembleFragments?: boolean;
|
||||
|
||||
/**
|
||||
* If this is true, websocket connections will be accepted regardless of the path
|
||||
* and protocol specified by the client. The protocol accepted will be the first
|
||||
@@ -90,13 +112,6 @@ declare module "websocket" {
|
||||
*/
|
||||
autoAcceptConnections?: boolean;
|
||||
|
||||
/**
|
||||
* The number of milliseconds to wait after sending a close frame for an
|
||||
* `acknowledgement` to come back before giving up and just closing the socket.
|
||||
* @default 5000
|
||||
*/
|
||||
closeTimeout?: number;
|
||||
|
||||
/**
|
||||
* The Nagle Algorithm makes more efficient use of network resources by introducing a
|
||||
* small delay before sending small packets so that multiple messages can be batched
|
||||
@@ -107,8 +122,19 @@ declare module "websocket" {
|
||||
}
|
||||
|
||||
export class server extends events.EventEmitter {
|
||||
config: IServerConfig;
|
||||
connections: connection[];
|
||||
|
||||
constructor(serverConfig?: IServerConfig);
|
||||
|
||||
/** Send binary message for each connection */
|
||||
broadcast(data: NodeBuffer): void;
|
||||
/** Send UTF-8 message for each connection */
|
||||
broadcast(data: IStringified): void;
|
||||
/** Send binary message for each connection */
|
||||
broadcastBytes(data: NodeBuffer): void;
|
||||
/** Send UTF-8 message for each connection */
|
||||
broadcastUTF(data: IStringified): void;
|
||||
/** Attach the `server` instance to a Node http.Server instance */
|
||||
mount(serverConfig: IServerConfig): void;
|
||||
|
||||
@@ -135,6 +161,22 @@ declare module "websocket" {
|
||||
addListener(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): server;
|
||||
}
|
||||
|
||||
export interface ICookie {
|
||||
name: string;
|
||||
value: string;
|
||||
path?: string;
|
||||
domain?: string;
|
||||
expires?: Date;
|
||||
maxage?: number;
|
||||
secure?: boolean;
|
||||
httponly?: boolean;
|
||||
}
|
||||
|
||||
export interface IExtension {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class request extends events.EventEmitter {
|
||||
/** A reference to the original Node HTTP request object */
|
||||
httpRequest: http.ClientRequest;
|
||||
@@ -142,6 +184,8 @@ declare module "websocket" {
|
||||
host: string;
|
||||
/** A string containing the path that was requested by the client */
|
||||
resource: string;
|
||||
/** `Sec-WebSocket-Key` */
|
||||
key: string;
|
||||
/** Parsed resource, including the query string parameters */
|
||||
resourceURL: url.Url;
|
||||
|
||||
@@ -163,6 +207,9 @@ declare module "websocket" {
|
||||
/** An array containing a list of extensions requested by the client */
|
||||
requestedExtensions: any[];
|
||||
|
||||
cookies: ICookie[];
|
||||
socket: net.NodeSocket;
|
||||
|
||||
/**
|
||||
* List of strings that indicate the subprotocols the client would like to speak.
|
||||
* The server should select the best one that it can support from the list and
|
||||
@@ -171,6 +218,7 @@ declare module "websocket" {
|
||||
* converted to lower case.
|
||||
*/
|
||||
requestedProtocols: string[];
|
||||
protocolFullCaseMap: {[key: string]: string};
|
||||
|
||||
constructor(socket: net.NodeSocket, httpRequest: http.ClientRequest, config: IServerConfig);
|
||||
|
||||
@@ -181,7 +229,7 @@ declare module "websocket" {
|
||||
*
|
||||
* @param [acceptedProtocol] case-insensitive value that was requested by the client
|
||||
*/
|
||||
accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: any[]): connection;
|
||||
accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection;
|
||||
|
||||
/**
|
||||
* Reject connection.
|
||||
@@ -206,6 +254,48 @@ declare module "websocket" {
|
||||
binaryData?: NodeBuffer;
|
||||
}
|
||||
|
||||
export interface IBufferList extends events.EventEmitter {
|
||||
encoding: string;
|
||||
length: number;
|
||||
write(buf: NodeBuffer): boolean;
|
||||
end(buf: NodeBuffer): void;
|
||||
|
||||
/**
|
||||
* For each buffer, perform some action.
|
||||
* If fn's result is a true value, cut out early.
|
||||
*/
|
||||
forEach(fn: (buf: NodeBuffer) => boolean): void;
|
||||
|
||||
/** Create a single buffer out of all the chunks */
|
||||
join(start: number, end: number): NodeBuffer;
|
||||
|
||||
/** Join all the chunks to existing buffer */
|
||||
joinInto(buf: NodeBuffer, offset: number, start: number, end: number): NodeBuffer;
|
||||
|
||||
/**
|
||||
* Advance the buffer stream by `n` bytes.
|
||||
* If `n` the aggregate advance offset passes the end of the buffer list,
|
||||
* operations such as `take` will return empty strings until enough data is pushed.
|
||||
*/
|
||||
advance(n: number): IBufferList;
|
||||
|
||||
/**
|
||||
* Take `n` bytes from the start of the buffers.
|
||||
* If there are less than `n` bytes in all the buffers or `n` is undefined,
|
||||
* returns the entire concatenated buffer string.
|
||||
*/
|
||||
take(n: number, encoding?: string): any;
|
||||
take(encoding?: string): any;
|
||||
|
||||
// Events
|
||||
on(event: string, listener: () => void): IBufferList;
|
||||
on(event: 'advance', cb: (n: number) => void): IBufferList;
|
||||
on(event: 'write', cb: (buf: NodeBuffer) => void): IBufferList;
|
||||
addListener(event: string, listener: () => void): IBufferList;
|
||||
addListener(event: 'advance', cb: (n: number) => void): IBufferList;
|
||||
addListener(event: 'write', cb: (buf: NodeBuffer) => void): IBufferList;
|
||||
}
|
||||
|
||||
class connection extends events.EventEmitter {
|
||||
static CLOSE_REASON_NORMAL: number;
|
||||
static CLOSE_REASON_GOING_AWAY: number;
|
||||
@@ -237,9 +327,26 @@ declare module "websocket" {
|
||||
*/
|
||||
protocol: string;
|
||||
|
||||
config: IConfig;
|
||||
socket: net.NodeSocket;
|
||||
maskOutgoingPackets: boolean;
|
||||
maskBytes: NodeBuffer;
|
||||
frameHeader: NodeBuffer;
|
||||
bufferList: IBufferList;
|
||||
currentFrame: frame;
|
||||
fragmentationSize: number;
|
||||
frameQueue: frame[];
|
||||
state: string;
|
||||
waitingForCloseResponse: boolean;
|
||||
closeTimeout: number;
|
||||
assembleFragments: number;
|
||||
maxReceivedMessageSize: number;
|
||||
outputPaused: boolean;
|
||||
bytesWaitingToFlush: number;
|
||||
socketHadError: boolean;
|
||||
|
||||
/** An array of extensions that were negotiated for this connection */
|
||||
extensions: any[];
|
||||
extensions: IExtension[];
|
||||
|
||||
/**
|
||||
* The IP address of the remote peer as a string. In the case of a server,
|
||||
@@ -254,8 +361,8 @@ declare module "websocket" {
|
||||
/** Whether or not the connection is still connected. Read-only */
|
||||
connected: boolean;
|
||||
|
||||
constructor(socket: net.NodeSocket, extensions: any[], protocol: string,
|
||||
maskOutgoingPackets: boolean, config: IServerConfig);
|
||||
constructor(socket: net.NodeSocket, extensions: IExtension[], protocol: string,
|
||||
maskOutgoingPackets: boolean, config: IConfig);
|
||||
|
||||
/**
|
||||
* Close the connection. A close frame will be sent to the remote peer indicating
|
||||
@@ -276,7 +383,7 @@ declare module "websocket" {
|
||||
* peer. If `config.fragmentOutgoingMessages` is true the message may be sent as
|
||||
* multiple fragments if it exceeds `config.fragmentationThreshold` bytes.
|
||||
*/
|
||||
sendUTF(data: {toString: (...args: any[]) => string}): void;
|
||||
sendUTF(data: IStringified): void;
|
||||
|
||||
/**
|
||||
* Immediately sends the specified Node Buffer object as a Binary WebSocket message
|
||||
@@ -287,11 +394,11 @@ declare module "websocket" {
|
||||
|
||||
/** Auto-detect the data type and send UTF-8 or Binary message */
|
||||
send(data: NodeBuffer): void;
|
||||
send(data: {toString: (...args: any[]) => string}): void;
|
||||
send(data: IStringified): void;
|
||||
|
||||
/** Sends a ping frame. Ping frames must not exceed 125 bytes in length. */
|
||||
ping(data: NodeBuffer): void;
|
||||
ping(data: {toString: (...args: any[]) => string}): void;
|
||||
ping(data: IStringified): void;
|
||||
|
||||
/**
|
||||
* Sends a pong frame. Pong frames may be sent unsolicited and such pong frames will
|
||||
@@ -310,6 +417,18 @@ declare module "websocket" {
|
||||
*/
|
||||
sendFrame(frame: frame): void;
|
||||
|
||||
/** Set or reset the `keepalive` timer when data is received */
|
||||
setKeepaliveTimer(): void;
|
||||
setGracePeriodTimer(): void;
|
||||
setCloseTimer(): void;
|
||||
clearCloseTimer(): void;
|
||||
processFrame(frame: frame): void;
|
||||
fragmentAndSend(frame: frame, cb?: (err: Error) => void): void;
|
||||
sendCloseFrame(reasonCode: number, reasonText: string, force: boolean): void;
|
||||
sendCloseFrame(): void;
|
||||
sendFrame(frame: frame, force: boolean, cb?: (msg: string) => void): void;
|
||||
sendFrame(frame: frame, cb?: (msg: string) => void): void;
|
||||
|
||||
// Events
|
||||
on(event: string, listener: () => void): connection;
|
||||
on(event: 'message', cb: (data: IMessage) => void): connection;
|
||||
@@ -376,9 +495,22 @@ declare module "websocket" {
|
||||
* Even text frames are sent with a Buffer providing the binary payload data.
|
||||
*/
|
||||
binaryPayload: NodeBuffer;
|
||||
|
||||
maskBytes: NodeBuffer;
|
||||
frameHeader: NodeBuffer;
|
||||
config: IConfig;
|
||||
maxReceivedFrameSize: number;
|
||||
protocolError: boolean;
|
||||
frameTooLarge: boolean;
|
||||
invalidCloseFrameLength: boolean;
|
||||
closeStatus: number;
|
||||
|
||||
addData(bufferList: IBufferList): boolean;
|
||||
throwAwayPayload(bufferList: IBufferList): boolean;
|
||||
toBuffer(nullMask: boolean): NodeBuffer;
|
||||
}
|
||||
|
||||
export interface IClientConfig {
|
||||
export interface IClientConfig extends IConfig {
|
||||
/**
|
||||
* Which version of the WebSocket protocol to use when making the connection.
|
||||
* Currently supported values are 8 and 13. This option will be removed once the
|
||||
@@ -387,54 +519,30 @@ declare module "websocket" {
|
||||
* the name of the Origin header.
|
||||
* @default 13
|
||||
*/
|
||||
webSocketVersion: number;
|
||||
webSocketVersion?: number;
|
||||
|
||||
/**
|
||||
* The maximum allowed received frame size in bytes.
|
||||
* Single frame messages will also be limited to this maximum.
|
||||
* @default 1MiB
|
||||
*/
|
||||
maxReceivedFrameSize: number;
|
||||
maxReceivedFrameSize?: number;
|
||||
|
||||
/**
|
||||
* The maximum allowed aggregate message size (for fragmented messages) in bytes.
|
||||
* @default 8MiB
|
||||
*/
|
||||
maxReceivedMessageSize: number;
|
||||
|
||||
/**
|
||||
* Whether or not to fragment outgoing messages. If true, messages will be
|
||||
* automatically fragmented into chunks of up to `fragmentationThreshold` bytes.
|
||||
* @default true
|
||||
*/
|
||||
fragmentOutgoingMessages: boolean;
|
||||
|
||||
/**
|
||||
* The maximum size of a frame in bytes before it is automatically fragmented.
|
||||
* @default 16KiB
|
||||
*/
|
||||
fragmentationThreshold: number;
|
||||
|
||||
/**
|
||||
* If true, fragmented messages will be automatically assembled and the full message
|
||||
* will be emitted via a `message` event. If false, each frame will be emitted on
|
||||
* the `connection` object via a `frame` event and the application will be responsible
|
||||
* for aggregating multiple fragmented frames. Single-frame messages will emit
|
||||
* a `message` event in addition to the `frame` event. Most users will want to
|
||||
* leave this set to true.
|
||||
* @default true
|
||||
*/
|
||||
assembleFragments: boolean;
|
||||
|
||||
/**
|
||||
* The number of milliseconds to wait after sending a close frame for
|
||||
* an acknowledgement to come back before giving up and just closing the socket.
|
||||
* @default 5000
|
||||
*/
|
||||
closeTimeout: number;
|
||||
maxReceivedMessageSize?: number;
|
||||
}
|
||||
|
||||
class client extends events.EventEmitter {
|
||||
protocols: string[];
|
||||
origin: string;
|
||||
url: url.Url;
|
||||
secure: boolean;
|
||||
socket: net.NodeSocket;
|
||||
response: http.ClientResponse;
|
||||
|
||||
constructor(clientConfig?: IClientConfig);
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
@@ -51,6 +51,7 @@ declare module When {
|
||||
promise: Promise<T>;
|
||||
reject(reason: any): void;
|
||||
resolve(value?: T): void;
|
||||
resolve(value?: Promise<T>): void;
|
||||
}
|
||||
|
||||
interface Promise<T> {
|
||||
|
||||
Reference in New Issue
Block a user