Commit e3f902d3 authored by Pascal Hartig's avatar Pascal Hartig

AngularJS+Typescript: Upgrade to 1.2.6

- Changed trimming behavior to match spec
- Upgraded bundled AngularJS version to 1.2.6
- Upgraded jQuery and AngularJS TS definitions
- Updated README
- Recompiled everything with TSC 0.9.5.0
parent 02b43564
......@@ -2,7 +2,7 @@
"name": "todomvc-typescript-angular",
"version": "0.0.0",
"dependencies": {
"angular": "~1.0.5",
"angular": "1.2.6",
"todomvc-common": "~0.1.6"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,7 +19,7 @@
<input id="toggle-all" type="checkbox" ng-model="allChecked" ng-click="vm.markAll(allChecked)">
<label for="toggle-all">Mark all as complete</label>
<ul id="todo-list">
<li ng-repeat="todo in todos | filter:statusFilter" ng-class="{completed: todo.completed, editing: todo == editedTodo}">
<li ng-repeat="todo in todos | filter:statusFilter track by $index" ng-class="{completed: todo.completed, editing: todo == editedTodo}">
<div class="view">
<input class="toggle" type="checkbox" ng-model="todo.completed">
<label ng-dblclick="vm.editTodo(todo)">{{todo.title}}</label>
......
......@@ -134,11 +134,12 @@ var todos;
};
TodoCtrl.prototype.addTodo = function () {
if (!this.$scope.newTodo.length) {
var newTodo = this.$scope.newTodo.trim();
if (!newTodo.length) {
return;
}
this.todos.push(new todos.TodoItem(this.$scope.newTodo, false));
this.todos.push(new todos.TodoItem(newTodo, false));
this.$scope.newTodo = '';
};
......@@ -148,6 +149,7 @@ var todos;
TodoCtrl.prototype.doneEditing = function (todoItem) {
this.$scope.editedTodo = null;
todoItem.title = todoItem.title.trim();
if (!todoItem.title) {
this.removeTodo(todoItem);
}
......
{"version":3,"file":"Application.js","sourceRoot":"","sources":["file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/models/TodoItem.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/interfaces/ITodoScope.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/interfaces/ITodoStorage.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/directives/TodoFocus.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/directives/TodoBlur.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/services/TodoStorage.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/controllers/TodoCtrl.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/Application.ts","file:///d:/dev/todomvc/labs/architecture-examples/typescript-angular/js/_all.ts"],"names":["todos","todos.TodoItem","todos.TodoItem.constructor","todos","todos.todoFocus","todos.todoFocus.link","","","todos","todos.todoBlur","todos.todoBlur.link","","todos","todos.TodoStorage","todos.TodoStorage.constructor","todos.TodoStorage.get","todos.TodoStorage.put","todos","todos.TodoCtrl","todos.TodoCtrl.constructor","","","todos.TodoCtrl.onPath","todos.TodoCtrl.onTodos","todos.TodoCtrl.addTodo","todos.TodoCtrl.editTodo","todos.TodoCtrl.doneEditing","todos.TodoCtrl.removeTodo","todos.TodoCtrl.clearDoneTodos","","todos.TodoCtrl.markAll","","todos"],"mappings":"AAAA,mCAAmC;AAEnC,IAAO,KAAK;AASX,CATD,UAAO,KAAK;IACRA,YAAYA,CAACA;;IAEbA;QACIC,kBACIA,KAAoBA,EACpBA,SAAyBA;YADzBC,UAAYA,GAALA,KAAKA;AAAQA,YACpBA,cAAgBA,GAATA,SAASA;AAASA,QACrBA,CAACA;QACbD;AAACA,IAADA,CAACA,IAAAD;IALDA,0BAKCA;AACLA,CAACA,yBAAA;ACXD,mCAAmC;ACAnC,mCAAmC;ACAnC,mCAAmC;AAEnC,IAAO,KAAK;AAoBX,CApBD,UAAO,KAAK;IACXG,YAAYA,CAACA;;IAKbA;;MADGA;IACHA,SAAgBA,SAASA,CAACA,QAA4BA;QACrDC,OAAOA;YACNA,IAAIA,EAAEA,UAACA,MAAiBA,EAAEA,OAAeA,EAAEA,UAAeA;gBACzDC,MAAMA,CAACA,MAAMA,CAACA,UAAUA,CAACA,SAASA,EAAEA,UA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,CAACA;AACjDA,CAACA,yBAAA"}
\ No newline at end of file
{"version":3,"file":"Application.js","sourceRoot":"","sources":["models/TodoItem.ts","interfaces/ITodoScope.ts","interfaces/ITodoStorage.ts","directives/TodoFocus.ts","directives/TodoBlur.ts","services/TodoStorage.ts","controllers/TodoCtrl.ts","Application.ts","_all.ts"],"names":["todos","todos.TodoItem","todos.TodoItem.constructor","todos.todoFocus","todos.todoBlur","todos.TodoStorage","todos.TodoStorage.constructor","todos.TodoStorage.get","todos.TodoStorage.put","todos.TodoCtrl","todos.TodoCtrl.constructor","todos.TodoCtrl.onPath","todos.TodoCtrl.onTodos","todos.TodoCtrl.addTodo","todos.TodoCtrl.editTodo","todos.TodoCtrl.doneEditing","todos.TodoCtrl.removeTodo","todos.TodoCtrl.clearDoneTodos","todos.TodoCtrl.markAll"],"mappings":"AAAA,mCAAmC;AAEnC,IAAO,KAAK;AASX,CATD,UAAO,KAAK;IACRA,YAAYA;;IAEZA;QACIC,kBACIA,KAAoBA,EACpBA,SAAyBA;YADzBC,UAAYA,GAALA,KAAKA;AAAQA,YACpBA,cAAgBA,GAATA,SAASA;AAASA,QACrBA,CAACA;QACbD,gBAACA;IAADA,CAACA,IAAAD;IALDA,0BAKCA;AACLA,CAACA,yBAAA;ACXD,mCAAmC;ACAnC,mCAAmC;ACAnC,mCAAmC;AAEnC,IAAO,KAAK;AAoBX,CApBD,UAAO,KAAK;IACXA,YAAYA;;IAKZA;;MADGA;IACHA,SAAgBA,SAASA,CAACA,QAA4BA;QACrDG,OAAOA;YACNA,IAAIA,EAAEA,UAACA,MAAiBA,EAAEA,OAAeA,EAAEA,UAAeA;gBACzDA,MAAMA,CAACA,MAAMA,CAACA,UAAUA,CAACA,SAASA,EAAEA,UAAAA,MAAMA;oBACzCA,IAAIA,MAAMA,CAAEA;wBACXA,QAAQA,CAACA;mCAAMA,OAAOA,CAACA,CAACA,CAACA,CAACA,KAAKA,CAACA,CAACA;wBAAlBA,CAAkBA,EAAEA,CAACA,EA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A,KAAKA,CAACA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,OAAOA,CAACA,QAAQA,CAACA,EAAEA,CAACA,CAACA;QACnDA,CAACA;;QAEDP,oCAAAA;YACCQ,IAAIA,CAACA,MAAMA,CAACA,KAAKA,GAAGA,IAAIA,CAACA,KAAKA,GAAGA,IAAIA,CAACA,KAAKA,CAACA,MAAMA,CAACA,UAAAA,QAAQA;uBAAIA,CAACA,QAAQA,CAACA,SAASA;YAAnBA,CAAmBA,CAACA;QACpFA,CAACA;;QAEDR,6BAAAA,UAAQA,SAAkBA;YACzBS,IAAIA,CAACA,KAAKA,CAACA,OAAOA,CAACA,UAAAA,QAAQA;gBAAMA,QAAQA,CAACA,SAASA,GAAGA,SAASA;YAAEA,CAACA,CAACA;QACpEA,CAACA;QA9EDT,mBAAwBA;YACvBA,QAAQA;YACRA,WAAWA;YACXA,aAAaA;YACbA,cAAcA;SACdA;QA0EFA,gBAACA;IAADA,CAACA,IAAAT;IAvFDA,0BAuFCA;AAEFA,CAACA,yBAAA;ACnGD,gCAAgC;AAEhC;;;;EAIG;AACH,IAAO,KAAK;AAQX,CARD,UAAO,KAAK;IACRA,YAAYA;;IAEZA,IAAIA,OAAOA,GAAGA,OAAOA,CAACA,MAAMA,CAACA,SAASA,EAAEA,EAAEA,CAACA,CAClCA,UAAUA,CAACA,UAAUA,EAAEA,cAAQA,CAACA,CAChCA,SAASA,CAACA,UAAUA,EAAEA,cAAQA,CAACA,CAC/BA,SAASA,CAACA,WAAWA,EAAEA,eAASA,CAACA,CACjCA,OAAOA,CAACA,aAAaA,EAAEA,iBAAWA,CAACA;AAChDA,CAACA,yBAAA"}
\ No newline at end of file
/// <reference path='libs/jquery.d.ts' />
/// <reference path='libs/angular.d.ts' />
/// <reference path='libs/jquery/jquery.d.ts' />
/// <reference path='libs/angular/angular.d.ts' />
/// <reference path='models/TodoItem.ts' />
/// <reference path='interfaces/ITodoScope.ts' />
/// <reference path='interfaces/ITodoStorage.ts' />
......
/// <reference path='../_all.ts' />
var todos;
(function (todos) {
'use strict';
/**
* The main controller for the app. The controller:
* - retrieves and persists the model via the todoStorage service
* - exposes the model to the template and provides event handlers
*/
var TodoCtrl = (function () {
// dependencies are injected via AngularJS $injector
// controller's name is registered in Application.ts and specified from ng-controller attribute in index.html
function TodoCtrl($scope, $location, todoStorage, filterFilter) {
var _this = this;
this.$scope = $scope;
this.$location = $location;
this.todoStorage = todoStorage;
this.filterFilter = filterFilter;
this.todos = $scope.todos = todoStorage.get();
$scope.newTodo = '';
$scope.editedTodo = null;
// 'vm' stands for 'view model'. We're adding a reference to the controller to the scope
// for its methods to be accessible from view / HTML
$scope.vm = this;
// watching for events/changes in scope, which are caused by view/user input
// if you subscribe to scope or event with lifetime longer than this controller, make sure you unsubscribe.
$scope.$watch('todos', function () {
return _this.onTodos();
}, true);
$scope.$watch('location.path()', function (path) {
return _this.onPath(path);
});
if ($location.path() === '')
$location.path('/');
$scope.location = $location;
}
TodoCtrl.prototype.onPath = function (path) {
this.$scope.statusFilter = (path === '/active') ? { completed: false } : (path === '/completed') ? { completed: true } : null;
};
TodoCtrl.prototype.onTodos = function () {
this.$scope.remainingCount = this.filterFilter(this.todos, { completed: false }).length;
this.$scope.doneCount = this.todos.length - this.$scope.remainingCount;
this.$scope.allChecked = !this.$scope.remainingCount;
this.todoStorage.put(this.todos);
};
TodoCtrl.prototype.addTodo = function () {
if (!this.$scope.newTodo.length) {
return;
}
this.todos.push(new todos.TodoItem(this.$scope.newTodo, false));
this.$scope.newTodo = '';
};
TodoCtrl.prototype.editTodo = function (todoItem) {
this.$scope.editedTodo = todoItem;
};
TodoCtrl.prototype.doneEditing = function (todoItem) {
this.$scope.editedTodo = null;
if (!todoItem.title) {
this.removeTodo(todoItem);
}
};
TodoCtrl.prototype.removeTodo = function (todoItem) {
this.todos.splice(this.todos.indexOf(todoItem), 1);
};
TodoCtrl.prototype.clearDoneTodos = function () {
this.$scope.todos = this.todos = this.todos.filter(function (todoItem) {
return !todoItem.completed;
});
};
TodoCtrl.prototype.markAll = function (completed) {
this.todos.forEach(function (todoItem) {
todoItem.completed = completed;
});
};
TodoCtrl.$inject = [
'$scope',
'$location',
'todoStorage',
'filterFilter'
];
return TodoCtrl;
})();
todos.TodoCtrl = TodoCtrl;
})(todos || (todos = {}));
......@@ -63,11 +63,12 @@ module todos {
}
addTodo() {
if (!this.$scope.newTodo.length) {
var newTodo : string = this.$scope.newTodo.trim();
if (!newTodo.length) {
return;
}
this.todos.push(new TodoItem(this.$scope.newTodo, false));
this.todos.push(new TodoItem(newTodo, false));
this.$scope.newTodo = '';
}
......@@ -77,6 +78,7 @@ module todos {
doneEditing(todoItem: TodoItem) {
this.$scope.editedTodo = null;
todoItem.title = todoItem.title.trim();
if (!todoItem.title) {
this.removeTodo(todoItem);
}
......
/// <reference path='../_all.ts' />
var todos;
(function (todos) {
'use strict';
/**
* Directive that executes an expression when the element it is applied to loses focus.
*/
function todoBlur() {
return {
link: function ($scope, element, attributes) {
element.bind('blur', function () {
$scope.$apply(attributes.todoBlur);
});
}
};
}
todos.todoBlur = todoBlur;
})(todos || (todos = {}));
/// <reference path='../_all.ts' />
var todos;
(function (todos) {
'use strict';
/**
* Directive that places focus on the element it is applied to when the expression it binds to evaluates to true.
*/
function todoFocus($timeout) {
return {
link: function ($scope, element, attributes) {
$scope.$watch(attributes.todoFocus, function (newval) {
if (newval) {
$timeout(function () {
return element[0].focus();
}, 0, false);
}
});
}
};
}
todos.todoFocus = todoFocus;
todoFocus.$inject = ['$timeout'];
})(todos || (todos = {}));
......@@ -4,13 +4,13 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="jquery.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
declare var angular: ng.IAngularStatic;
// Support for painless dependency injection
interface Function {
$inject: string[];
$inject:string[];
}
///////////////////////////////////////////////////////////////////////////////
......@@ -20,7 +20,7 @@ declare module ng {
// All service providers extend this interface
interface IServiceProvider {
$get(): any;
$get: any;
}
///////////////////////////////////////////////////////////////////////////
......@@ -93,8 +93,8 @@ declare module ng {
constant(object: Object): IModule;
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
controller(object: Object): IModule;
directive(name: string, directiveFactory: (...params: any[]) => IDirective): IModule;
controller(object : Object): IModule;
directive(name: string, directiveFactory: Function): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
directive(object: Object): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
......@@ -124,9 +124,33 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
///////////////////////////////////////////////////////////////////////////
interface IAttributes {
$set(name: string, value: any): void;
$observe(name: string, fn: (value?: any) => any): void;
$attr: any;
// 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
// 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
// the class removal.
$removeClass(classVal: string): void;
// Set DOM element attribute value.
$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
// 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
// to do reverse lookup from normalized name back to actual name.
$attr: Object;
}
///////////////////////////////////////////////////////////////////////////
......@@ -139,6 +163,8 @@ declare module ng {
$valid: boolean;
$invalid: boolean;
$error: any;
$addControl(control: ng.INgModelController): void;
$removeControl(control: ng.INgModelController): void;
$setDirty(): void;
$setPristine(): void;
}
......@@ -150,14 +176,11 @@ declare module ng {
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: boolean): void;
$setViewValue(value: string): void;
// XXX Not sure about the types here. Documentation states it's a string, but
// I've seen it receiving other types throughout the code.
// Falling back to any for now.
// Documentation states viewValue and modelValue to be a string but other
// types do work and it's common to use them.
$setViewValue(value: any): void;
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
......@@ -192,8 +215,8 @@ declare module ng {
$emit(name: string, ...args: any[]): IAngularEvent;
// Documentation says exp is optional, but actual implementaton counts on it
$eval(expression: string): any;
$eval(expression: (scope: IScope) => any): any;
$eval(expression: string, args?: Object): any;
$eval(expression: (scope: IScope) => any, args?: Object): any;
// Documentation says exp is optional, but actual implementaton counts on it
$evalAsync(expression: string): void;
......@@ -236,13 +259,13 @@ declare module ng {
// WindowService
// see http://docs.angularjs.org/api/ng.$window
///////////////////////////////////////////////////////////////////////////
interface IWindowService extends Window { }
interface IWindowService extends Window {}
///////////////////////////////////////////////////////////////////////////
// BrowserService
// TODO undocumented, so we need to get it from the source code
///////////////////////////////////////////////////////////////////////////
interface IBrowserService { }
interface IBrowserService {}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
......@@ -253,6 +276,15 @@ declare module ng {
cancel(promise: IPromise<any>): boolean;
}
///////////////////////////////////////////////////////////////////////////
// IntervalService
// see http://docs.angularjs.org/api/ng.$interval
///////////////////////////////////////////////////////////////////////////
interface IIntervalService {
(func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise<any>;
cancel(promise: IPromise<any>): boolean;
}
///////////////////////////////////////////////////////////////////////////
// FilterService
// see http://docs.angularjs.org/api/ng.$filter
......@@ -388,7 +420,7 @@ declare module ng {
// DocumentService
// see http://docs.angularjs.org/api/ng.$document
///////////////////////////////////////////////////////////////////////////
interface IDocumentService extends Document { }
interface IDocumentService extends Document {}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
......@@ -402,7 +434,7 @@ declare module ng {
// RootElementService
// see http://docs.angularjs.org/api/ng.$rootElement
///////////////////////////////////////////////////////////////////////////
interface IRootElementService extends JQuery { }
interface IRootElementService extends JQuery {}
///////////////////////////////////////////////////////////////////////////
// QService
......@@ -416,14 +448,22 @@ declare module ng {
}
interface IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>;
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>;
}
interface IDeferred<T> {
resolve(value?: T): void;
reject(reason?: any): void;
notify(state?:any): void;
promise: IPromise<T>;
}
......@@ -452,7 +492,7 @@ declare module ng {
// Methods bellow are not documented
info(): any;
get(cacheId: string): ICacheObject;
get (cacheId: string): ICacheObject;
}
interface ICacheObject {
......@@ -464,7 +504,7 @@ declare module ng {
//capacity: number;
};
put(key: string, value?: any): void;
get(key: string): any;
get (key: string): any;
remove(key: string): void;
removeAll(): void;
destroy(): void;
......@@ -516,8 +556,8 @@ declare module ng {
interface IHttpService {
// At least moethod and url must be provided...
(config: IRequestConfig): IHttpPromise<any>;
get(url: string, RequestConfig?: any): IHttpPromise<any>;
delete(url: string, RequestConfig?: any): IHttpPromise<any>;
get (url: string, RequestConfig?: any): IHttpPromise<any>;
delete (url: string, RequestConfig?: any): IHttpPromise<any>;
head(url: string, RequestConfig?: any): IHttpPromise<any>;
jsonp(url: string, RequestConfig?: any): IHttpPromise<any>;
post(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
......@@ -540,13 +580,13 @@ declare module ng {
headers?: any;
cache?: any;
timeout?: number;
withCredentials?: boolean;
// These accept multiple types, so let's defile them as any
// These accept multiple types, so let's define them as any
data?: any;
transformRequest?: any;
transformResponse?: any;
timeout?: any; // number | promise
}
interface IHttpPromiseCallback<T> {
......@@ -605,62 +645,69 @@ declare module ng {
endSymbol(value: string): IInterpolateProvider;
}
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ng.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService { }
///////////////////////////////////////////////////////////////////////////
// TemplateCacheService
// see http://docs.angularjs.org/api/ng.$templateCache
///////////////////////////////////////////////////////////////////////////
interface ITemplateCacheService extends ICacheObject { }
interface ITemplateCacheService extends ICacheObject {}
///////////////////////////////////////////////////////////////////////////
// RootScopeService
// see http://docs.angularjs.org/api/ng.$rootScope
///////////////////////////////////////////////////////////////////////////
interface IRootScopeService extends IScope { }
interface IRootScopeService extends IScope {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ng.$route
// see http://docs.angularjs.org/api/ng.$routeProvider
// SCEService
// see http://docs.angularjs.org/api/ng.$sce
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
interface ISCEService {
getTrusted(type: string, mayBeTrusted: any): any;
getTrustedCss(value: any): any;
getTrustedHtml(value: any): any;
getTrustedJs(value: any): any;
getTrustedResourceUrl(value: any): any;
getTrustedUrl(value: any): any;
parse(type: string, expression: string): (context: any, locals: any) => any;
parseAsCss(expression: string): (context: any, locals: any) => any;
parseAsHtml(expression: string): (context: any, locals: any) => any;
parseAsJs(expression: string): (context: any, locals: any) => any;
parseAsResourceUrl(expression: string): (context: any, locals: any) => any;
parseAsUrl(expression: string): (context: any, locals: any) => any;
trustAs(type: string, value: any): any;
trustAsHtml(value: any): any;
trustAsJs(value: any): any;
trustAsResourceUrl(value: any): any;
trustAsUrl(value: any): any;
isEnabled(): boolean;
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
name?: string;
template?: string;
templateUrl?: any;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: boolean;
///////////////////////////////////////////////////////////////////////////
// SCEProvider
// see http://docs.angularjs.org/api/ng.$sceProvider
///////////////////////////////////////////////////////////////////////////
interface ISCEProvider extends IServiceProvider {
enabled(value: boolean): void;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
params: any;
///////////////////////////////////////////////////////////////////////////
// SCEDelegateService
// see http://docs.angularjs.org/api/ng.$sceDelegate
///////////////////////////////////////////////////////////////////////////
interface ISCEDelegateService {
getTrusted(type: string, mayBeTrusted: any): any;
trustAs(type: string, value: any): any;
valueOf(value: any): any;
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
when(path: string, route: IRoute): IRouteProvider;
///////////////////////////////////////////////////////////////////////////
// SCEDelegateProvider
// see http://docs.angularjs.org/api/ng.$sceDelegateProvider
///////////////////////////////////////////////////////////////////////////
interface ISCEDelegateProvider extends IServiceProvider {
resourceUrlBlacklist(blacklist: any[]): void;
resourceUrlWhitelist(whitelist: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
......@@ -669,16 +716,30 @@ declare module ng {
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
interface IDirective {
interface IDirective{
compile?:
(templateElement: any,
templateAttributes: IAttributes,
transclude: (scope: IScope, cloneLinkingFn: Function) => void
) => any;
controller?: any;
controllerAs?: string;
link?:
(scope: IScope,
instanceElement: any,
instanceAttributes: IAttributes,
controller: any
) => void;
name?: string;
priority?: number;
template?: string;
templateUrl?: string;
replace?: boolean;
transclude?: any;
require?: any;
restrict?: string;
scope?: any;
link?: Function;
compile?: Function;
template?: any;
templateUrl?: any;
terminal?: boolean;
transclude?: any;
}
///////////////////////////////////////////////////////////////////////////
......@@ -730,8 +791,9 @@ declare module ng {
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotadedFunction: any[]): string[];
get(name: string): any;
get (name: string): any;
instantiate(typeConstructor: Function, locals?: any): any;
invoke(inlineAnnotadedFunction: any[]): any;
invoke(func: Function, context?: any, locals?: any): any;
}
......@@ -748,6 +810,7 @@ declare module ng {
decorator(name: string, decorator: Function): void;
decorator(name: string, decoratorInline: any[]): void;
factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider;
factory(name: string, inlineAnnotadedFunction: any[]): ng.IServiceProvider;
provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider;
provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider;
service(name: string, constructor: Function): ng.IServiceProvider;
......@@ -755,5 +818,4 @@ declare module ng {
}
}
}
......@@ -13,46 +13,148 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
// Typing for the jQuery library, version 2.0.x
// Typing for the jQuery library, version 1.10.x / 2.0.x
// Project: http://jquery.com/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Christian Hoffmeister <https://github.com/choffmeister>, Steve Fenton, Diullei Gomes <https://github.com/Diullei>, Tass Iliopoulos <https://github.com/tasoili>, Jason Swearingen, Sean Hill <https://github.com/seanski>, Guus Goossens <https://github.com/Guuz>, Kelly Summerlin <https://github.com/ksummerlin>, Basarat Ali Syed <https://github.com/basarat>, Nicholas Wolverson <https://github.com/nwolverson>, Derek Cicerone <https://github.com/derekcicerone>, Andrew Gaspar <https://github.com/AndrewGaspar>, James Harrison Fisher <https://github.com/jameshfisher>, Seikichi Kondo <https://github.com/seikichi>, Benjamin Jackman <https://github.com/benjaminjackman>, Poul Sorensen <https://github.com/s093294>, Josh Strobl <https://github.com/JoshStrobl>, John Reilly <https://github.com/johnnyreilly/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
Interface for the AJAX setting that will configure the AJAX request
*/
interface JQueryAjaxSettings {
/**
* The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
*/
accepts?: any;
/**
* By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success().
*/
async?: boolean;
/**
* A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
*/
beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any;
/**
* If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
*/
cache?: boolean;
/**
* A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
*/
complete? (jqXHR: JQueryXHR, textStatus: string): any;
/**
* An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5)
*/
contents?: { [key: string]: any; };
//According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false"
// https://github.com/borisyankov/DefinitelyTyped/issues/742
/**
* When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
*/
contentType?: any;
/**
* This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
*/
context?: any;
/**
* An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5)
*/
converters?: { [key: string]: any; };
/**
* If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5)
*/
crossDomain?: boolean;
/**
* Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
*/
data?: any;
/**
* A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter.
*/
dataFilter? (data: any, ty: any): any;
/**
* The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).
*/
dataType?: string;
/**
* A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
*/
error? (jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any;
/**
* Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
*/
global?: boolean;
/**
* An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5)
*/
headers?: { [key: string]: any; };
/**
* Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
*/
ifModified?: boolean;
/**
* Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1)
*/
isLocal?: boolean;
/**
* Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }
*/
jsonp?: string;
/**
* Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.
*/
jsonpCallback?: any;
/**
* A mime type to override the XHR mime type. (version added: 1.5.1)
*/
mimeType?: string;
/**
* A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
*/
password?: string;
/**
* By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
*/
processData?: boolean;
/**
* Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script.
*/
scriptCharset?: string;
/**
* An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5)
*/
statusCode?: { [key: string]: any; };
/**
* A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
*/
success? (data: any, textStatus: string, jqXHR: JQueryXHR): any;
/**
* Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
*/
timeout?: number;
/**
* Set this to true if you wish to use the traditional style of param serialization.
*/
traditional?: boolean;
/**
* The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.
*/
type?: string;
/**
* A string containing the URL to which the request is sent.
*/
url?: string;
/**
* A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
*/
username?: string;
/**
* Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory.
*/
xhr?: any;
/**
* An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1)
*/
xhrFields?: { [key: string]: any; };
}
......@@ -94,6 +196,12 @@ interface JQueryGenericPromise<T> {
Interface for the JQuery promise, part of callbacks
*/
interface JQueryPromise<T> {
// Generic versions of callbacks
always(...alwaysCallbacks: T[]): JQueryPromise<T>;
done(...doneCallbacks: T[]): JQueryPromise<T>;
fail(...failCallbacks: T[]): JQueryPromise<T>;
progress(...progressCallbacks: T[]): JQueryPromise<T>;
always(...alwaysCallbacks: any[]): JQueryPromise<T>;
done(...doneCallbacks: any[]): JQueryPromise<T>;
fail(...failCallbacks: any[]): JQueryPromise<T>;
......@@ -118,6 +226,12 @@ interface JQueryPromise<T> {
Interface for the JQuery deferred, part of callbacks
*/
interface JQueryDeferred<T> extends JQueryPromise<T> {
// Generic versions of callbacks
always(...alwaysCallbacks: T[]): JQueryDeferred<T>;
done(...doneCallbacks: T[]): JQueryDeferred<T>;
fail(...failCallbacks: T[]): JQueryDeferred<T>;
progress(...progressCallbacks: T[]): JQueryDeferred<T>;
always(...alwaysCallbacks: any[]): JQueryDeferred<T>;
done(...doneCallbacks: any[]): JQueryDeferred<T>;
fail(...failCallbacks: any[]): JQueryDeferred<T>;
......@@ -156,7 +270,7 @@ interface BaseJQueryEventObject extends Event {
pageX: number;
pageY: number;
which: number;
metaKey: any;
metaKey: boolean;
}
interface JQueryInputEventObject extends BaseJQueryEventObject {
......@@ -223,38 +337,166 @@ interface JQueryParam {
(obj: any, traditional: boolean): string;
}
/**
* The interface used to construct jQuery events (with $.Event). It is
* defined separately instead of inline in JQueryStatic to allow
* overriding the construction function with specific strings
* returning specific event objects.
*/
interface JQueryEventConstructor {
(name: string, eventProperties?: any): JQueryEventObject;
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)
*/
interface JQueryStatic {
/****
AJAX
*****/
/**
* Perform an asynchronous HTTP (Ajax) request.
*
* @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
*/
ajax(settings: JQueryAjaxSettings): JQueryXHR;
/**
* Perform an asynchronous HTTP (Ajax) request.
*
* @param url A string containing the URL to which the request is sent.
* @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().
*/
ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR;
ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: any, jqXHR: JQueryXHR) => any): any;
ajaxPrefilter(handler: (opts: any, originalOpts: any, jqXHR: JQueryXHR) => any): any;
/**
* Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
*
* @param dataTypes An optional string containing one or more space-separated dataTypes
* @param handler A handler to set default values for future Ajax requests.
*/
ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
/**
* Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().
*
* @param handler A handler to set default values for future Ajax requests.
*/
ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void;
ajaxSettings: JQueryAjaxSettings;
ajaxSetup(): void;
/**
* Set default values for future Ajax requests. Its use is not recommended.
*
* @param options A set of key/value pairs that configure the default Ajax request. All options are optional.
*/
ajaxSetup(options: JQueryAjaxSettings): void;
get(url: string, data?: any, success?: any, dataType?: any): JQueryXHR;
getJSON(url: string, data?: any, success?: any): JQueryXHR;
getScript(url: string, success?: any): JQueryXHR;
/**
* Load data from the server using a HTTP GET request.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP GET request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP GET request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
*/
get(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load JSON-encoded data from the server using a GET HTTP request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds.
*/
getJSON(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
/**
* Load a JavaScript file from the server using a GET HTTP request, then execute it.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds.
*/
getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
param: JQueryParam;
post(url: string, data?: any, success?: any, dataType?: any): JQueryXHR;
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
/**
* Load data from the server using a HTTP POST request.
*
* @param url A string containing the URL to which the request is sent.
* @param data A plain object or string that is sent to the server with the request.
* @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case.
* @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).
*/
post(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR;
// Callbacks
/**
* A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
*
* @param flags An optional list of space-separated flags that change how the callback list behaves.
*/
Callbacks(flags?: string): JQueryCallback;
// Core
holdReady(hold: boolean): any;
/**
* Holds or releases the execution of jQuery's ready event.
*
* @param hold Indicates whether the ready hold is being requested or released
*/
holdReady(hold: boolean): void;
(selector: string, context?: any): JQuery;
(element: Element): JQuery;
......@@ -265,21 +507,55 @@ interface JQueryStatic {
(array: any[]): JQuery;
(): JQuery;
/**
* Relinquish jQuery's control of the $ variable.
*
* @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
*/
noConflict(removeAll?: boolean): Object;
/**
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
*
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
*/
when<T>(...deferreds: JQueryGenericPromise<T>[]): JQueryPromise<T>;
/**
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
*
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
*/
when<T>(...deferreds: T[]): JQueryPromise<T>;
/**
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
*
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
*/
when<T>(...deferreds: any[]): JQueryPromise<T>;
// CSS
css(e: any, propertyName: string, value?: any): any;
css(e: any, propertyName: any, value?: any): any;
cssHooks: { [key: string]: any; };
cssNumber: any;
// Data
data(element: Element, key: string, value: any): any;
/**
* Store arbitrary data associated with the specified element. Returns the value that was set.
*
* @param element The DOM element to associate with the data.
* @param key A string naming the piece of data to set.
* @param value The new data value.
*/
data<T>(element: Element, key: string, value: T): T;
/**
* Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
*
* @param element The DOM element to associate with the data.
* @param key A string naming the piece of data to set.
*/
data(element: Element, key: string): any;
/**
* Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
*
* @param element The DOM element to associate with the data.
*/
data(element: Element): any;
dequeue(element: Element, queueName?: string): any;
......@@ -301,10 +577,7 @@ interface JQueryStatic {
proxy(fn: (...args: any[]) => any, context: any, ...args: any[]): any;
proxy(context: any, name: string, ...args: any[]): any;
Event: {
(name: string, eventProperties?: any): JQueryEventObject;
new (name: string, eventProperties?: any): JQueryEventObject;
};
Event: JQueryEventConstructor;
// Internals
error(message: any): JQuery;
......@@ -355,8 +628,12 @@ interface JQueryStatic {
parseJSON(json: string): any;
//FIXME: This should return an XMLDocument
parseXML(data: string): any;
/**
* Parses a string into an XML document.
*
* @param dataa well-formed XML string to be parsed
*/
parseXML(data: string): XMLDocument;
queue(element: Element, queueName: string, newQueue: any[]): JQuery;
......@@ -377,6 +654,7 @@ interface JQueryStatic {
Animation(elem: any, properties: any, options: any): any;
easing: JQueryEasing;
}
/*
......@@ -406,8 +684,8 @@ interface JQuery {
attr(attributeName: string): string;
attr(attributeName: string, value: any): JQuery;
attr(map: { [key: string]: any; }): JQuery;
attr(attributeName: string, func: (index: any, attr: any) => any): JQuery;
attr(map: any): JQuery;
hasClass(className: string): boolean;
......@@ -421,14 +699,14 @@ interface JQuery {
prop(map: any): JQuery;
prop(propertyName: string, func: (index: any, oldPropertyValue: any) => any): JQuery;
removeAttr(attributeName: any): JQuery;
removeAttr(attributeName: string): JQuery;
removeClass(className?: any): JQuery;
removeClass(className?: string): JQuery;
removeClass(func: (index: any, cls: any) => any): JQuery;
removeProp(propertyName: any): JQuery;
removeProp(propertyName: string): JQuery;
toggleClass(className: any, swtch?: boolean): JQuery;
toggleClass(className: string, swtch?: boolean): JQuery;
toggleClass(swtch?: boolean): JQuery;
toggleClass(func: (index: any, cls: any, swtch: any) => any): JQuery;
......@@ -438,12 +716,60 @@ interface JQuery {
val(value: number): JQuery;
val(func: (index: any, value: any) => any): JQuery;
// CSS
/**
* Get the value of style properties for the first element in the set of matched elements.
*
* @param propertyName A CSS property.
*/
css(propertyName: string): string;
css(propertyNames: string[]): string;
css(properties: any): JQuery;
css(propertyName: string, value: any): JQuery;
css(propertyName: any, value: any): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A value to set for the property.
*/
css(propertyName: string, value: string): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A value to set for the property.
*/
css(propertyName: string, value: number): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A value to set for the property.
*/
css(propertyName: string, value: string[]): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A value to set for the property.
*/
css(propertyName: string, value: number[]): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
*/
css(propertyName: string, value: (index: number, value: string) => string): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param propertyName A CSS property name.
* @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
*/
css(propertyName: string, value: (index: number, value: number) => number): JQuery;
/**
* Set one or more CSS properties for the set of matched elements.
*
* @param properties An object of property-value pairs to set.
*/
css(properties: Object): JQuery;
height(): number;
height(value: number): JQuery;
......@@ -542,98 +868,501 @@ interface JQuery {
bind(eventType: string, preventBubble: boolean): JQuery;
bind(...events: any[]): JQuery;
blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "change" event on an element.
*/
change(): JQuery;
/**
* Bind an event handler to the "change" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
change(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "change" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "click" event on an element.
*/
click(): JQuery;
/**
* Bind an event handler to the "click" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
*/
click(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "click" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "dblclick" event on an element.
*/
dblclick(): JQuery;
/**
* Bind an event handler to the "dblclick" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "dblclick" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "focus" event on an element.
*/
focus(): JQuery;
/**
* Bind an event handler to the "focus" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
focus(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focus" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
focusin(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focusin" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
focusin(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focusin" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
focusout(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focusout" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
focusout(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "focusout" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
*
* @param handlerIn A function to execute when the mouse pointer enters the element.
* @param handlerOut A function to execute when the mouse pointer leaves the element.
*/
hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
*
* @param handlerInOut A function to execute when the mouse pointer enters or leaves the element.
*/
hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery;
keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Trigger the "keydown" event on an element.
*/
keydown(): JQuery;
/**
* Bind an event handler to the "keydown" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the keydown"" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Trigger the "keypress" event on an element.
*/
keypress(): JQuery;
/**
* Bind an event handler to the "keypress" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the "keypress" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Trigger the "keyup" event on an element.
*/
keyup(): JQuery;
/**
* Bind an event handler to the "keyup" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery;
/**
* Bind an event handler to the "keyup" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery;
load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "load" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
load(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "load" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "mousedown" event on an element.
*/
mousedown(): JQuery;
mousedown(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mousedown" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mousedown" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
mouseevent(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
mouseevent(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseenter" event on an element.
*/
mouseenter(): JQuery;
mouseenter(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to be fired when the mouse enters an element.
*
* @param handler A function to execute when the event is triggered.
*/
mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to be fired when the mouse enters an element.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseleave" event on an element.
*/
mouseleave(): JQuery;
mouseleave(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to be fired when the mouse leaves an element.
*
* @param handler A function to execute when the event is triggered.
*/
mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to be fired when the mouse leaves an element.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mousemove" event on an element.
*/
mousemove(): JQuery;
mousemove(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mousemove" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mousemove" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseout" event on an element.
*/
mouseout(): JQuery;
mouseout(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseout" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseout" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseover" event on an element.
*/
mouseover(): JQuery;
mouseover(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseover" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseover" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Trigger the "mouseup" event on an element.
*/
mouseup(): JQuery;
mouseup(eventData: any, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseup" JavaScript event.
*
* @param handler A function to execute when the event is triggered.
*/
mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
/**
* Bind an event handler to the "mouseup" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute when the event is triggered.
*/
mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery;
off(events?: string, selector?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
off(eventsMap: { [key: string]: any; }, selector?: any): JQuery;
/**
* Remove an event handler.
*/
off(): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove an event handler.
*
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Remove an event handler.
*
* @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s).
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
*/
off(events: { [key: string]: any; }, selector?: string): JQuery;
on(events: string, selector?: any, data?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
on(events: string, selector?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
on(eventsMap: { [key: string]: any; }, selector?: any, data?: any): 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. 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, ...args: any[]) => any): 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 selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @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.
*/
on(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): 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 selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @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.
*/
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach an event handler function for one or more events to the selected elements.
*
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
* @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event occurs.
*/
on(events: { [key: string]: any; }, selector?: any, data?: any): JQuery;
one(events: string, selector?: any, data?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
one(eventsMap: { [key: string]: any; }, selector?: any, data?: any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute at the time the event is triggered.
*/
one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
* @param data An object containing data that will be passed to the event handler.
* @param handler A function to execute at the time the event is triggered.
*/
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
ready(handler: any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @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.
*/
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event is triggered.
* @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.
*/
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
*
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
* @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
* @param data Data to be passed to the handler in event.data when an event occurs.
*/
one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
/**
* Specify a function to execute when the DOM is fully loaded.
*
* @param handler A function to execute after the DOM is ready.
*/
ready(handler: Function): JQuery;
resize(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "resize" event on an element.
*/
resize(): JQuery;
/**
* Bind an event handler to the "resize" JavaScript event.
*
* @param handler A function to execute each time the event is triggered.
*/
resize(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "resize" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
scroll(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "scroll" event on an element.
*/
scroll(): JQuery;
/**
* Bind an event handler to the "scroll" JavaScript event.
*
* @param handler A function to execute each time the event is triggered.
*/
scroll(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "scroll" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
select(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "select" event on an element.
*/
select(): JQuery;
/**
* Bind an event handler to the "select" JavaScript event.
*
* @param handler A function to execute each time the event is triggered.
*/
select(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "select" JavaScript event.
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Trigger the "submit" event on an element.
*/
submit(): JQuery;
/**
* Bind an event handler to the "submit" JavaScript event
*
* @param handler A function to execute each time the event is triggered.
*/
submit(handler: (eventObject: JQueryEventObject) => any): JQuery;
/**
* Bind an event handler to the "submit" JavaScript event
*
* @param eventData An object containing data that will be passed to the event handler.
* @param handler A function to execute each time the event is triggered.
*/
submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
trigger(eventType: string, ...extraParameters: any[]): JQuery;
trigger(event: JQueryEventObject): JQuery;
......@@ -649,8 +1378,8 @@ interface JQuery {
undelegate(selector: any, events: any): JQuery;
undelegate(namespace: string): JQuery;
unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
unload(handler: (eventObject: JQueryEventObject) => any): JQuery;
unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
// Internals
context: Element;
......
/// <reference path='../_all.ts' />
var todos;
(function (todos) {
'use strict';
var TodoItem = (function () {
function TodoItem(title, completed) {
this.title = title;
this.completed = completed;
}
return TodoItem;
})();
todos.TodoItem = TodoItem;
})(todos || (todos = {}));
/// <reference path='../_all.ts' />
var todos;
(function (todos) {
'use strict';
/**
* Services that persists and retrieves TODOs from localStorage.
*/
var TodoStorage = (function () {
function TodoStorage() {
this.STORAGE_ID = 'todos-angularjs-typescript';
}
TodoStorage.prototype.get = function () {
return JSON.parse(localStorage.getItem(this.STORAGE_ID) || '[]');
};
TodoStorage.prototype.put = function (todos) {
localStorage.setItem(this.STORAGE_ID, JSON.stringify(todos));
};
return TodoStorage;
})();
todos.TodoStorage = TodoStorage;
})(todos || (todos = {}));
......@@ -42,7 +42,7 @@ It's attractive to people with a background in strongly typed languages, who are
### Editors
A great editor for TypeScript is Visual Studio 2012 with [TypeScript](http://go.microsoft.com/fwlink/?LinkID=266563) and [Web Essentials 2012](http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6) plugins.
Webstorm is [coming soon](http://joeriks.com/2012/11/20/a-first-look-at-the-typescript-support-in-webstorm-6-eap/).
Webstorm has [support for TypeScript](http://blog.jetbrains.com/webstorm/2013/11/enjoy-typescript-in-webstorm/) as well.
### Ambient declarations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment