Skip to content
This repository was archived by the owner on Oct 5, 2024. It is now read-only.

Commit ef6e1ff

Browse files
author
Aleš Roubíček
committed
Initial commit
1 parent de078ee commit ef6e1ff

File tree

1 file changed

+333
-0
lines changed

1 file changed

+333
-0
lines changed

Angular.d.ts

Lines changed: 333 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,333 @@
1+
declare interface AngularVersion {
2+
full: string;
3+
major: number;
4+
minor: number;
5+
dot: number;
6+
codeName: string;
7+
}
8+
9+
declare interface AngularModule {
10+
requires: string[];
11+
name: string;
12+
provider(name: string, providerType: Function): AngularModule;
13+
factory(name: string, providerFunction: Function): AngularModule;
14+
service(name: string, constructor: Function): AngularModule;
15+
value(name: string, object: any): AngularModule;
16+
constant(name: string, object: any): AngularModule;
17+
filter(name: string, filterFactory: Function): AngularModule;
18+
controller(name: string, constructor: Function): AngularModule;
19+
directive(name: string, directiveFactory: Function): AngularModule;
20+
config(configFn: Function): AngularModule;
21+
run(initializationFn: Function): AngularModule;
22+
}
23+
24+
declare interface AngularInjector {
25+
get(name: string): any;
26+
invoke(fn: Function, self?: any, locals?: any): any;
27+
instantiate(constructor: any, locals?: Object): any;
28+
annotate(fn: Function): string[];
29+
annotate(fns: string[]): string[];
30+
annotate(fns: Function[]): string[];
31+
}
32+
33+
declare interface AngularStatic {
34+
bootstrap(element: Element, modules: string[]): any;
35+
bootstrap(element: Element, modules: Function[]): any;
36+
copy(source: any, destination: Object): Object;
37+
copy(source: any, destination: Array): Array;
38+
extend(dest: Object, ...src: any[]): Object;
39+
equals(o1: any, o2: any): bool;
40+
element(element: string): jQuery;
41+
element(element: Element): jQuery;
42+
forEach(obj: Array, iterator: (value: any, index?: number) => void, context?: any): Array;
43+
forEach(obj: Object, iterator: (value: any, key?: string) => void, context?: any): Object;
44+
injector(modules: string[]): AngularInjector;
45+
injector(modules: Function[]): AngularInjector;
46+
module(name: string, requesires?: string[], configFn?: Function): AngularModule;
47+
module(name: string, configFn: Function): AngularModule;
48+
noop(): void;
49+
bind(self: Object, fn: Function, ...args: any[]): Function;
50+
toJson(obj: any, pretty: bool): string;
51+
fromJson(json: string): any;
52+
identity(...$: any[]): any;
53+
isUndefined(value: any): bool;
54+
isDefined(value: any): bool;
55+
isObject(value: any): bool;
56+
isString(value: any): bool;
57+
isNumber(value: any): bool;
58+
isDate(value: any): bool;
59+
isArray(value: any): bool;
60+
isFunction(value: any): bool;
61+
isElement(value: any): bool;
62+
lowercase(string: string): string;
63+
uppercase(string: string): string;
64+
//callbacks
65+
version: AngularVersion;
66+
}
67+
68+
declare module ng {
69+
70+
export interface Deregistration {
71+
();
72+
}
73+
74+
export interface CacheInfo {
75+
id: string;
76+
size: number;
77+
}
78+
79+
export interface Cache {
80+
put(key: string, value: any);
81+
get(key: string): any;
82+
remove(key: string);
83+
removeALl();
84+
destroy();
85+
info(): CacheInfo;
86+
}
87+
88+
export interface Provider {
89+
register(name: string, constructor: Function);
90+
}
91+
92+
export interface HttpConfig {
93+
method: string;
94+
url: string;
95+
params: Object;
96+
data: any;
97+
headers: Object;
98+
transformRequest: (data: any, headersGetter: () => Object) => void;
99+
transformResponse: (data: any, headersGetter: () => Object) => void;
100+
cache: Cache;
101+
timeout: number;
102+
withCredentials: bool;
103+
responseType: string;
104+
}
105+
106+
export interface HttpResponse {
107+
data: any;
108+
status: number;
109+
headers: (name: string) => string;
110+
config: HttpConfig;
111+
}
112+
113+
export interface HttpPromise {
114+
then(success: (response: HttpResponse) => void, error?: (response: HttpResponse) => void);
115+
success(callback: (response: HttpResponse) => void);
116+
error(callback: (response: HttpResponse) => void);
117+
}
118+
119+
export interface Http {
120+
(config: HttpConfig) : HttpPromise;
121+
pendingRequests: HttpConfig[];
122+
get(url: string, config?: HttpConfig): HttpPromise;
123+
delete(url: string, config?: HttpConfig): HttpPromise;
124+
head(url: string, config?: HttpConfig): HttpPromise;
125+
jsonp(url: string, config?: HttpConfig): HttpPromise;
126+
post(url: string, data: any, config?: HttpConfig): HttpPromise;
127+
put(url: string, data: any, config?: HttpConfig): HttpPromise;
128+
defaults: HttpConfig;
129+
}
130+
131+
export interface InterpolateProvider {
132+
startSymbol(): string;
133+
startSymbol(value: string): InterpolateProvider;
134+
endSymbol(): string;
135+
endSymbol(value: string): InterpolateProvider;
136+
}
137+
138+
export interface Interpolate {
139+
(text: string, mustHaveExpression?: bool): (context: Object) => string;
140+
startSymbol(): string;
141+
endSymbol(): string;
142+
}
143+
144+
export interface Location {
145+
absUrl(): string;
146+
url(): string;
147+
url(url: string): Location;
148+
protocol(): string;
149+
host(): string;
150+
port(): number;
151+
path(): string;
152+
path(path: string): Location;
153+
search(): string;
154+
search(search: string): Location;
155+
search(search: string, paramValue: string): Location;
156+
search(search: Object): Location;
157+
hash(): string;
158+
hash(hash: string): Location;
159+
replace(): Location;
160+
}
161+
162+
export interface LocationProvider {
163+
hashPrefix(): string;
164+
hashPrefix(prefix: string): LocationProvider;
165+
html5Mode(): any;
166+
html5Mode(mode: string): LocationProvider;
167+
}
168+
169+
export interface Log {
170+
log(...args: any[]);
171+
warn(...args: any[]);
172+
info(...args: any[]);
173+
error(...args: any[]);
174+
}
175+
176+
export interface Promise {
177+
then(successCallback: (result: any) => any, errorCallback?: (reason: any) => any): Promise;
178+
}
179+
180+
export interface Deferred {
181+
resolve(value);
182+
reject(reason);
183+
promise: Promise;
184+
}
185+
186+
export interface DeferredFactory {
187+
defer(): Deferred;
188+
reject(reason: any): Promise;
189+
when(value: any, success?: (result: any) => any, error?: (reason: any) => any): Promise;
190+
all(promises: Promise[]): Promise;
191+
}
192+
193+
export interface ScopeProvider {
194+
digestTtl(limit: number);
195+
}
196+
197+
export interface Scope {
198+
$new(isolate: bool): Scope;
199+
$watch(watchExpression: string, listener?: string, objectEquality?: bool): Deregistration;
200+
$watch(watchExpression: string, listener?: (newValue?: any, oldValue?: any, scope?: Scope) => any, objectEquality?: bool): Deregistration;
201+
$watch(watchExpression: (scope: Scope) => any, listener?: string, objectEquality?: bool): Deregistration;
202+
$watch(watchExpression: (scope: Scope) => any, listener?: (newValue?: any, oldValue?: any, scope?: Scope) => any, objectEquality?: bool): Deregistration;
203+
$digest();
204+
$destroy();
205+
$eval(): any;
206+
$eval(expression: string): any;
207+
$eval(expression: (scope?: Scope) => any): any;
208+
$evalAsync();
209+
$evalAsync(expression: string);
210+
$evalAsync(expression: (scope?: Scope) => any);
211+
$apply(): any;
212+
$apply(expression: string): any;
213+
$apply(expression: (scope?: Scope) => any): any;
214+
$on(name: string, listener: (event: Event) => any): Deregistration;
215+
$emit(name: string, ...args: any[]): Event;
216+
$broadcast(name: string, ...args: any[]): Event;
217+
}
218+
219+
export interface RouteMap {
220+
[key: string]: Function;
221+
}
222+
223+
export interface Route {
224+
controller?: any;
225+
template?: string;
226+
templateUrl?: string;
227+
resolve?: RouteMap;
228+
key: string;
229+
factory: any;
230+
redirectTo?: any;
231+
}
232+
233+
export interface RouteProvider {
234+
when(path: string, route: Route) : RouteProvider;
235+
otherwise(route: Route): RouteProvider;
236+
}
237+
238+
export interface RouteStatic {
239+
current: Route;
240+
routes: Route[];
241+
reload();
242+
}
243+
244+
export interface Timeout {
245+
(fn: Function, delay?: number, invokeApply?: bool): Promise;
246+
cancel(promise?: Promise): bool;
247+
}
248+
}
249+
250+
declare module ngCookies {
251+
export interface Cookies {
252+
[name: string]: Object;
253+
}
254+
255+
export interface CookieStore {
256+
get(key: string): Object;
257+
put(key: string, value: Object);
258+
remove(key: string);
259+
}
260+
}
261+
262+
declare module ngResource {
263+
export interface Action {
264+
method?: string;
265+
params?: Object;
266+
isArray?: bool;
267+
headers?: Object;
268+
}
269+
270+
export interface ActionHash {
271+
[action: string]: Action;
272+
}
273+
274+
export interface Resource {
275+
get(parameters?: Object, success?: Function, error?: Function): ResourceItem;
276+
save(postData: Object, success?: Function, error?: Function);
277+
save(postData: Array, success?: Function, error?: Function);
278+
save(parameters: Object, postData: Object, success?: Function, error?: Function);
279+
save(parameters: Object, postData: Array, success?: Function, error?: Function);
280+
query(parameters?: Object, success?: Function, error?: Function): ResourceItem[];
281+
remove(postData: Object, success?: Function, error?: Function);
282+
remove(postData: Array, success?: Function, error?: Function);
283+
remove(parameters: Object, postData: Object, success?: Function, error?: Function);
284+
remove(parameters: Object, postData: Array, success?: Function, error?: Function);
285+
delete(postData: Object, success?: Function, error?: Function);
286+
delete(postData: Array, success?: Function, error?: Function);
287+
delete(parameters: Object, postData: Object, success?: Function, error?: Function);
288+
delete(parameters: Object, postData: Array, success?: Function, error?: Function);
289+
}
290+
291+
export interface ResourceItem {
292+
$save(parameters?: Object, success?: Function, error?: Function);
293+
$remove(parameters?: Object, success?: Function, error?: Function);
294+
$delete(parameters?: Object, success?: Function, error?: Function);
295+
}
296+
}
297+
298+
declare var angular: AngularStatic;
299+
declare function $anchorScroll();
300+
declare function $cacheFactory(cacheId: string, options?: Object): ng.Cache;
301+
declare var $templateCache: ng.Cache;
302+
// TODO: $compile
303+
declare var $controllerProvider: ng.Provider;
304+
declare function $controller(constructor: Function, locals: Object): Object;
305+
declare function $controller(constructor: string, locals: Object): Object;
306+
declare var $document: jQuery;
307+
declare function $exceptionHandler(exception: Error, cause?: string);
308+
declare var $filterProvider: ng.Provider;
309+
declare function $filter(name: string): Function;
310+
declare var $http: ng.Http;
311+
declare var $interpolateProvider: ng.InterpolateProvider;
312+
declare var $interpolate: ng.Interpolate;
313+
declare var $locale: string;
314+
declare var $location: ng.Location;
315+
declare var $locationProvider: ng.LocationProvider;
316+
declare var $log: ng.Log;
317+
declare function $parse(expression: string): (context: Object, locals: Object) => any;
318+
declare var $q: ng.DeferredFactory;
319+
declare var $rootElement: jQuery;
320+
declare var $rootScopeProvider: ng.ScopeProvider;
321+
declare var $rootScope: ng.Scope;
322+
declare var $routeProvider: ng.RouteProvider;
323+
declare var $route: ng.RouteStatic;
324+
declare var $routeParams: Object;
325+
declare var $timeout: ng.Timeout;
326+
declare var $window: Window;
327+
328+
declare var $cookies: ngCookies.Cookies;
329+
declare var $cookieStore: ngCookies.CookieStore;
330+
331+
declare function $resource(url: string, paramDefaults?: Object, actions?: ngResource.ActionHash): ngResource.Resource;
332+
333+
declare function $sanitize(html: string): string;

0 commit comments

Comments
 (0)