Commit 815aa07e authored by Pavel Savara's avatar Pavel Savara

Angular+TypeScript

parent 45e277d8
*.suo
*.user
*.js
*.map
/bin
/obj
\ No newline at end of file
TypeScript
http://go.microsoft.com/fwlink/?LinkID=266563
http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6
NodeJs http://nodejs.org/
npm install -g typescript
run compileTs.cmd
I used https://github.com/borisyankov/DefinitelyTyped for Angular and JQuery interface definitions.
\ No newline at end of file
@echo off
tsc -sourcemap js/_all.ts
\ No newline at end of file
<!doctype html>
<html lang="en" ng-app="todomvc">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>AngularJS - TodoMVC</title>
<link rel="stylesheet" href="../../../assets/base.css">
<style>[ng-cloak] {display: none}</style>
<!--[if IE]>
<script src="../../../assets/ie.js"></script>
<![endif]-->
</head>
<body>
<section id="todoapp" ng-controller="todoCtrl">
<header id="header">
<h1>todos</h1>
<form id="todo-form" ng-submit="addTodo()">
<input id="new-todo" placeholder="What needs to be done?" ng-model="newTodo" autofocus>
</form>
</header>
<section id="main" ng-show="todos.length" ng-cloak>
<input id="toggle-all" type="checkbox" ng-model="allChecked" ng-click="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}">
<div class="view">
<input class="toggle" type="checkbox" ng-model="todo.completed">
<label ng-dblclick="editTodo(todo)">{{todo.title}}</label>
<button class="destroy" ng-click="removeTodo(todo)"></button>
</div>
<form ng-submit="doneEditing(todo)">
<input class="edit" ng-model="todo.title" todo-blur="doneEditing(todo)" todo-focus="todo == editedTodo">
</form>
</li>
</ul>
</section>
<footer id="footer" ng-show="todos.length" ng-cloak>
<span id="todo-count"><strong>{{remainingCount}}</strong>
<ng-pluralize count="remainingCount" when="{ one: 'item left', other: 'items left' }"></ng-pluralize>
</span>
<ul id="filters">
<li>
<a ng-class="{selected: location.path() == '/'} " href="#/">All</a>
</li>
<li>
<a ng-class="{selected: location.path() == '/active'}" href="#/active">Active</a>
</li>
<li>
<a ng-class="{selected: location.path() == '/completed'}" href="#/completed">Completed</a>
</li>
</ul>
<button id="clear-completed" ng-click="clearDoneTodos()" ng-show="doneCount">Clear completed ({{doneCount}})</button>
</footer>
</section>
<footer id="info">
<p>Double-click to edit a todo.</p>
<p>Credits:
<a href="http://twitter.com/cburgdorf">Christoph Burgdorf</a>,
<a href="http://ericbidelman.com">Eric Bidelman</a>,
<a href="http://jacobmumm.com">Jacob Mumm</a> and
<a href="http://igorminar.com">Igor Minar</a>
</p>
</footer>
<script src="../../../assets/base.js"></script>
<script src="js/libs/angular/angular.min.js"></script>
<script src="js/controllers/TodoCtrl.js"></script>
<script src="js/services/TodoStorage.js"></script>
<script src="js/directives/TodoFocus.js"></script>
<script src="js/directives/TodoBlur.js"></script>
<script src="js/app.js"></script>
</body>
</html>
/// <reference path='app.ts' />
/// <reference path='models/TodoItem.js' />
/// <reference path='interfaces/ITodoScope.js' />
/// <reference path='interfaces/ITodoStorage.js' />
/// <reference path='directives/TodoFocus.ts' />
/// <reference path='directives/TodoBlur.ts' />
/// <reference path='services/TodoStorage.ts' />
/// <reference path='controllers/TodoCtrl.ts' />
/// <reference path='libs/angular-1.0.d.ts' />
/// <reference path='directives/TodoFocus.ts' />
/// <reference path='directives/TodoBlur.ts' />
/// <reference path='controllers/TodoCtrl.ts' />
/// <reference path='services/TodoStorage.ts' />
'use strict';
/**
* The main TodoMVC app module.
*
* @type {angular.Module}
*/
var todomvc = angular.module('todomvc', [])
.controller('todoCtrl', TodoCtrl)
.directive('todoBlur', function () { return new TodoBlur(); })
.directive('todoFocus', function ($timeout: ng.ITimeoutService) { return new TodoFocus($timeout); })
.service('todoStorage', TodoStorage)
;
/// <reference path='../libs/angular-1.0.d.ts' />
/// <reference path='../services/TodoStorage.ts' />
/// <reference path='../models/TodoItem.ts' />
/// <reference path='../interfaces/ITodoStorage.ts' />
/// <reference path='../interfaces/ITodoScope.ts' />
'use strict';
/**
* The main controller for the app. The controller:
* - retrieves and persist the model via the todoStorage service
* - exposes the model to the template and provides event handlers
*/
class TodoCtrl {
private todos;
constructor (private $scope: ITodoScope, $location: ng.ILocationService, private todoStorage: ITodoStorage, private filterFilter) {
this.todos = $scope.todos = todoStorage.get();
$scope.newTodo = "";
$scope.editedTodo = null;
$scope.addTodo = () =>this.addTodo();
$scope.editTodo = (t) =>this.editTodo(t);
$scope.doneEditing = (t) =>this.doneEditing(t);
$scope.removeTodo = (t) =>this.removeTodo(t);
$scope.clearDoneTodos = () =>this.clearDoneTodos();
$scope.markAll = (d) =>this.markAll(d);
$scope.$watch('todos', () =>this.onTodos(), true);
$scope.$watch('location.path()', (path) =>this.onPath(path));
if ($location.path() === '') $location.path('/');
$scope.location = $location;
}
onPath(path) {
this.$scope.statusFilter = (path == '/active') ?
{ completed: false } : (path == '/completed') ?
{ completed: true } : null;
}
onTodos() {
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);
}
addTodo() {
if (!this.$scope.newTodo.length) {
return;
}
this.todos.push({
title: this.$scope.newTodo,
completed: false
});
this.$scope.newTodo = '';
};
editTodo(todo: TodoItem) {
this.$scope.editedTodo = todo;
};
doneEditing(todo: TodoItem) {
this.$scope.editedTodo = null;
if (!todo.title) {
this.$scope.removeTodo(todo);
}
};
removeTodo(todo: TodoItem) {
this.todos.splice(this.todos.indexOf(todo), 1);
};
clearDoneTodos() {
this.$scope.todos = this.todos = this.todos.filter(function (val) {
return !val.completed;
});
};
markAll(done: bool) {
this.todos.forEach(function (todo: TodoItem) {
todo.completed = done;
});
};
}
/// <reference path='../libs/angular-1.0.d.ts' />
'use strict';
/**
* Directive that executes an expression when the element it is applied to loses focus.
*/
class TodoBlur {
public link: ($scope: ng.IScope, elem: JQuery, attrs: any) => any;
constructor () {
this.link = (s, e, a) =>this.linkFn(s, e, a);
}
linkFn($scope: ng.IScope, elem: JQuery, attrs: any): any {
elem.bind('blur', function () {
$scope.$apply(attrs.todoBlur);
});
};
}
/// <reference path='../libs/angular-1.0.d.ts' />
'use strict';
/**
* Directive that places focus on the element it is applied to when the expression it binds to evaluates to true.
*/
class TodoFocus {
public link: ($scope: ng.IScope, elem: JQuery, attrs: any) => any;
constructor (private $timeout: ng.ITimeoutService) {
this.link = (s, e, a) =>this.linkFn(s, e, a);
}
linkFn($scope: ng.IScope, elem: JQuery, attrs: any): any {
$scope.$watch(attrs.todoFocus, function (newval) {
if (newval) {
this.$timeout(function () {
elem[0].focus();
}, 0, false);
}
});
};
}
/// <reference path='../libs/angular-1.0.d.ts' />
/// <reference path='../models/TodoItem.ts' />
'use strict';
interface ITodoScope extends ng.IScope {
todos: TodoItem[];
newTodo: string;
editedTodo: TodoItem;
remainingCount: number;
doneCount: number;
allChecked: bool;
statusFilter: { completed: bool; };
location: ng.ILocationService;
addTodo: () =>void;
editTodo: (item: TodoItem) =>void;
doneEditing: (item: TodoItem) =>void;
removeTodo: (item: TodoItem) =>void;
clearDoneTodos: () =>void;
markAll: (done: bool) =>void;
}
/// <reference path='../libs/angular-1.0.d.ts' />
/// <reference path='../models/TodoItem.ts' />
'use strict';
interface ITodoStorage {
get(): TodoItem[];
put(todos: TodoItem[]);
}
// Type definitions for Angular JS 1.0
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="jquery-1.8.d.ts" />
declare var angular: ng.IAngularStatic;
///////////////////////////////////////////////////////////////////////////////
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
module ng {
// For the sake of simplicity, let's assume jQuery is always preferred
interface IJQLiteOrBetter extends JQuery { }
// All service providers extend this interface
interface IServiceProvider {
$get(): any;
}
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// see http://docs.angularjs.org/api
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
bind(context: any, fn: Function, ...args: any[]): Function;
bootstrap(element: string, modules?: any[]): auto.IInjectorService;
bootstrap(element: IJQLiteOrBetter, modules?: any[]): auto.IInjectorService;
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
copy(source: any, destination?: any): any;
element: IJQLiteOrBetter;
equals(value1: any, value2: any): bool;
extend(destination: any, ...sources: any[]): any;
forEach(obj: any, iterator: (value, key) => any, context?: any): any;
fromJson(json: string): any;
identity(arg?: any): any;
injector(modules?: any[]): auto.IInjectorService;
isArray(value: any): bool;
isDate(value: any): bool;
isDefined(value: any): bool;
isElement(value: any): bool;
isFunction(value: any): bool;
isNumber(value: any): bool;
isObject(value: any): bool;
isString(value: any): bool;
isUndefined(value: any): bool;
lowercase(str: string): string;
module(name: string, requires?: string[], configFunction?: Function): IModule;
noop(...args: any[]): void;
toJson(obj: any, pretty?: bool): string;
uppercase(str: string): string;
version: {
full: string;
major: number;
minor: number;
dot: number;
codename: string;
};
}
///////////////////////////////////////////////////////////////////////////
// Module
// see http://docs.angularjs.org/api/angular.Module
///////////////////////////////////////////////////////////////////////////
interface IModule {
config(configFn: Function): IModule;
config(dependencies: any[]): IModule;
constant(name: string, value: any): IModule;
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
directive(name: string, directiveFactory: Function): IModule;
directive(name: string, dependencies: any[]): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
filter(name: string, filterFactoryFunction: Function): IModule;
filter(name: string, dependencies: any[]): IModule;
provider(name: string, serviceProviderConstructor: Function): IModule;
run(initializationFunction: Function): IModule;
service(name: string, serviceConstructor: Function): IModule;
value(name: string, value: any): IModule;
// Properties
name: string;
requires: string[];
}
///////////////////////////////////////////////////////////////////////////
// Attributes
// see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
///////////////////////////////////////////////////////////////////////////
interface IAttributes {
$set(name: string, value: any): void;
$attr: any;
}
///////////////////////////////////////////////////////////////////////////
// FormController
// see http://docs.angularjs.org/api/ng.directive:form.FormController
///////////////////////////////////////////////////////////////////////////
interface IFormController {
$pristine: bool;
$dirty: bool;
$valid: bool;
$invalid: bool;
$error: any;
}
///////////////////////////////////////////////////////////////////////////
// NgModelController
// see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController
///////////////////////////////////////////////////////////////////////////
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: bool): 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.
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$error: any;
$pristine: bool;
$dirty: bool;
$valid: bool;
$invalid: bool;
}
interface IModelParser {
(value: any): any;
}
interface IModelFormatter {
(value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// Scope
// see http://docs.angularjs.org/api/ng.$rootScope.Scope
///////////////////////////////////////////////////////////////////////////
interface IScope {
// Documentation says exp is optional, but actual implementaton counts on it
$apply(exp: string): any;
$apply(exp: (scope: IScope) => any): any;
$broadcast(name: string, ...args: any[]): IAngularEvent;
$destroy(): void;
$digest(): void;
$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;
// Documentation says exp is optional, but actual implementaton counts on it
$evalAsync(expression: string): void;
$evalAsync(expression: (scope: IScope) => any): void;
// Defaults to false by the implementation checking strategy
$new(isolate?: bool): IScope;
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
/*
$watch(watchExpression: string, listener?: string, objectEquality?: bool): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
$watch(watchExpression: (scope: IScope) => Function, listener?: string, objectEquality?: bool): Function;
$watch(watchExpression: (scope: IScope) => Function, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
*/
$id: number;
}
interface IAngularEvent {
targetScope: IScope;
currentScope: IScope;
name: string;
preventDefault: Function;
defaultPrevented: bool;
// Available only events that were $emit-ted
stopPropagation?: Function;
}
///////////////////////////////////////////////////////////////////////////
// WindowService
// see http://docs.angularjs.org/api/ng.$window
///////////////////////////////////////////////////////////////////////////
interface IWindowService extends Window {}
///////////////////////////////////////////////////////////////////////////
// BrowserService
// TODO undocumented, so we need to get it from the source code
///////////////////////////////////////////////////////////////////////////
interface IBrowserService {}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see http://docs.angularjs.org/api/ng.$timeout
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(func: Function, delay?: number, invokeApply?: bool): IPromise;
cancel(promise: IPromise): bool;
}
///////////////////////////////////////////////////////////////////////////
// FilterService
// see http://docs.angularjs.org/api/ng.$filter
// see http://docs.angularjs.org/api/ng.$filterProvider
///////////////////////////////////////////////////////////////////////////
interface IFilterService {
(name: string): Function;
}
interface IFilterProvider extends IServiceProvider {
register(name: string, filterFactory: Function): IServiceProvider;
}
///////////////////////////////////////////////////////////////////////////
// LocaleService
// see http://docs.angularjs.org/api/ng.$locale
///////////////////////////////////////////////////////////////////////////
interface ILocaleService {
id: string;
// These are not documented
// Check angular's i18n files for exemples
NUMBER_FORMATS: ILocaleNumberFormatDescriptor;
DATETIME_FORMATS: any;
pluralCat: (num: any) => string;
}
interface ILocaleNumberFormatDescriptor {
DECIMAL_SEP: string;
GROUP_SEP: string;
PATTERNS: ILocaleNumberPatternDescriptor[];
CURRENCY_SYM: string;
}
interface ILocaleNumberPatternDescriptor {
minInt: number;
minFrac: number;
maxFrac: number;
posPre: string;
posSuf: string;
negPre: string;
negSuf: string;
gSize: number;
lgSize: number;
}
interface ILacaleDateTimeFormatDescriptor {
MONTH: string[];
SHORTMONTH: string[];
DAY: string[];
SHORTDAY: string[];
AMPMS: string[];
medium: string;
short: string;
fullDate: string;
longDate: string;
mediumDate: string;
shortDate: string;
mediumTime: string;
shortTime: string;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see http://docs.angularjs.org/api/ng.$log
///////////////////////////////////////////////////////////////////////////
interface ILogService {
error: ILogCall;
info: ILogCall;
log: ILogCall;
warn: ILogCall;
}
// We define this as separete interface so we can reopen it later for
// the ngMock module.
interface ILogCall {
(...args: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
// ParseService
// see http://docs.angularjs.org/api/ng.$parse
///////////////////////////////////////////////////////////////////////////
interface IParseService {
(expression: string): ICompiledExpression;
}
interface ICompiledExpression {
(context: any, locals?: any): any;
// If value is not provided, undefined is gonna be used since the implementation
// does not check the parameter. Let's force a value for consistency. If consumer
// whants to undefine it, pass the undefined value explicitly.
assign(context: any, value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// LocationService
// see http://docs.angularjs.org/api/ng.$location
// see http://docs.angularjs.org/api/ng.$locationProvider
// see http://docs.angularjs.org/guide/dev_guide.services.$location
///////////////////////////////////////////////////////////////////////////
interface ILocationService {
absUrl(): string;
hash(): string;
hash(newHash: string): ILocationService;
host(): string;
path(): string;
path(newPath: string): ILocationService;
port(): number;
protocol(): string;
replace(): ILocationService;
search(): string;
search(parametersMap: any): ILocationService;
search(parameter: string, parameterValue: any): ILocationService;
url(): string;
url(url: string): ILocationService;
}
interface ILocationProvider extends IServiceProvider {
hashPrefix(): string;
hashPrefix(prefix: string): ILocationProvider;
html5Mode(): bool;
// Documentation states that parameter is string, but
// implementation tests it as boolean, which makes more sense
// since this is a toggler
html5Mode(active: bool): ILocationProvider;
}
///////////////////////////////////////////////////////////////////////////
// DocumentService
// see http://docs.angularjs.org/api/ng.$document
///////////////////////////////////////////////////////////////////////////
interface IDocumentService extends Document {}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see http://docs.angularjs.org/api/ng.$exceptionHandler
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerService {
(exception: Error, cause?: string): void;
}
///////////////////////////////////////////////////////////////////////////
// RootElementService
// see http://docs.angularjs.org/api/ng.$rootElement
///////////////////////////////////////////////////////////////////////////
interface IRootElementService extends IJQLiteOrBetter {}
///////////////////////////////////////////////////////////////////////////
// QService
// see http://docs.angularjs.org/api/ng.$q
///////////////////////////////////////////////////////////////////////////
interface IQService {
all(promises: IPromise[]): IPromise;
defer(): IDeferred;
reject(reason?: any): IPromise;
when(value: any): IPromise;
}
interface IPromise {
then(successCallback: Function, errorCallback?: Function): IPromise;
}
interface IDeferred {
resolve(value?: any): void;
reject(reason?: string): void;
promise: IPromise;
}
///////////////////////////////////////////////////////////////////////////
// AnchorScrollService
// see http://docs.angularjs.org/api/ng.$anchorScroll
///////////////////////////////////////////////////////////////////////////
interface IAnchorScrollService {
(): void;
}
interface IAnchorScrollProvider extends IServiceProvider {
disableAutoScrolling(): void;
}
///////////////////////////////////////////////////////////////////////////
// CacheFactoryService
// see http://docs.angularjs.org/api/ng.$cacheFactory
///////////////////////////////////////////////////////////////////////////
interface ICacheFactoryService {
// Lets not foce the optionsMap to have the capacity member. Even though
// it's the ONLY option considered by the implementation today, a consumer
// might find it useful to associate some other options to the cache object.
//(cacheId: string, optionsMap?: { capacity: number; }): CacheObject;
(cacheId: string, optionsMap?: { capacity: number; }): ICacheObject;
// Methods bellow are not documented
info(): any;
get(cacheId: string): ICacheObject;
}
interface ICacheObject {
info(): {
id: string;
size: number;
// Not garanteed to have, since it's a non-mandatory option
//capacity: number;
};
put(key: string, value?: any): void;
get(key: string): any;
remove(key: string): void;
removeAll(): void;
destroy(): void;
}
///////////////////////////////////////////////////////////////////////////
// CompileService
// see http://docs.angularjs.org/api/ng.$compile
// see http://docs.angularjs.org/api/ng.$compileProvider
///////////////////////////////////////////////////////////////////////////
interface ICompileService {
(element: string, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
(element: Element, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
(element: IJQLiteOrBetter, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
}
interface ICompileProvider extends IServiceProvider {
directive(name: string, directiveFactory: Function): ICompileProvider;
// Undocumented, but it is there...
directive(directivesMap: any): ICompileProvider;
}
interface ITemplateLinkingFunction {
// Let's hint but not force cloneAttachFn's signature
(scope: IScope, cloneAttachFn?: (clonedElement?: IJQLiteOrBetter, scope?: IScope) => any): IJQLiteOrBetter;
}
///////////////////////////////////////////////////////////////////////////
// ControllerService
// see http://docs.angularjs.org/api/ng.$controller
// see http://docs.angularjs.org/api/ng.$controllerProvider
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
(controllerConstructor: Function, locals?: any): any;
(controllerName: string, locals?: any): any;
}
interface IControlerProvider extends IServiceProvider {
register(name: string, controllerConstructor: Function): void;
register(name: string, dependencyAnnotadedConstructor: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
// HttpService
// see http://docs.angularjs.org/api/ng.$http
///////////////////////////////////////////////////////////////////////////
interface IHttpService {
// At least moethod and url must be provided...
(config: IRequestConfig): IHttpPromise;
get(url: string, RequestConfig?: any): IHttpPromise;
delete(url: string, RequestConfig?: any): IHttpPromise;
head(url: string, RequestConfig?: any): IHttpPromise;
jsonp(url: string, RequestConfig?: any): IHttpPromise;
post(url: string, data: any, RequestConfig?: any): IHttpPromise;
put(url: string, data: any, RequestConfig?: any): IHttpPromise;
defaults: IRequestConfig;
// For debugging, BUT it is documented as public, so...
pendingRequests: any[];
}
// This is just for hinting.
// Some opetions might not be available depending on the request.
// see http://docs.angularjs.org/api/ng.$http#Usage for options explanations
interface IRequestConfig {
method: string;
url: string;
params?: any;
// XXX it has it's own structure... perhaps we should define it in the future
headers?: any;
cache?: any;
timeout?: number;
withCredentials?: bool;
// These accept multiple types, so let's defile them as any
data?: any;
transformRequest?: any;
transformResponse?: any;
}
interface IHttpPromise extends IPromise {
success(callback: (response: IDestructuredResponse) => any): IHttpPromise;
error(callback: (response: IDestructuredResponse) => any): IHttpPromise;
}
interface IDestructuredResponse {
data: any;
status: number;
headers: (headerName: string) => string;
config: IRequestConfig;
}
interface IHttpProvider extends IServiceProvider {
defaults: IRequestConfig;
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see http://docs.angularjs.org/api/ng.$httpBackend
// You should never need to use this service directly.
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
// XXX Perhaps define callback signature in the future
(method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: bool); void;
}
///////////////////////////////////////////////////////////////////////////
// InterpolateService
// see http://docs.angularjs.org/api/ng.$interpolate
// see http://docs.angularjs.org/api/ng.$interpolateProvider
///////////////////////////////////////////////////////////////////////////
interface IInterpolateService {
(text: string, mustHaveExpression?: bool): IInterpolationFunction;
endSymbol(): string;
startSymbol(): string;
}
interface IInterpolationFunction {
(context: any): string;
}
interface IInterpolateProvider extends IServiceProvider {
startSymbol(): string;
startSymbol(value: string): IInterpolateProvider;
endSymbol(): string;
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 {}
///////////////////////////////////////////////////////////////////////////
// RootScopeService
// see http://docs.angularjs.org/api/ng.$rootScope
///////////////////////////////////////////////////////////////////////////
interface IRootScopeService extends IScope {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ng.$route
// see http://docs.angularjs.org/api/ng.$routeProvider
///////////////////////////////////////////////////////////////////////////
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;
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
template?: string;
templateUrl?: string;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: bool;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
}
interface IRouteProviderProvider extends IServiceProvider {
otherwise(params: any): IRouteProviderProvider;
when(path: string, route: IRoute): IRouteProviderProvider;
}
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export module auto {
///////////////////////////////////////////////////////////////////////
// InjectorService
// see http://docs.angularjs.org/api/AUTO.$injector
///////////////////////////////////////////////////////////////////////
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotadedFunction: any[]): string[];
get(name: string): any;
instantiate(typeConstructor: Function, locals?: any): any;
invoke(func: Function, context?: any, locals?: any): any;
}
///////////////////////////////////////////////////////////////////////
// ProvideService
// see http://docs.angularjs.org/api/AUTO.$provide
///////////////////////////////////////////////////////////////////////
interface IProvideService {
// Documentation says it returns the registered instance, but actual
// implementation does not return anything.
// constant(name: string, value: any): any;
constant(name: string, value: any): void;
decorator(name: string, decorator: Function): void;
factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider;
provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider;
provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider;
service(name: string, constructor: Function): ng.IServiceProvider;
value(name: string, value: any): ng.IServiceProvider;
}
}
}
\ No newline at end of file
/* *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
// Typing for the jQuery library, version 1.7.x
/*
Interface for the AJAX setting that will configure the AJAX request
*/
interface JQueryAjaxSettings {
accepts?: any;
async?: bool;
beforeSend?(jqXHR: JQueryXHR, settings: JQueryAjaxSettings);
cache?: bool;
complete?(jqXHR: JQueryXHR, textStatus: string);
contents?: { [key: string]: any; };
contentType?: string;
context?: any;
converters?: { [key: string]: any; };
crossDomain?: bool;
data?: any;
dataFilter?(data: any, ty: any): any;
dataType?: string;
error?(jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any;
global?: bool;
headers?: { [key: string]: any; };
ifModified?: bool;
isLocal?: bool;
jsonp?: string;
jsonpCallback?: any;
mimeType?: string;
password?: string;
processData?: bool;
scriptCharset?: string;
statusCode?: { [key: string]: any; };
success?(data: any, textStatus: string, jqXHR: JQueryXHR);
timeout?: number;
traditional?: bool;
type?: string;
url?: string;
username?: string;
xhr?: any;
xhrFields?: { [key: string]: any; };
}
/*
Interface for the jqXHR object
*/
interface JQueryXHR extends XMLHttpRequest, JQueryPromise {
overrideMimeType();
}
/*
Interface for the JQuery callback
*/
interface JQueryCallback {
add(...callbacks: any[]): any;
disable(): any;
empty(): any;
fire(...arguments: any[]): any;
fired(): bool;
fireWith(context: any, ...args: any[]): any;
has(callback: any): bool;
lock(): any;
locked(): bool;
removed(...callbacks: any[]): any;
}
/*
Interface for the JQuery promise, part of callbacks
*/
interface JQueryPromise {
always(...alwaysCallbacks: any[]): JQueryDeferred;
done(...doneCallbacks: any[]): JQueryDeferred;
fail(...failCallbacks: any[]): JQueryDeferred;
pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise;
then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryDeferred;
}
/*
Interface for the JQuery deferred, part of callbacks
*/
interface JQueryDeferred extends JQueryPromise {
notify(...args: any[]): JQueryDeferred;
notifyWith(context: any, ...args: any[]): JQueryDeferred;
pipe(doneFilter?: any, failFilter?: any, progressFilter?: any): JQueryPromise;
progress(...progressCallbacks: any[]): JQueryDeferred;
reject(...args: any[]): JQueryDeferred;
rejectWith(context:any, ...args: any[]): JQueryDeferred;
resolve(...args: any[]): JQueryDeferred;
resolveWith(context:any, ...args: any[]): JQueryDeferred;
state(): string;
then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryDeferred;
}
/*
Interface of the JQuery extension of the W3C event object
*/
interface JQueryEventObject extends Event {
data: any;
delegateTarget: Element;
isDefaultPrevented(): bool;
isImmediatePropogationStopped(): bool;
isPropogationStopped(): bool;
namespace: string;
preventDefault(): any;
relatedTarget: Element;
result: any;
stopImmediatePropagation();
stopPropagation();
pageX: number;
pageY: number;
which: number;
metaKey: any;
}
/*
Collection of properties of the current browser
*/
interface JQueryBrowserInfo {
safari:bool;
opera:bool;
msie:bool;
mozilla:bool;
version:string;
}
interface JQuerySupport {
ajax?: bool;
boxModel?: bool;
changeBubbles?: bool;
checkClone?: bool;
checkOn?: bool;
cors?: bool;
cssFloat?: bool;
hrefNormalized?: bool;
htmlSerialize?: bool;
leadingWhitespace?: bool;
noCloneChecked?: bool;
noCloneEvent?: bool;
opacity?: bool;
optDisabled?: bool;
optSelected?: bool;
scriptEval?(): bool;
style?: bool;
submitBubbles?: bool;
tbody?: bool;
}
/*
Static members of jQuery (those on $ and jQuery themselves)
*/
interface JQueryStatic {
/****
AJAX
*****/
ajax(settings: JQueryAjaxSettings): JQueryXHR;
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;
ajaxSetup(options: any);
get(url: string, data?: any, success?: any, dataType?: any): JQueryXHR;
getJSON(url: string, data?: any, success?: any): JQueryXHR;
getScript(url: string, success?: any): JQueryXHR;
param(obj: any): string;
param(obj: any, traditional: bool): string;
post(url: string, data?: any, success?: any, dataType?: any): JQueryXHR;
/*********
CALLBACKS
**********/
Callbacks(flags: any): JQueryCallback;
/****
CORE
*****/
holdReady(hold: bool): any;
(selector: string, context?: any): JQuery;
(element: Element): JQuery;
(object: { }): JQuery;
(elementArray: Element[]): JQuery;
(object: JQuery): JQuery;
(func: Function): JQuery;
(array: any[]): JQuery;
(): JQuery;
noConflict(removeAll?: bool): Object;
when(...deferreds: any[]): JQueryPromise;
/***
CSS
****/
css(e: any, propertyName: string, value?: any);
css(e: any, propertyName: any, value?: any);
cssHooks: { [key: string]: any; };
/****
DATA
*****/
data(element: Element, key: string, value: any): Object;
dequeue(element: Element, queueName?: string): any;
hasData(element: Element): bool;
queue(element: Element, queueName?: string): any[];
queue(element: Element, queueName: string, newQueueOrCallback: any): JQuery;
removeData(element: Element, name?: string): JQuery;
/*******
EFFECTS
********/
fx: { tick: () => void; interval: number; stop: () => void; speeds: { slow: number; fast: number; }; off: bool; step: any; };
/******
EVENTS
*******/
proxy(context: any, name: any): any;
/*********
INTERNALS
**********/
error(message: any);
/*************
MISCELLANEOUS
**************/
expr: any;
fn: any; //TODO: Decide how we want to type this
isReady: bool;
/**********
PROPERTIES
***********/
browser: JQueryBrowserInfo;
support: JQuerySupport;
/*********
UTILITIES
**********/
contains(container: Element, contained: Element): bool;
each(collection: any, callback: (indexInArray: any, valueOfElement: any) => any): any;
extend(target: any, ...objs: any[]): Object;
extend(deep: bool, target: any, ...objs: any[]): Object;
globalEval(code: string): any;
grep(array: any[], func: any, invert: bool): any[];
inArray(value: any, array: any[], fromIndex?: number): number;
isArray(obj: any): bool;
isEmptyObject(obj: any): bool;
isFunction(obj: any): bool;
isNumeric(value: any): bool;
isPlainObject(obj: any): bool;
isWindow(obj: any): bool;
isXMLDoc(node: Node): bool;
makeArray(obj: any): any[];
map(array: any[], callback: (elementOfArray: any, indexInArray: any) =>any): JQuery;
merge(first: any[], second: any[]): any[];
noop(): any;
now(): number;
parseJSON(json: string): Object;
//FIXME: This should return an XMLDocument
parseXML(data: string): any;
queue(element: Element, queueName: string, newQueue: any[]): JQuery;
trim(str: string): string;
type(obj: any): string;
unique(arr: any[]): any[];
}
/*
The jQuery instance members
*/
interface JQuery {
/****
AJAX
*****/
ajaxComplete(handler: any): JQuery;
ajaxError(handler: (evt: any, xhr: any, opts: any) => any): JQuery;
ajaxSend(handler: (evt: any, xhr: any, opts: any) => any): JQuery;
ajaxStart(handler: () => any): JQuery;
ajaxStop(handler: () => any): JQuery;
ajaxSuccess(handler: (evt: any, xml: any, opts: any) => any): JQuery;
load(url: string, data?: any, complete?: any): JQuery;
serialize(): string;
serializeArray(): any[];
/**********
ATTRIBUTES
***********/
addClass(classNames: string): JQuery;
addClass(func: (index: any, currentClass?: any) => string): 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;
hasClass(className: string): bool;
html(htmlString: string): JQuery;
html(): string;
prop(propertyName: string): string;
prop(propertyName: string, value: any): JQuery;
prop(map: any): JQuery;
prop(propertyName: string, func: (index: any, oldPropertyValue: any) => any): JQuery;
removeAttr(attributeName: any): JQuery;
removeClass(className?: any): JQuery;
removeClass(func: (index: any, cls: any) => any): JQuery;
removeProp(propertyName: any): JQuery;
toggleClass(className: any, swtch?: bool): JQuery;
toggleClass(swtch?: bool): JQuery;
toggleClass(func: (index: any, cls: any, swtch: any) => any): JQuery;
val(): any;
val(value: string[]): JQuery;
val(value: string): JQuery;
val(func: (index: any, value: any) => any): JQuery;
/***
CSS
****/
css(propertyName: string, value?: any);
css(propertyName: any, value?: any);
height(): number;
height(value: number): JQuery;
height(func: (index: any, height: any) => any): JQuery;
innerHeight(): number;
innerWidth(): number;
offset(): Object;
offset(coordinates: any): JQuery;
offset(func: (index: any, coords: any) => any): JQuery;
outerHeight(includeMargin?: bool): number;
outerWidth(includeMargin?: bool): number;
position(): { top: number; left: number; };
scrollLeft(): number;
scrollLeft(value: number): JQuery;
scrollTop(): number;
scrollTop(value: number): JQuery;
width(): number;
width(value: number): JQuery;
width(func: (index: any, height: any) => any): JQuery;
/****
DATA
*****/
clearQueue(queueName?: string): JQuery;
data(key: string, value: any): JQuery;
data(obj: { [key: string]: any; }): JQuery;
data(key?: string): any;
dequeue(queueName?: string): JQuery;
removeData(nameOrList?: any): JQuery;
/********
DEFERRED
*********/
promise(type?: any, target?: any): JQueryPromise;
/*******
EFFECTS
********/
animate(properties: any, duration?: any, easing?: string, complete?: Function): JQuery;
animate(properties: any, options: { duration?: any; easing?: string; complete?: Function; step?: Function; queue?: bool; specialEasing?: any; });
delay(duration: number, queueName?: string): JQuery;
fadeIn(duration?: any, callback?: any): JQuery;
fadeIn(duration?: any, easing?: string, callback?: any): JQuery;
fadeOut(duration?: any, callback?: any): JQuery;
fadeOut(duration?: any, easing?: string, callback?: any): JQuery;
fadeTo(duration: any, opacity: number, callback?: any): JQuery;
fadeTo(duration: any, opacity: number, easing?: string, callback?: any): JQuery;
fadeToggle(duration?: any, easing?: string, callback?: any): JQuery;
hide(duration?: any, callback?: any): JQuery;
hide(duration?: any, easing?: string, callback?: any): JQuery;
show(duration?: any, callback?: any): JQuery;
show(duration?: any, easing?: string, callback?: any): JQuery;
slideDown(duration?: any, callback?: any): JQuery;
slideDown(duration?: any, easing?: string, callback?: any): JQuery;
slideToggle(duration?: any, callback?: any): JQuery;
slideToggle(duration?: any, easing?: string, callback?: any): JQuery;
slideUp(duration?: any, callback?: any): JQuery;
slideUp(duration?: any, easing?: string, callback?: any): JQuery;
stop(clearQueue?: bool, jumpToEnd?: bool): JQuery;
stop(queue?:any, clearQueue?: bool, jumpToEnd?: bool): JQuery;
toggle(duration?: any, callback?: any): JQuery;
toggle(duration?: any, easing?: string, callback?: any): JQuery;
toggle(showOrHide: bool): JQuery;
/******
EVENTS
*******/
bind(eventType: string, eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
bind(eventType: string, eventData: any, preventBubble:bool): JQuery;
bind(eventType: string, preventBubble:bool): JQuery;
bind(...events: any[]);
blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
change(handler: (eventObject: JQueryEventObject) => any): JQuery;
click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
click(handler: (eventObject: JQueryEventObject) => any): JQuery;
dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery;
delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
focus(handler: (eventObject: JQueryEventObject) => any): JQuery;
focusin(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
focusin(handler: (eventObject: JQueryEventObject) => any): JQuery;
focusout(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
focusout(handler: (eventObject: JQueryEventObject) => any): JQuery;
hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery;
hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery;
keydown(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
keydown(handler: (eventObject: JQueryEventObject) => any): JQuery;
keypress(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
keypress(handler: (eventObject: JQueryEventObject) => any): JQuery;
keyup(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
keyup(handler: (eventObject: JQueryEventObject) => any): JQuery;
mousedown(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mousedown(handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseevent(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseevent(handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseleave(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseleave(handler: (eventObject: JQueryEventObject) => any): JQuery;
mousemove(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mousemove(handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseout(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseout(handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseover(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseover(handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseup(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
mouseup(handler: (eventObject: JQueryEventObject) => any): JQuery;
off(events?: string, selector?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
off(eventsMap: { [key: string]: any; }, selector?: any): JQuery;
on(events: string, selector?: any, data?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
on(eventsMap: { [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;
ready(handler: any): JQuery;
resize(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
resize(handler: (eventObject: JQueryEventObject) => any): JQuery;
scroll(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
scroll(handler: (eventObject: JQueryEventObject) => any): JQuery;
select(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
select(handler: (eventObject: JQueryEventObject) => any): JQuery;
submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
submit(handler: (eventObject: JQueryEventObject) => any): JQuery;
trigger(eventType: string, ...extraParameters: any[]): JQuery;
trigger(event: JQueryEventObject): JQuery;
triggerHandler(eventType: string, ...extraParameters: any[]): Object;
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
unbind(eventType: string, fls: bool): JQuery;
unbind(evt: any): JQuery;
undelegate(): JQuery;
undelegate(selector: any, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
undelegate(selector: any, events: any): JQuery;
undelegate(namespace: string): JQuery;
/*********
INTERNALS
**********/
context: Element;
jquery: string;
pushStack(elements: any[]): JQuery;
pushStack(elements: any[], name: any, arguments: any): JQuery;
/************
MANIPULATION
*************/
after(...content: any[]): JQuery;
after(func: (index: any) => any);
append(...content: any[]): JQuery;
append(func: (index: any, html: any) => any);
appendTo(target: any): JQuery;
before(...content: any[]): JQuery;
before(func: (index: any) => any);
clone(withDataAndEvents?: bool, deepWithDataAndEvents?: bool): JQuery;
detach(selector?: any): JQuery;
empty(): JQuery;
insertAfter(target: any): JQuery;
insertBefore(target: any): JQuery;
prepend(...content: any[]): JQuery;
prepend(func: (index: any, html: any) =>any): JQuery;
prependTo(target: any): JQuery;
remove(selector?: any): JQuery;
replaceAll(target: any): JQuery;
replaceWith(func: any): JQuery;
text(textString: string): JQuery;
text(): string;
toArray(): any[];
unwrap(): JQuery;
wrap(wrappingElement: any): JQuery;
wrap(func: (index: any) =>any): JQuery;
wrapAll(wrappingElement: any): JQuery;
wrapInner(wrappingElement: any): JQuery;
wrapInner(func: (index: any) =>any): JQuery;
/*************
MISCELLANEOUS
**************/
each(func: (index: any, elem: Element) => JQuery);
get(index?: number): any;
index(selectorOrElement?: any): number;
/**********
PROPERTIES
***********/
length: number;
[x: string]: HTMLElement;
[x: number]: HTMLElement;
/**********
TRAVERSING
***********/
add(selector: string, context?: any): JQuery;
add(...elements: any[]): JQuery;
add(html: string): JQuery;
add(obj: JQuery): JQuery;
andSelf(): JQuery;
children(selector?: any): JQuery;
closest(selector: string): JQuery;
closest(selector: string, context?: Element): JQuery;
closest(obj: JQuery): JQuery;
closest(element: any): JQuery;
closest(selectors: any, context?: Element): any[];
contents(): JQuery;
end(): JQuery;
eq(index: number): JQuery;
filter(selector: string): JQuery;
filter(func: (index: any) =>any): JQuery;
filter(element: any): JQuery;
filter(obj: JQuery): JQuery;
find(selector: string): JQuery;
find(element: any): JQuery;
find(obj: JQuery): JQuery;
first(): JQuery;
has(selector: string): JQuery;
has(contained: Element): JQuery;
is(selector: string): JQuery;
is(func: (index: any) =>any): JQuery;
is(element: any): JQuery;
is(obj: JQuery): JQuery;
last(): JQuery;
map(callback: (index: any, domElement: Element) =>any): JQuery;
next(selector?: string): JQuery;
nextAll(selector?: string): JQuery;
nextUntil(selector?: string, filter?: string): JQuery;
nextUntil(element?: Element, filter?: string): JQuery;
not(selector: string): JQuery;
not(func: (index: any) =>any): JQuery;
not(element: any): JQuery;
not(obj: JQuery): JQuery;
offsetParent(): JQuery;
parent(selector?: string): JQuery;
parents(selector?: string): JQuery;
parentsUntil(selector?: string, filter?: string): JQuery;
parentsUntil(element?: Element, filter?: string): JQuery;
prev(selector?: string): JQuery;
prevAll(selector?: string): JQuery;
prevUntil(selector?: string, filter?:string): JQuery;
prevUntil(element?: Element, filter?:string): JQuery;
siblings(selector?: string): JQuery;
slice(start: number, end?: number): JQuery;
/*********
UTILITIES
**********/
queue(queueName?: string): any[];
queue(queueName: string, newQueueOrCallback: any): JQuery;
queue(newQueueOrCallback: any): JQuery;
}
declare var jQuery: JQueryStatic;
declare var $: JQueryStatic;
/// <reference path='../libs/angular-1.0.d.ts' />
'use strict';
class TodoItem {
public completed: bool;
public title: string;
}
/// <reference path='../libs/angular-1.0.d.ts' />
/// <reference path='../models/TodoItem.js' />
/// <reference path='../interfaces/ITodoStorage.js' />
'use strict';
/**
* Services that persists and retrieves TODOs from localStorage.
*/
class TodoStorage implements ITodoStorage {
STORAGE_ID = 'todos-angularjs-requirejs';
get(): TodoItem[] {
return JSON.parse(localStorage.getItem(this.STORAGE_ID) || '[]');
}
put(todos: TodoItem[]) {
localStorage.setItem(this.STORAGE_ID, JSON.stringify(todos));
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0A2B594A-1E06-46A8-A3B8-4E58C1071815}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>todo</RootNamespace>
<AssemblyName>todo</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:63825/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<ItemGroup>
<Content Include="index.html" />
<Content Include="js\app.js">
<DependentUpon>app.ts</DependentUpon>
</Content>
<Content Include="js\app.ts" />
<Content Include="js\controllers\TodoCtrl.js">
<DependentUpon>TodoCtrl.ts</DependentUpon>
</Content>
<Content Include="js\controllers\TodoCtrl.ts" />
<Content Include="js\directives\TodoBlur.js">
<DependentUpon>TodoBlur.ts</DependentUpon>
</Content>
<Content Include="js\directives\TodoBlur.ts" />
<Content Include="js\directives\TodoFocus.js">
<DependentUpon>TodoFocus.ts</DependentUpon>
</Content>
<Content Include="js\directives\TodoFocus.ts" />
<Content Include="js\interfaces\ITodoScope.js">
<DependentUpon>ITodoScope.ts</DependentUpon>
</Content>
<Content Include="js\interfaces\ITodoScope.ts" />
<Content Include="js\interfaces\ITodoStorage.js">
<DependentUpon>ITodoStorage.ts</DependentUpon>
</Content>
<Content Include="js\interfaces\ITodoStorage.ts" />
<Content Include="js\libs\angular-1.0.d.ts" />
<Content Include="js\libs\angular\angular.min.js" />
<Content Include="js\libs\jquery-1.8.d.ts" />
<Content Include="js\models\TodoItem.js">
<DependentUpon>TodoItem.ts</DependentUpon>
</Content>
<Content Include="js\models\TodoItem.ts" />
<Content Include="js\services\TodoStorage.ts" />
<Content Include="js\_all.js">
<DependentUpon>_all.ts</DependentUpon>
</Content>
<Content Include="js\_all.ts" />
</ItemGroup>
<ItemGroup>
<Content Include="ReadMe.md" />
</ItemGroup>
<ItemGroup>
<Content Include="js\directives\TodoBlur.js.map">
<DependentUpon>TodoBlur.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="js\directives\TodoFocus.js.map">
<DependentUpon>TodoFocus.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="js\app.js.map">
<DependentUpon>app.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="js\controllers\TodoCtrl.js.map">
<DependentUpon>TodoCtrl.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="js\_all.js.map">
<DependentUpon>_all.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="js\models\TodoItem.js.map">
<DependentUpon>TodoItem.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="compileTs.cmd" />
</ItemGroup>
<ItemGroup>
<Content Include="js\interfaces\ITodoScope.js.map">
<DependentUpon>ITodoScope.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="js\interfaces\ITodoStorage.js.map">
<DependentUpon>ITodoStorage.ts</DependentUpon>
</Content>
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "todo", "todo.csproj", "{0A2B594A-1E06-46A8-A3B8-4E58C1071815}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A2B594A-1E06-46A8-A3B8-4E58C1071815}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A2B594A-1E06-46A8-A3B8-4E58C1071815}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A2B594A-1E06-46A8-A3B8-4E58C1071815}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A2B594A-1E06-46A8-A3B8-4E58C1071815}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
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