Commit 58bfed19f1cdd26ff88dd3ad62f5b53aac94ff06
1 parent
a1f403ae
Exists in
master
and in
35 other branches
added restangular typings and content-viewer controller to ng-forward syntax
Showing
17 changed files
with
12594 additions
and
13 deletions
Show diff stats
.gitignore
src/app/content-viewer/content-viewer.controller.ts
1 | + | |
2 | +import * as noosfero from "../models/interfaces"; | |
3 | + | |
1 | 4 | import {ArticleDirective, ArticleView} from "../components/noosfero-articles/article/article.directive"; |
5 | +import {Input, Component, StateConfig} from "ng-forward"; | |
6 | + | |
7 | +@Component({ | |
8 | + selector: "content-viewer", | |
9 | + template: "", | |
10 | + providers: [ | |
11 | + "noosferoService", "$log", "$stateParams" | |
12 | + ] | |
13 | +}) | |
14 | +export class ContentViewerController { | |
2 | 15 | |
3 | -/** @ngInject */ | |
4 | -export function ContentViewerController(noosfero, $log, $stateParams) { | |
5 | - var vm = this; | |
6 | - vm.article = null; | |
7 | - vm.profile = null; | |
8 | - activate(); | |
16 | + @Input() | |
17 | + article: noosfero.Article = null; | |
18 | + | |
19 | + @Input() | |
20 | + profile: noosfero.Profile = null; | |
21 | + | |
22 | + constructor(private noosfero: any, private $log: ng.ILogService, private $stateParams: angular.ui.IStateParamsService) { | |
23 | + this.activate(); | |
24 | + } | |
9 | 25 | |
10 | - function activate() { | |
11 | - noosfero.currentProfile.then(function(profile) { | |
12 | - vm.profile = profile; | |
13 | - return noosfero.profiles.one(vm.profile.id).one('articles').get({ path: $stateParams.page }); | |
26 | + activate() { | |
27 | + this.noosfero.currentProfile.then(function(profile) { | |
28 | + this.profile = profile; | |
29 | + return this.noosfero.profiles.one(this.profile.id).one("articles").get({ path: this.$stateParams.page }); | |
14 | 30 | }).then(function(response) { |
15 | - vm.article = response.data.article; | |
31 | + this.article = response.data.article; | |
16 | 32 | }); |
17 | 33 | } |
18 | 34 | } | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +export interface Event extends Article { | |
2 | + | |
3 | +} | |
4 | + | |
5 | +export interface Article { | |
6 | + | |
7 | +} | |
8 | + | |
9 | +export interface Profile { | |
10 | + | |
11 | +} | |
12 | + | |
13 | +export interface Person extends Profile { | |
14 | + | |
15 | +} | |
16 | + | |
17 | +export interface TynyMceArticle extends Article { | |
18 | + | |
19 | +} | |
20 | + | |
21 | +export interface Blog extends Article { | |
22 | + | |
23 | +} | ... | ... |
typings.json
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | "angular": "github:DefinitelyTyped/DefinitelyTyped/angularjs/angular.d.ts#1c4a34873c9e70cce86edd0e61c559e43dfa5f75", |
7 | 7 | "angular-ui-router": "github:DefinitelyTyped/DefinitelyTyped/angular-ui-router/angular-ui-router.d.ts#655f8c1bf3c71b0e1ba415b36309604f79326ac8", |
8 | 8 | "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c", |
9 | - "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#470954c4f427e0805a2d633636a7c6aa7170def8" | |
9 | + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#470954c4f427e0805a2d633636a7c6aa7170def8", | |
10 | + "restangular": "github:DefinitelyTyped/DefinitelyTyped/restangular/restangular.d.ts#f2ae460e1751bb6668d291d4eb9255f047dd0ac5" | |
10 | 11 | } |
11 | 12 | } | ... | ... |
... | ... | @@ -0,0 +1,5 @@ |
1 | +/// <reference path="browser/ambient/angular-ui-router/angular-ui-router.d.ts" /> | |
2 | +/// <reference path="browser/ambient/angular/angular.d.ts" /> | |
3 | +/// <reference path="browser/ambient/es6-shim/es6-shim.d.ts" /> | |
4 | +/// <reference path="browser/ambient/jquery/jquery.d.ts" /> | |
5 | +/// <reference path="browser/ambient/restangular/restangular.d.ts" /> | ... | ... |
typings/browser/ambient/angular-ui-router/angular-ui-router.d.ts
0 → 100644
... | ... | @@ -0,0 +1,364 @@ |
1 | +// Compiled using typings@0.6.8 | |
2 | +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/655f8c1bf3c71b0e1ba415b36309604f79326ac8/angular-ui-router/angular-ui-router.d.ts | |
3 | +// Type definitions for Angular JS 1.1.5+ (ui.router module) | |
4 | +// Project: https://github.com/angular-ui/ui-router | |
5 | +// Definitions by: Michel Salib <https://github.com/michelsalib> | |
6 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped | |
7 | + | |
8 | + | |
9 | +// Support for AMD require and CommonJS | |
10 | +declare module 'angular-ui-router' { | |
11 | + // Since angular-ui-router adds providers for a bunch of | |
12 | + // injectable dependencies, it doesn't really return any | |
13 | + // actual data except the plain string 'ui.router'. | |
14 | + // | |
15 | + // As such, I don't think anybody will ever use the actual | |
16 | + // default value of the module. So I've only included the | |
17 | + // the types. (@xogeny) | |
18 | + export type IState = angular.ui.IState; | |
19 | + export type IStateProvider = angular.ui.IStateProvider; | |
20 | + export type IUrlMatcher = angular.ui.IUrlMatcher; | |
21 | + export type IUrlRouterProvider = angular.ui.IUrlRouterProvider; | |
22 | + export type IStateOptions = angular.ui.IStateOptions; | |
23 | + export type IHrefOptions = angular.ui.IHrefOptions; | |
24 | + export type IStateService = angular.ui.IStateService; | |
25 | + export type IResolvedState = angular.ui.IResolvedState; | |
26 | + export type IStateParamsService = angular.ui.IStateParamsService; | |
27 | + export type IUrlRouterService = angular.ui.IUrlRouterService; | |
28 | + export type IUiViewScrollProvider = angular.ui.IUiViewScrollProvider; | |
29 | + export type IType = angular.ui.IType; | |
30 | +} | |
31 | + | |
32 | +declare module angular.ui { | |
33 | + | |
34 | + interface IState { | |
35 | + name?: string; | |
36 | + /** | |
37 | + * String HTML content, or function that returns an HTML string | |
38 | + */ | |
39 | + template?: string | {(): string}; | |
40 | + /** | |
41 | + * String URL path to template file OR Function, returns URL path string | |
42 | + */ | |
43 | + templateUrl?: string | {(params: IStateParamsService): string}; | |
44 | + /** | |
45 | + * Function, returns HTML content string | |
46 | + */ | |
47 | + templateProvider?: Function | Array<string|Function>; | |
48 | + /** | |
49 | + * A controller paired to the state. Function, annotated array or name as String | |
50 | + */ | |
51 | + controller?: Function|string|Array<string|Function>; | |
52 | + controllerAs?: string; | |
53 | + /** | |
54 | + * Function (injectable), returns the actual controller function or string. | |
55 | + */ | |
56 | + controllerProvider?: Function|Array<string|Function>; | |
57 | + | |
58 | + /** | |
59 | + * Specifies the parent state of this state | |
60 | + */ | |
61 | + parent?: string | IState; | |
62 | + | |
63 | + | |
64 | + resolve?: { [name:string]: any }; | |
65 | + /** | |
66 | + * A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed. | |
67 | + */ | |
68 | + url?: string | IUrlMatcher; | |
69 | + /** | |
70 | + * A map which optionally configures parameters declared in the url, or defines additional non-url parameters. Only use this within a state if you are not using url. Otherwise you can specify your parameters within the url. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed. | |
71 | + */ | |
72 | + params?: any; | |
73 | + /** | |
74 | + * Use the views property to set up multiple views. If you don't need multiple views within a single state this property is not needed. Tip: remember that often nested views are more useful and powerful than multiple sibling views. | |
75 | + */ | |
76 | + views?: { [name:string]: IState }; | |
77 | + abstract?: boolean; | |
78 | + /** | |
79 | + * Callback function for when a state is entered. Good way to trigger an action or dispatch an event, such as opening a dialog. | |
80 | + * If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools. | |
81 | + */ | |
82 | + onEnter?: Function|Array<string|Function>; | |
83 | + /** | |
84 | + * Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog. | |
85 | + * If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools. | |
86 | + */ | |
87 | + onExit?: Function|Array<string|Function>; | |
88 | + /** | |
89 | + * Arbitrary data object, useful for custom configuration. | |
90 | + */ | |
91 | + data?: any; | |
92 | + | |
93 | + /** | |
94 | + * Boolean (default true). If false will not re-trigger the same state just because a search/query parameter has changed. Useful for when you'd like to modify $location.search() without triggering a reload. | |
95 | + */ | |
96 | + reloadOnSearch?: boolean; | |
97 | + | |
98 | + /** | |
99 | + * Boolean (default true). If false will reload state on everytransitions. Useful for when you'd like to restore all data to its initial state. | |
100 | + */ | |
101 | + cache?: boolean; | |
102 | + } | |
103 | + | |
104 | + interface IStateProvider extends angular.IServiceProvider { | |
105 | + state(name:string, config:IState): IStateProvider; | |
106 | + state(config:IState): IStateProvider; | |
107 | + decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any; | |
108 | + } | |
109 | + | |
110 | + interface IUrlMatcher { | |
111 | + concat(pattern: string): IUrlMatcher; | |
112 | + exec(path: string, searchParams: {}): {}; | |
113 | + parameters(): string[]; | |
114 | + format(values: {}): string; | |
115 | + } | |
116 | + | |
117 | + interface IUrlMatcherFactory { | |
118 | + /** | |
119 | + * Creates a UrlMatcher for the specified pattern. | |
120 | + * | |
121 | + * @param pattern {string} The URL pattern. | |
122 | + * | |
123 | + * @returns {IUrlMatcher} The UrlMatcher. | |
124 | + */ | |
125 | + compile(pattern: string): IUrlMatcher; | |
126 | + /** | |
127 | + * Returns true if the specified object is a UrlMatcher, or false otherwise. | |
128 | + * | |
129 | + * @param o {any} The object to perform the type check against. | |
130 | + * | |
131 | + * @returns {boolean} Returns true if the object matches the IUrlMatcher interface, by implementing all the same methods. | |
132 | + */ | |
133 | + isMatcher(o: any): boolean; | |
134 | + /** | |
135 | + * Returns a type definition for the specified name | |
136 | + * | |
137 | + * @param name {string} The type definition name | |
138 | + * | |
139 | + * @returns {IType} The type definition | |
140 | + */ | |
141 | + type(name: string): IType; | |
142 | + /** | |
143 | + * Registers a custom Type object that can be used to generate URLs with typed parameters. | |
144 | + * | |
145 | + * @param {IType} definition The type definition. | |
146 | + * @param {any[]} inlineAnnotedDefinitionFn A function that is injected before the app runtime starts. The result of this function is merged into the existing definition. | |
147 | + * | |
148 | + * @returns {IUrlMatcherFactory} Returns $urlMatcherFactoryProvider. | |
149 | + */ | |
150 | + type(name: string, definition: IType, inlineAnnotedDefinitionFn?: any[]): IUrlMatcherFactory; | |
151 | + /** | |
152 | + * Registers a custom Type object that can be used to generate URLs with typed parameters. | |
153 | + * | |
154 | + * @param {IType} definition The type definition. | |
155 | + * @param {any[]} inlineAnnotedDefinitionFn A function that is injected before the app runtime starts. The result of this function is merged into the existing definition. | |
156 | + * | |
157 | + * @returns {IUrlMatcherFactory} Returns $urlMatcherFactoryProvider. | |
158 | + */ | |
159 | + type(name: string, definition: IType, definitionFn?: (...args:any[]) => IType): IUrlMatcherFactory; | |
160 | + /** | |
161 | + * Defines whether URL matching should be case sensitive (the default behavior), or not. | |
162 | + * | |
163 | + * @param value {boolean} false to match URL in a case sensitive manner; otherwise true; | |
164 | + * | |
165 | + * @returns {boolean} the current value of caseInsensitive | |
166 | + */ | |
167 | + caseInsensitive(value?: boolean): boolean; | |
168 | + /** | |
169 | + * Sets the default behavior when generating or matching URLs with default parameter values | |
170 | + * | |
171 | + * @param value {string} A string that defines the default parameter URL squashing behavior. nosquash: When generating an href with a default parameter value, do not squash the parameter value from the URL slash: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the parameter is surrounded by slashes, squash (remove) one slash from the URL any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) the parameter value from the URL and replace it with this string. | |
172 | + */ | |
173 | + defaultSquashPolicy(value: string): void; | |
174 | + /** | |
175 | + * Defines whether URLs should match trailing slashes, or not (the default behavior). | |
176 | + * | |
177 | + * @param value {boolean} false to match trailing slashes in URLs, otherwise true. | |
178 | + * | |
179 | + * @returns {boolean} the current value of strictMode | |
180 | + */ | |
181 | + strictMode(value?: boolean): boolean; | |
182 | + } | |
183 | + | |
184 | + interface IUrlRouterProvider extends angular.IServiceProvider { | |
185 | + when(whenPath: RegExp, handler: Function): IUrlRouterProvider; | |
186 | + when(whenPath: RegExp, handler: any[]): IUrlRouterProvider; | |
187 | + when(whenPath: RegExp, toPath: string): IUrlRouterProvider; | |
188 | + when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider; | |
189 | + when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider; | |
190 | + when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider; | |
191 | + when(whenPath: string, handler: Function): IUrlRouterProvider; | |
192 | + when(whenPath: string, handler: any[]): IUrlRouterProvider; | |
193 | + when(whenPath: string, toPath: string): IUrlRouterProvider; | |
194 | + otherwise(handler: Function): IUrlRouterProvider; | |
195 | + otherwise(handler: any[]): IUrlRouterProvider; | |
196 | + otherwise(path: string): IUrlRouterProvider; | |
197 | + rule(handler: Function): IUrlRouterProvider; | |
198 | + rule(handler: any[]): IUrlRouterProvider; | |
199 | + /** | |
200 | + * Disables (or enables) deferring location change interception. | |
201 | + * | |
202 | + * If you wish to customize the behavior of syncing the URL (for example, if you wish to defer a transition but maintain the current URL), call this method at configuration time. Then, at run time, call $urlRouter.listen() after you have configured your own $locationChangeSuccess event handler. | |
203 | + * | |
204 | + * @param {boolean} defer Indicates whether to defer location change interception. Passing no parameter is equivalent to true. | |
205 | + */ | |
206 | + deferIntercept(defer?: boolean): void; | |
207 | + } | |
208 | + | |
209 | + interface IStateOptions { | |
210 | + /** | |
211 | + * {boolean=true|string=} - If true will update the url in the location bar, if false will not. If string, must be "replace", which will update url and also replace last history record. | |
212 | + */ | |
213 | + location?: boolean | string; | |
214 | + /** | |
215 | + * {boolean=true}, If true will inherit url parameters from current url. | |
216 | + */ | |
217 | + inherit?: boolean; | |
218 | + /** | |
219 | + * {object=$state.$current}, When transitioning with relative path (e.g '^'), defines which state to be relative from. | |
220 | + */ | |
221 | + relative?: IState; | |
222 | + /** | |
223 | + * {boolean=true}, If true will broadcast $stateChangeStart and $stateChangeSuccess events. | |
224 | + */ | |
225 | + notify?: boolean; | |
226 | + /** | |
227 | + * {boolean=false}, If true will force transition even if the state or params have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params. | |
228 | + */ | |
229 | + reload?: boolean; | |
230 | + } | |
231 | + | |
232 | + interface IHrefOptions { | |
233 | + lossy?: boolean; | |
234 | + inherit?: boolean; | |
235 | + relative?: IState; | |
236 | + absolute?: boolean; | |
237 | + } | |
238 | + | |
239 | + interface IStateService { | |
240 | + /** | |
241 | + * Convenience method for transitioning to a new state. $state.go calls $state.transitionTo internally but automatically sets options to { location: true, inherit: true, relative: $state.$current, notify: true }. This allows you to easily use an absolute or relative to path and specify only the parameters you'd like to update (while letting unspecified parameters inherit from the currently active ancestor states). | |
242 | + * | |
243 | + * @param to Absolute state name or relative state path. Some examples: | |
244 | + * | |
245 | + * $state.go('contact.detail') - will go to the contact.detail state | |
246 | + * $state.go('^') - will go to a parent state | |
247 | + * $state.go('^.sibling') - will go to a sibling state | |
248 | + * $state.go('.child.grandchild') - will go to grandchild state | |
249 | + * | |
250 | + * @param params A map of the parameters that will be sent to the state, will populate $stateParams. Any parameters that are not specified will be inherited from currently defined parameters. This allows, for example, going to a sibling state that shares parameters specified in a parent state. Parameter inheritance only works between common ancestor states, I.e. transitioning to a sibling will get you the parameters for all parents, transitioning to a child will get you all current parameters, etc. | |
251 | + * | |
252 | + * @param options Options object. | |
253 | + */ | |
254 | + go(to: string, params?: {}, options?: IStateOptions): angular.IPromise<any>; | |
255 | + go(to: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>; | |
256 | + transitionTo(state: string, params?: {}, updateLocation?: boolean): angular.IPromise<any>; | |
257 | + transitionTo(state: IState, params?: {}, updateLocation?: boolean): angular.IPromise<any>; | |
258 | + transitionTo(state: string, params?: {}, options?: IStateOptions): angular.IPromise<any>; | |
259 | + transitionTo(state: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>; | |
260 | + includes(state: string, params?: {}): boolean; | |
261 | + includes(state: string, params?: {}, options?:any): boolean; | |
262 | + is(state:string, params?: {}): boolean; | |
263 | + is(state: IState, params?: {}): boolean; | |
264 | + href(state: IState, params?: {}, options?: IHrefOptions): string; | |
265 | + href(state: string, params?: {}, options?: IHrefOptions): string; | |
266 | + get(state: string, context?: string): IState; | |
267 | + get(state: IState, context?: string): IState; | |
268 | + get(state: string, context?: IState): IState; | |
269 | + get(state: IState, context?: IState): IState; | |
270 | + get(): IState[]; | |
271 | + /** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */ | |
272 | + current: IState; | |
273 | + /** A param object, e.g. {sectionId: section.id)}, that you'd like to test against the current active state. */ | |
274 | + params: IStateParamsService; | |
275 | + reload(): angular.IPromise<any>; | |
276 | + | |
277 | + /** Currently pending transition. A promise that'll resolve or reject. */ | |
278 | + transition: angular.IPromise<{}>; | |
279 | + | |
280 | + $current: IResolvedState; | |
281 | + } | |
282 | + | |
283 | + interface IResolvedState { | |
284 | + locals: { | |
285 | + /** | |
286 | + * Currently resolved "resolve" values from the current state | |
287 | + */ | |
288 | + globals: { [key: string]: any; }; | |
289 | + }; | |
290 | + } | |
291 | + | |
292 | + interface IStateParamsService { | |
293 | + [key: string]: any; | |
294 | + } | |
295 | + | |
296 | + interface IUrlRouterService { | |
297 | + /* | |
298 | + * Triggers an update; the same update that happens when the address bar | |
299 | + * url changes, aka $locationChangeSuccess. | |
300 | + * | |
301 | + * This method is useful when you need to use preventDefault() on the | |
302 | + * $locationChangeSuccess event, perform some custom logic (route protection, | |
303 | + * auth, config, redirection, etc) and then finally proceed with the transition | |
304 | + * by calling $urlRouter.sync(). | |
305 | + * | |
306 | + */ | |
307 | + sync(): void; | |
308 | + listen(): Function; | |
309 | + href(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): string; | |
310 | + update(read?: boolean): void; | |
311 | + push(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): void; | |
312 | + } | |
313 | + | |
314 | + interface IUiViewScrollProvider { | |
315 | + /* | |
316 | + * Reverts back to using the core $anchorScroll service for scrolling | |
317 | + * based on the url anchor. | |
318 | + */ | |
319 | + useAnchorScroll(): void; | |
320 | + } | |
321 | + | |
322 | + interface IType { | |
323 | + /** | |
324 | + * Converts a parameter value (from URL string or transition param) to a custom/native value. | |
325 | + * | |
326 | + * @param val {string} The URL parameter value to decode. | |
327 | + * @param key {string} The name of the parameter in which val is stored. Can be used for meta-programming of Type objects. | |
328 | + * | |
329 | + * @returns {any} Returns a custom representation of the URL parameter value. | |
330 | + */ | |
331 | + decode(val: string, key: string): any; | |
332 | + /** | |
333 | + * Encodes a custom/native type value to a string that can be embedded in a URL. Note that the return value does not need to be URL-safe (i.e. passed through encodeURIComponent()), it only needs to be a representation of val that has been coerced to a string. | |
334 | + * | |
335 | + * @param val {any} The value to encode. | |
336 | + * @param key {string} The name of the parameter in which val is stored. Can be used for meta-programming of Type objects. | |
337 | + * | |
338 | + * @returns {string} Returns a string representation of val that can be encoded in a URL. | |
339 | + */ | |
340 | + encode(val: any, key: string): string; | |
341 | + /** | |
342 | + * Determines whether two decoded values are equivalent. | |
343 | + * | |
344 | + * @param a {any} A value to compare against. | |
345 | + * @param b {any} A value to compare against. | |
346 | + * | |
347 | + * @returns {boolean} Returns true if the values are equivalent/equal, otherwise false. | |
348 | + */ | |
349 | + equals? (a: any, b: any): boolean; | |
350 | + /** | |
351 | + * Detects whether a value is of a particular type. Accepts a native (decoded) value and determines whether it matches the current Type object. | |
352 | + * | |
353 | + * @param val {any} The value to check. | |
354 | + * @param key {any} Optional. If the type check is happening in the context of a specific UrlMatcher object, this is the name of the parameter in which val is stored. Can be used for meta-programming of Type objects. | |
355 | + * | |
356 | + * @returns {boolean} Returns true if the value matches the type, otherwise false. | |
357 | + */ | |
358 | + is(val: any, key: string): boolean; | |
359 | + /** | |
360 | + * The regular expression pattern used to match values of this type when coming from a substring of a URL. | |
361 | + */ | |
362 | + pattern?: RegExp; | |
363 | + } | |
364 | +} | |
0 | 365 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,1878 @@ |
1 | +// Compiled using typings@0.6.8 | |
2 | +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/1c4a34873c9e70cce86edd0e61c559e43dfa5f75/angularjs/angular.d.ts | |
3 | +// Type definitions for Angular JS 1.4+ | |
4 | +// Project: http://angularjs.org | |
5 | +// Definitions by: Diego Vilar <http://github.com/diegovilar> | |
6 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped | |
7 | + | |
8 | + | |
9 | + | |
10 | +declare var angular: angular.IAngularStatic; | |
11 | + | |
12 | +// Support for painless dependency injection | |
13 | +interface Function { | |
14 | + $inject?: string[]; | |
15 | +} | |
16 | + | |
17 | +// Collapse angular into ng | |
18 | +import ng = angular; | |
19 | +// Support AMD require | |
20 | +declare module 'angular' { | |
21 | + export = angular; | |
22 | +} | |
23 | + | |
24 | +/////////////////////////////////////////////////////////////////////////////// | |
25 | +// ng module (angular.js) | |
26 | +/////////////////////////////////////////////////////////////////////////////// | |
27 | +declare module angular { | |
28 | + | |
29 | + // not directly implemented, but ensures that constructed class implements $get | |
30 | + interface IServiceProviderClass { | |
31 | + new (...args: any[]): IServiceProvider; | |
32 | + } | |
33 | + | |
34 | + interface IServiceProviderFactory { | |
35 | + (...args: any[]): IServiceProvider; | |
36 | + } | |
37 | + | |
38 | + // All service providers extend this interface | |
39 | + interface IServiceProvider { | |
40 | + $get: any; | |
41 | + } | |
42 | + | |
43 | + interface IAngularBootstrapConfig { | |
44 | + strictDi?: boolean; | |
45 | + debugInfoEnabled?: boolean; | |
46 | + } | |
47 | + | |
48 | + /////////////////////////////////////////////////////////////////////////// | |
49 | + // AngularStatic | |
50 | + // see http://docs.angularjs.org/api | |
51 | + /////////////////////////////////////////////////////////////////////////// | |
52 | + interface IAngularStatic { | |
53 | + bind(context: any, fn: Function, ...args: any[]): Function; | |
54 | + | |
55 | + /** | |
56 | + * Use this function to manually start up angular application. | |
57 | + * | |
58 | + * @param element DOM element which is the root of angular application. | |
59 | + * @param modules An array of modules to load into the application. | |
60 | + * Each item in the array should be the name of a predefined module or a (DI annotated) | |
61 | + * function that will be invoked by the injector as a config block. | |
62 | + * @param config an object for defining configuration options for the application. The following keys are supported: | |
63 | + * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. | |
64 | + */ | |
65 | + bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService; | |
66 | + | |
67 | + /** | |
68 | + * Creates a deep copy of source, which should be an object or an array. | |
69 | + * | |
70 | + * - If no destination is supplied, a copy of the object or array is created. | |
71 | + * - If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it. | |
72 | + * - If source is not an object or array (inc. null and undefined), source is returned. | |
73 | + * - If source is identical to 'destination' an exception will be thrown. | |
74 | + * | |
75 | + * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined. | |
76 | + * @param destination Destination into which the source is copied. If provided, must be of the same type as source. | |
77 | + */ | |
78 | + copy<T>(source: T, destination?: T): T; | |
79 | + | |
80 | + /** | |
81 | + * Wraps a raw DOM element or HTML string as a jQuery element. | |
82 | + * | |
83 | + * If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." | |
84 | + */ | |
85 | + element: IAugmentedJQueryStatic; | |
86 | + equals(value1: any, value2: any): boolean; | |
87 | + extend(destination: any, ...sources: any[]): any; | |
88 | + | |
89 | + /** | |
90 | + * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. | |
91 | + * | |
92 | + * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. | |
93 | + * | |
94 | + * @param obj Object to iterate over. | |
95 | + * @param iterator Iterator function. | |
96 | + * @param context Object to become context (this) for the iterator function. | |
97 | + */ | |
98 | + forEach<T>(obj: T[], iterator: (value: T, key: number) => any, context?: any): any; | |
99 | + /** | |
100 | + * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. | |
101 | + * | |
102 | + * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. | |
103 | + * | |
104 | + * @param obj Object to iterate over. | |
105 | + * @param iterator Iterator function. | |
106 | + * @param context Object to become context (this) for the iterator function. | |
107 | + */ | |
108 | + forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any; | |
109 | + /** | |
110 | + * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. | |
111 | + * | |
112 | + * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. | |
113 | + * | |
114 | + * @param obj Object to iterate over. | |
115 | + * @param iterator Iterator function. | |
116 | + * @param context Object to become context (this) for the iterator function. | |
117 | + */ | |
118 | + forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; | |
119 | + | |
120 | + fromJson(json: string): any; | |
121 | + identity<T>(arg?: T): T; | |
122 | + injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; | |
123 | + isArray(value: any): boolean; | |
124 | + isDate(value: any): boolean; | |
125 | + isDefined(value: any): boolean; | |
126 | + isElement(value: any): boolean; | |
127 | + isFunction(value: any): boolean; | |
128 | + isNumber(value: any): boolean; | |
129 | + isObject(value: any): boolean; | |
130 | + isString(value: any): boolean; | |
131 | + isUndefined(value: any): boolean; | |
132 | + lowercase(str: string): string; | |
133 | + | |
134 | + /** | |
135 | + * Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2). | |
136 | + * | |
137 | + * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. | |
138 | + * | |
139 | + * @param dst Destination object. | |
140 | + * @param src Source object(s). | |
141 | + */ | |
142 | + merge(dst: any, ...src: any[]): any; | |
143 | + | |
144 | + /** | |
145 | + * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. | |
146 | + * | |
147 | + * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. | |
148 | + * | |
149 | + * @param name The name of the module to create or retrieve. | |
150 | + * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. | |
151 | + * @param configFn Optional configuration function for the module. | |
152 | + */ | |
153 | + module( | |
154 | + name: string, | |
155 | + requires?: string[], | |
156 | + configFn?: Function): IModule; | |
157 | + | |
158 | + noop(...args: any[]): void; | |
159 | + reloadWithDebugInfo(): void; | |
160 | + toJson(obj: any, pretty?: boolean): string; | |
161 | + uppercase(str: string): string; | |
162 | + version: { | |
163 | + full: string; | |
164 | + major: number; | |
165 | + minor: number; | |
166 | + dot: number; | |
167 | + codeName: string; | |
168 | + }; | |
169 | + | |
170 | + /** | |
171 | + * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. | |
172 | + * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. | |
173 | + */ | |
174 | + resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; | |
175 | + } | |
176 | + | |
177 | + /////////////////////////////////////////////////////////////////////////// | |
178 | + // Module | |
179 | + // see http://docs.angularjs.org/api/angular.Module | |
180 | + /////////////////////////////////////////////////////////////////////////// | |
181 | + interface IModule { | |
182 | + animation(name: string, animationFactory: Function): IModule; | |
183 | + animation(name: string, inlineAnnotatedFunction: any[]): IModule; | |
184 | + animation(object: Object): IModule; | |
185 | + /** | |
186 | + * Use this method to register a component. | |
187 | + * | |
188 | + * @param name The name of the component. | |
189 | + * @param options A definition object passed into the component. | |
190 | + */ | |
191 | + component(name: string, options: IComponentOptions): IModule; | |
192 | + /** | |
193 | + * Use this method to register work which needs to be performed on module loading. | |
194 | + * | |
195 | + * @param configFn Execute this function on module load. Useful for service configuration. | |
196 | + */ | |
197 | + config(configFn: Function): IModule; | |
198 | + /** | |
199 | + * Use this method to register work which needs to be performed on module loading. | |
200 | + * | |
201 | + * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. | |
202 | + */ | |
203 | + config(inlineAnnotatedFunction: any[]): IModule; | |
204 | + config(object: Object): IModule; | |
205 | + /** | |
206 | + * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. | |
207 | + * | |
208 | + * @param name The name of the constant. | |
209 | + * @param value The constant value. | |
210 | + */ | |
211 | + constant(name: string, value: any): IModule; | |
212 | + constant(object: Object): IModule; | |
213 | + /** | |
214 | + * The $controller service is used by Angular to create new controllers. | |
215 | + * | |
216 | + * This provider allows controller registration via the register method. | |
217 | + * | |
218 | + * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. | |
219 | + * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). | |
220 | + */ | |
221 | + controller(name: string, controllerConstructor: Function): IModule; | |
222 | + /** | |
223 | + * The $controller service is used by Angular to create new controllers. | |
224 | + * | |
225 | + * This provider allows controller registration via the register method. | |
226 | + * | |
227 | + * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. | |
228 | + * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). | |
229 | + */ | |
230 | + controller(name: string, inlineAnnotatedConstructor: any[]): IModule; | |
231 | + controller(object: Object): IModule; | |
232 | + /** | |
233 | + * Register a new directive with the compiler. | |
234 | + * | |
235 | + * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) | |
236 | + * @param directiveFactory An injectable directive factory function. | |
237 | + */ | |
238 | + directive(name: string, directiveFactory: IDirectiveFactory): IModule; | |
239 | + /** | |
240 | + * Register a new directive with the compiler. | |
241 | + * | |
242 | + * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) | |
243 | + * @param directiveFactory An injectable directive factory function. | |
244 | + */ | |
245 | + directive(name: string, inlineAnnotatedFunction: any[]): IModule; | |
246 | + directive(object: Object): IModule; | |
247 | + /** | |
248 | + * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. | |
249 | + * | |
250 | + * @param name The name of the instance. | |
251 | + * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). | |
252 | + */ | |
253 | + factory(name: string, $getFn: Function): IModule; | |
254 | + /** | |
255 | + * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. | |
256 | + * | |
257 | + * @param name The name of the instance. | |
258 | + * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). | |
259 | + */ | |
260 | + factory(name: string, inlineAnnotatedFunction: any[]): IModule; | |
261 | + factory(object: Object): IModule; | |
262 | + filter(name: string, filterFactoryFunction: Function): IModule; | |
263 | + filter(name: string, inlineAnnotatedFunction: any[]): IModule; | |
264 | + filter(object: Object): IModule; | |
265 | + provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; | |
266 | + provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; | |
267 | + provider(name: string, inlineAnnotatedConstructor: any[]): IModule; | |
268 | + provider(name: string, providerObject: IServiceProvider): IModule; | |
269 | + provider(object: Object): IModule; | |
270 | + /** | |
271 | + * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. | |
272 | + */ | |
273 | + run(initializationFunction: Function): IModule; | |
274 | + /** | |
275 | + * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. | |
276 | + */ | |
277 | + run(inlineAnnotatedFunction: any[]): IModule; | |
278 | + service(name: string, serviceConstructor: Function): IModule; | |
279 | + service(name: string, inlineAnnotatedConstructor: any[]): IModule; | |
280 | + service(object: Object): IModule; | |
281 | + /** | |
282 | + * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. | |
283 | + | |
284 | + Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. | |
285 | + * | |
286 | + * @param name The name of the instance. | |
287 | + * @param value The value. | |
288 | + */ | |
289 | + value(name: string, value: any): IModule; | |
290 | + value(object: Object): IModule; | |
291 | + | |
292 | + /** | |
293 | + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. | |
294 | + * @param name The name of the service to decorate | |
295 | + * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. | |
296 | + */ | |
297 | + decorator(name:string, decoratorConstructor: Function): IModule; | |
298 | + decorator(name:string, inlineAnnotatedConstructor: any[]): IModule; | |
299 | + | |
300 | + // Properties | |
301 | + name: string; | |
302 | + requires: string[]; | |
303 | + } | |
304 | + | |
305 | + /////////////////////////////////////////////////////////////////////////// | |
306 | + // Attributes | |
307 | + // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes | |
308 | + /////////////////////////////////////////////////////////////////////////// | |
309 | + interface IAttributes { | |
310 | + /** | |
311 | + * this is necessary to be able to access the scoped attributes. it's not very elegant | |
312 | + * because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way | |
313 | + * this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 | |
314 | + */ | |
315 | + [name: string]: any; | |
316 | + | |
317 | + /** | |
318 | + * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-) to its normalized, camelCase form. | |
319 | + * | |
320 | + * Also there is special case for Moz prefix starting with upper case letter. | |
321 | + * | |
322 | + * For further information check out the guide on @see https://docs.angularjs.org/guide/directive#matching-directives | |
323 | + */ | |
324 | + $normalize(name: string): string; | |
325 | + | |
326 | + /** | |
327 | + * Adds the CSS class value specified by the classVal parameter to the | |
328 | + * element. If animations are enabled then an animation will be triggered | |
329 | + * for the class addition. | |
330 | + */ | |
331 | + $addClass(classVal: string): void; | |
332 | + | |
333 | + /** | |
334 | + * Removes the CSS class value specified by the classVal parameter from the | |
335 | + * element. If animations are enabled then an animation will be triggered for | |
336 | + * the class removal. | |
337 | + */ | |
338 | + $removeClass(classVal: string): void; | |
339 | + | |
340 | + /** | |
341 | + * Set DOM element attribute value. | |
342 | + */ | |
343 | + $set(key: string, value: any): void; | |
344 | + | |
345 | + /** | |
346 | + * Observes an interpolated attribute. | |
347 | + * The observer function will be invoked once during the next $digest | |
348 | + * following compilation. The observer is then invoked whenever the | |
349 | + * interpolated value changes. | |
350 | + */ | |
351 | + $observe<T>(name: string, fn: (value?: T) => any): Function; | |
352 | + | |
353 | + /** | |
354 | + * A map of DOM element attribute names to the normalized name. This is needed | |
355 | + * to do reverse lookup from normalized name back to actual name. | |
356 | + */ | |
357 | + $attr: Object; | |
358 | + } | |
359 | + | |
360 | + /** | |
361 | + * form.FormController - type in module ng | |
362 | + * see https://docs.angularjs.org/api/ng/type/form.FormController | |
363 | + */ | |
364 | + interface IFormController { | |
365 | + | |
366 | + /** | |
367 | + * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272 | |
368 | + */ | |
369 | + [name: string]: any; | |
370 | + | |
371 | + $pristine: boolean; | |
372 | + $dirty: boolean; | |
373 | + $valid: boolean; | |
374 | + $invalid: boolean; | |
375 | + $submitted: boolean; | |
376 | + $error: any; | |
377 | + $addControl(control: INgModelController): void; | |
378 | + $removeControl(control: INgModelController): void; | |
379 | + $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void; | |
380 | + $setDirty(): void; | |
381 | + $setPristine(): void; | |
382 | + $commitViewValue(): void; | |
383 | + $rollbackViewValue(): void; | |
384 | + $setSubmitted(): void; | |
385 | + $setUntouched(): void; | |
386 | + } | |
387 | + | |
388 | + /////////////////////////////////////////////////////////////////////////// | |
389 | + // NgModelController | |
390 | + // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController | |
391 | + /////////////////////////////////////////////////////////////////////////// | |
392 | + interface INgModelController { | |
393 | + $render(): void; | |
394 | + $setValidity(validationErrorKey: string, isValid: boolean): void; | |
395 | + // Documentation states viewValue and modelValue to be a string but other | |
396 | + // types do work and it's common to use them. | |
397 | + $setViewValue(value: any, trigger?: string): void; | |
398 | + $setPristine(): void; | |
399 | + $setDirty(): void; | |
400 | + $validate(): void; | |
401 | + $setTouched(): void; | |
402 | + $setUntouched(): void; | |
403 | + $rollbackViewValue(): void; | |
404 | + $commitViewValue(): void; | |
405 | + $isEmpty(value: any): boolean; | |
406 | + | |
407 | + $viewValue: any; | |
408 | + | |
409 | + $modelValue: any; | |
410 | + | |
411 | + $parsers: IModelParser[]; | |
412 | + $formatters: IModelFormatter[]; | |
413 | + $viewChangeListeners: IModelViewChangeListener[]; | |
414 | + $error: any; | |
415 | + $name: string; | |
416 | + | |
417 | + $touched: boolean; | |
418 | + $untouched: boolean; | |
419 | + | |
420 | + $validators: IModelValidators; | |
421 | + $asyncValidators: IAsyncModelValidators; | |
422 | + | |
423 | + $pending: any; | |
424 | + $pristine: boolean; | |
425 | + $dirty: boolean; | |
426 | + $valid: boolean; | |
427 | + $invalid: boolean; | |
428 | + } | |
429 | + | |
430 | + interface IModelValidators { | |
431 | + /** | |
432 | + * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName | |
433 | + */ | |
434 | + [index: string]: (modelValue: any, viewValue: any) => boolean; | |
435 | + } | |
436 | + | |
437 | + interface IAsyncModelValidators { | |
438 | + [index: string]: (modelValue: any, viewValue: any) => IPromise<any>; | |
439 | + } | |
440 | + | |
441 | + interface IModelParser { | |
442 | + (value: any): any; | |
443 | + } | |
444 | + | |
445 | + interface IModelFormatter { | |
446 | + (value: any): any; | |
447 | + } | |
448 | + | |
449 | + interface IModelViewChangeListener { | |
450 | + (): void; | |
451 | + } | |
452 | + | |
453 | + /** | |
454 | + * $rootScope - $rootScopeProvider - service in module ng | |
455 | + * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope | |
456 | + */ | |
457 | + interface IRootScopeService { | |
458 | + [index: string]: any; | |
459 | + | |
460 | + $apply(): any; | |
461 | + $apply(exp: string): any; | |
462 | + $apply(exp: (scope: IScope) => any): any; | |
463 | + | |
464 | + $applyAsync(): any; | |
465 | + $applyAsync(exp: string): any; | |
466 | + $applyAsync(exp: (scope: IScope) => any): any; | |
467 | + | |
468 | + /** | |
469 | + * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. | |
470 | + * | |
471 | + * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. | |
472 | + * | |
473 | + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. | |
474 | + * | |
475 | + * @param name Event name to broadcast. | |
476 | + * @param args Optional one or more arguments which will be passed onto the event listeners. | |
477 | + */ | |
478 | + $broadcast(name: string, ...args: any[]): IAngularEvent; | |
479 | + $destroy(): void; | |
480 | + $digest(): void; | |
481 | + /** | |
482 | + * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. | |
483 | + * | |
484 | + * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. | |
485 | + * | |
486 | + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. | |
487 | + * | |
488 | + * @param name Event name to emit. | |
489 | + * @param args Optional one or more arguments which will be passed onto the event listeners. | |
490 | + */ | |
491 | + $emit(name: string, ...args: any[]): IAngularEvent; | |
492 | + | |
493 | + $eval(): any; | |
494 | + $eval(expression: string, locals?: Object): any; | |
495 | + $eval(expression: (scope: IScope) => any, locals?: Object): any; | |
496 | + | |
497 | + $evalAsync(): void; | |
498 | + $evalAsync(expression: string): void; | |
499 | + $evalAsync(expression: (scope: IScope) => any): void; | |
500 | + | |
501 | + // Defaults to false by the implementation checking strategy | |
502 | + $new(isolate?: boolean, parent?: IScope): IScope; | |
503 | + | |
504 | + /** | |
505 | + * Listens on events of a given type. See $emit for discussion of event life cycle. | |
506 | + * | |
507 | + * The event listener function format is: function(event, args...). | |
508 | + * | |
509 | + * @param name Event name to listen on. | |
510 | + * @param listener Function to call when the event is emitted. | |
511 | + */ | |
512 | + $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; | |
513 | + | |
514 | + $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; | |
515 | + $watch<T>(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; | |
516 | + $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; | |
517 | + $watch<T>(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; | |
518 | + | |
519 | + $watchCollection<T>(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; | |
520 | + $watchCollection<T>(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; | |
521 | + | |
522 | + $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; | |
523 | + $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; | |
524 | + | |
525 | + $parent: IScope; | |
526 | + $root: IRootScopeService; | |
527 | + $id: number; | |
528 | + | |
529 | + // Hidden members | |
530 | + $$isolateBindings: any; | |
531 | + $$phase: any; | |
532 | + } | |
533 | + | |
534 | + interface IScope extends IRootScopeService { } | |
535 | + | |
536 | + /** | |
537 | + * $scope for ngRepeat directive. | |
538 | + * see https://docs.angularjs.org/api/ng/directive/ngRepeat | |
539 | + */ | |
540 | + interface IRepeatScope extends IScope { | |
541 | + | |
542 | + /** | |
543 | + * iterator offset of the repeated element (0..length-1). | |
544 | + */ | |
545 | + $index: number; | |
546 | + | |
547 | + /** | |
548 | + * true if the repeated element is first in the iterator. | |
549 | + */ | |
550 | + $first: boolean; | |
551 | + | |
552 | + /** | |
553 | + * true if the repeated element is between the first and last in the iterator. | |
554 | + */ | |
555 | + $middle: boolean; | |
556 | + | |
557 | + /** | |
558 | + * true if the repeated element is last in the iterator. | |
559 | + */ | |
560 | + $last: boolean; | |
561 | + | |
562 | + /** | |
563 | + * true if the iterator position $index is even (otherwise false). | |
564 | + */ | |
565 | + $even: boolean; | |
566 | + | |
567 | + /** | |
568 | + * true if the iterator position $index is odd (otherwise false). | |
569 | + */ | |
570 | + $odd: boolean; | |
571 | + | |
572 | + } | |
573 | + | |
574 | + interface IAngularEvent { | |
575 | + /** | |
576 | + * the scope on which the event was $emit-ed or $broadcast-ed. | |
577 | + */ | |
578 | + targetScope: IScope; | |
579 | + /** | |
580 | + * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null. | |
581 | + */ | |
582 | + currentScope: IScope; | |
583 | + /** | |
584 | + * name of the event. | |
585 | + */ | |
586 | + name: string; | |
587 | + /** | |
588 | + * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed). | |
589 | + */ | |
590 | + stopPropagation?: Function; | |
591 | + /** | |
592 | + * calling preventDefault sets defaultPrevented flag to true. | |
593 | + */ | |
594 | + preventDefault: Function; | |
595 | + /** | |
596 | + * true if preventDefault was called. | |
597 | + */ | |
598 | + defaultPrevented: boolean; | |
599 | + } | |
600 | + | |
601 | + /////////////////////////////////////////////////////////////////////////// | |
602 | + // WindowService | |
603 | + // see http://docs.angularjs.org/api/ng.$window | |
604 | + /////////////////////////////////////////////////////////////////////////// | |
605 | + interface IWindowService extends Window { | |
606 | + [key: string]: any; | |
607 | + } | |
608 | + | |
609 | + /////////////////////////////////////////////////////////////////////////// | |
610 | + // BrowserService | |
611 | + // TODO undocumented, so we need to get it from the source code | |
612 | + /////////////////////////////////////////////////////////////////////////// | |
613 | + interface IBrowserService { | |
614 | + defer: angular.ITimeoutService; | |
615 | + [key: string]: any; | |
616 | + } | |
617 | + | |
618 | + /////////////////////////////////////////////////////////////////////////// | |
619 | + // TimeoutService | |
620 | + // see http://docs.angularjs.org/api/ng.$timeout | |
621 | + /////////////////////////////////////////////////////////////////////////// | |
622 | + interface ITimeoutService { | |
623 | + (delay?: number, invokeApply?: boolean): IPromise<void>; | |
624 | + <T>(fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>; | |
625 | + cancel(promise?: IPromise<any>): boolean; | |
626 | + } | |
627 | + | |
628 | + /////////////////////////////////////////////////////////////////////////// | |
629 | + // IntervalService | |
630 | + // see http://docs.angularjs.org/api/ng.$interval | |
631 | + /////////////////////////////////////////////////////////////////////////// | |
632 | + interface IIntervalService { | |
633 | + (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise<any>; | |
634 | + cancel(promise: IPromise<any>): boolean; | |
635 | + } | |
636 | + | |
637 | + /////////////////////////////////////////////////////////////////////////// | |
638 | + // AnimateProvider | |
639 | + // see http://docs.angularjs.org/api/ng/provider/$animateProvider | |
640 | + /////////////////////////////////////////////////////////////////////////// | |
641 | + interface IAnimateProvider { | |
642 | + /** | |
643 | + * Registers a new injectable animation factory function. | |
644 | + * | |
645 | + * @param name The name of the animation. | |
646 | + * @param factory The factory function that will be executed to return the animation object. | |
647 | + */ | |
648 | + register(name: string, factory: () => IAnimateCallbackObject): void; | |
649 | + | |
650 | + /** | |
651 | + * Gets and/or sets the CSS class expression that is checked when performing an animation. | |
652 | + * | |
653 | + * @param expression The className expression which will be checked against all animations. | |
654 | + * @returns The current CSS className expression value. If null then there is no expression value. | |
655 | + */ | |
656 | + classNameFilter(expression?: RegExp): RegExp; | |
657 | + } | |
658 | + | |
659 | + /** | |
660 | + * The animation object which contains callback functions for each event that is expected to be animated. | |
661 | + */ | |
662 | + interface IAnimateCallbackObject { | |
663 | + eventFn(element: Node, doneFn: () => void): Function; | |
664 | + } | |
665 | + | |
666 | + /** | |
667 | + * $filter - $filterProvider - service in module ng | |
668 | + * | |
669 | + * Filters are used for formatting data displayed to the user. | |
670 | + * | |
671 | + * see https://docs.angularjs.org/api/ng/service/$filter | |
672 | + */ | |
673 | + interface IFilterService { | |
674 | + (name: 'filter'): IFilterFilter; | |
675 | + (name: 'currency'): IFilterCurrency; | |
676 | + (name: 'number'): IFilterNumber; | |
677 | + (name: 'date'): IFilterDate; | |
678 | + (name: 'json'): IFilterJson; | |
679 | + (name: 'lowercase'): IFilterLowercase; | |
680 | + (name: 'uppercase'): IFilterUppercase; | |
681 | + (name: 'limitTo'): IFilterLimitTo; | |
682 | + (name: 'orderBy'): IFilterOrderBy; | |
683 | + /** | |
684 | + * Usage: | |
685 | + * $filter(name); | |
686 | + * | |
687 | + * @param name Name of the filter function to retrieve | |
688 | + */ | |
689 | + <T>(name: string): T; | |
690 | + } | |
691 | + | |
692 | + interface IFilterFilter { | |
693 | + <T>(array: T[], expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc<T>, comparator?: IFilterFilterComparatorFunc<T>|boolean): T[]; | |
694 | + } | |
695 | + | |
696 | + interface IFilterFilterPatternObject { | |
697 | + [name: string]: any; | |
698 | + } | |
699 | + | |
700 | + interface IFilterFilterPredicateFunc<T> { | |
701 | + (value: T, index: number, array: T[]): boolean; | |
702 | + } | |
703 | + | |
704 | + interface IFilterFilterComparatorFunc<T> { | |
705 | + (actual: T, expected: T): boolean; | |
706 | + } | |
707 | + | |
708 | + interface IFilterCurrency { | |
709 | + /** | |
710 | + * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. | |
711 | + * @param amount Input to filter. | |
712 | + * @param symbol Currency symbol or identifier to be displayed. | |
713 | + * @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale | |
714 | + * @return Formatted number | |
715 | + */ | |
716 | + (amount: number, symbol?: string, fractionSize?: number): string; | |
717 | + } | |
718 | + | |
719 | + interface IFilterNumber { | |
720 | + /** | |
721 | + * Formats a number as text. | |
722 | + * @param number Number to format. | |
723 | + * @param fractionSize Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3. | |
724 | + * @return Number rounded to decimalPlaces and places a “,” after each third digit. | |
725 | + */ | |
726 | + (value: number|string, fractionSize?: number|string): string; | |
727 | + } | |
728 | + | |
729 | + interface IFilterDate { | |
730 | + /** | |
731 | + * Formats date to a string based on the requested format. | |
732 | + * | |
733 | + * @param date Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone. | |
734 | + * @param format Formatting rules (see Description). If not specified, mediumDate is used. | |
735 | + * @param timezone Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. | |
736 | + * @return Formatted string or the input if input is not recognized as date/millis. | |
737 | + */ | |
738 | + (date: Date | number | string, format?: string, timezone?: string): string; | |
739 | + } | |
740 | + | |
741 | + interface IFilterJson { | |
742 | + /** | |
743 | + * Allows you to convert a JavaScript object into JSON string. | |
744 | + * @param object Any JavaScript object (including arrays and primitive types) to filter. | |
745 | + * @param spacing The number of spaces to use per indentation, defaults to 2. | |
746 | + * @return JSON string. | |
747 | + */ | |
748 | + (object: any, spacing?: number): string; | |
749 | + } | |
750 | + | |
751 | + interface IFilterLowercase { | |
752 | + /** | |
753 | + * Converts string to lowercase. | |
754 | + */ | |
755 | + (value: string): string; | |
756 | + } | |
757 | + | |
758 | + interface IFilterUppercase { | |
759 | + /** | |
760 | + * Converts string to uppercase. | |
761 | + */ | |
762 | + (value: string): string; | |
763 | + } | |
764 | + | |
765 | + interface IFilterLimitTo { | |
766 | + /** | |
767 | + * Creates a new array containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit. | |
768 | + * @param input Source array to be limited. | |
769 | + * @param limit The length of the returned array. If the limit number is positive, limit number of items from the beginning of the source array/string are copied. If the number is negative, limit number of items from the end of the source array are copied. The limit will be trimmed if it exceeds array.length. If limit is undefined, the input will be returned unchanged. | |
770 | + * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. | |
771 | + * @return A new sub-array of length limit or less if input array had less than limit elements. | |
772 | + */ | |
773 | + <T>(input: T[], limit: string|number, begin?: string|number): T[]; | |
774 | + /** | |
775 | + * Creates a new string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string. | |
776 | + * @param input Source string or number to be limited. | |
777 | + * @param limit The length of the returned string. If the limit number is positive, limit number of items from the beginning of the source string are copied. If the number is negative, limit number of items from the end of the source string are copied. The limit will be trimmed if it exceeds input.length. If limit is undefined, the input will be returned unchanged. | |
778 | + * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. | |
779 | + * @return A new substring of length limit or less if input had less than limit elements. | |
780 | + */ | |
781 | + (input: string|number, limit: string|number, begin?: string|number): string; | |
782 | + } | |
783 | + | |
784 | + interface IFilterOrderBy { | |
785 | + /** | |
786 | + * Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted as expected, make sure they are actually being saved as numbers and not strings. | |
787 | + * @param array The array to sort. | |
788 | + * @param expression A predicate to be used by the comparator to determine the order of elements. | |
789 | + * @param reverse Reverse the order of the array. | |
790 | + * @return Reverse the order of the array. | |
791 | + */ | |
792 | + <T>(array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[]; | |
793 | + } | |
794 | + | |
795 | + /** | |
796 | + * $filterProvider - $filter - provider in module ng | |
797 | + * | |
798 | + * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. | |
799 | + * | |
800 | + * see https://docs.angularjs.org/api/ng/provider/$filterProvider | |
801 | + */ | |
802 | + interface IFilterProvider extends IServiceProvider { | |
803 | + /** | |
804 | + * register(name); | |
805 | + * | |
806 | + * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). | |
807 | + */ | |
808 | + register(name: string | {}): IServiceProvider; | |
809 | + } | |
810 | + | |
811 | + /////////////////////////////////////////////////////////////////////////// | |
812 | + // LocaleService | |
813 | + // see http://docs.angularjs.org/api/ng.$locale | |
814 | + /////////////////////////////////////////////////////////////////////////// | |
815 | + interface ILocaleService { | |
816 | + id: string; | |
817 | + | |
818 | + // These are not documented | |
819 | + // Check angular's i18n files for exemples | |
820 | + NUMBER_FORMATS: ILocaleNumberFormatDescriptor; | |
821 | + DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; | |
822 | + pluralCat: (num: any) => string; | |
823 | + } | |
824 | + | |
825 | + interface ILocaleNumberFormatDescriptor { | |
826 | + DECIMAL_SEP: string; | |
827 | + GROUP_SEP: string; | |
828 | + PATTERNS: ILocaleNumberPatternDescriptor[]; | |
829 | + CURRENCY_SYM: string; | |
830 | + } | |
831 | + | |
832 | + interface ILocaleNumberPatternDescriptor { | |
833 | + minInt: number; | |
834 | + minFrac: number; | |
835 | + maxFrac: number; | |
836 | + posPre: string; | |
837 | + posSuf: string; | |
838 | + negPre: string; | |
839 | + negSuf: string; | |
840 | + gSize: number; | |
841 | + lgSize: number; | |
842 | + } | |
843 | + | |
844 | + interface ILocaleDateTimeFormatDescriptor { | |
845 | + MONTH: string[]; | |
846 | + SHORTMONTH: string[]; | |
847 | + DAY: string[]; | |
848 | + SHORTDAY: string[]; | |
849 | + AMPMS: string[]; | |
850 | + medium: string; | |
851 | + short: string; | |
852 | + fullDate: string; | |
853 | + longDate: string; | |
854 | + mediumDate: string; | |
855 | + shortDate: string; | |
856 | + mediumTime: string; | |
857 | + shortTime: string; | |
858 | + } | |
859 | + | |
860 | + /////////////////////////////////////////////////////////////////////////// | |
861 | + // LogService | |
862 | + // see http://docs.angularjs.org/api/ng.$log | |
863 | + // see http://docs.angularjs.org/api/ng.$logProvider | |
864 | + /////////////////////////////////////////////////////////////////////////// | |
865 | + interface ILogService { | |
866 | + debug: ILogCall; | |
867 | + error: ILogCall; | |
868 | + info: ILogCall; | |
869 | + log: ILogCall; | |
870 | + warn: ILogCall; | |
871 | + } | |
872 | + | |
873 | + interface ILogProvider extends IServiceProvider { | |
874 | + debugEnabled(): boolean; | |
875 | + debugEnabled(enabled: boolean): ILogProvider; | |
876 | + } | |
877 | + | |
878 | + // We define this as separate interface so we can reopen it later for | |
879 | + // the ngMock module. | |
880 | + interface ILogCall { | |
881 | + (...args: any[]): void; | |
882 | + } | |
883 | + | |
884 | + /////////////////////////////////////////////////////////////////////////// | |
885 | + // ParseService | |
886 | + // see http://docs.angularjs.org/api/ng.$parse | |
887 | + // see http://docs.angularjs.org/api/ng.$parseProvider | |
888 | + /////////////////////////////////////////////////////////////////////////// | |
889 | + interface IParseService { | |
890 | + (expression: string): ICompiledExpression; | |
891 | + } | |
892 | + | |
893 | + interface IParseProvider { | |
894 | + logPromiseWarnings(): boolean; | |
895 | + logPromiseWarnings(value: boolean): IParseProvider; | |
896 | + | |
897 | + unwrapPromises(): boolean; | |
898 | + unwrapPromises(value: boolean): IParseProvider; | |
899 | + } | |
900 | + | |
901 | + interface ICompiledExpression { | |
902 | + (context: any, locals?: any): any; | |
903 | + | |
904 | + literal: boolean; | |
905 | + constant: boolean; | |
906 | + | |
907 | + // If value is not provided, undefined is gonna be used since the implementation | |
908 | + // does not check the parameter. Let's force a value for consistency. If consumer | |
909 | + // whants to undefine it, pass the undefined value explicitly. | |
910 | + assign(context: any, value: any): any; | |
911 | + } | |
912 | + | |
913 | + /** | |
914 | + * $location - $locationProvider - service in module ng | |
915 | + * see https://docs.angularjs.org/api/ng/service/$location | |
916 | + */ | |
917 | + interface ILocationService { | |
918 | + absUrl(): string; | |
919 | + hash(): string; | |
920 | + hash(newHash: string): ILocationService; | |
921 | + host(): string; | |
922 | + | |
923 | + /** | |
924 | + * Return path of current url | |
925 | + */ | |
926 | + path(): string; | |
927 | + | |
928 | + /** | |
929 | + * Change path when called with parameter and return $location. | |
930 | + * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing. | |
931 | + * | |
932 | + * @param path New path | |
933 | + */ | |
934 | + path(path: string): ILocationService; | |
935 | + | |
936 | + port(): number; | |
937 | + protocol(): string; | |
938 | + replace(): ILocationService; | |
939 | + | |
940 | + /** | |
941 | + * Return search part (as object) of current url | |
942 | + */ | |
943 | + search(): any; | |
944 | + | |
945 | + /** | |
946 | + * Change search part when called with parameter and return $location. | |
947 | + * | |
948 | + * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value. | |
949 | + * | |
950 | + * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url. | |
951 | + */ | |
952 | + search(search: any): ILocationService; | |
953 | + | |
954 | + /** | |
955 | + * Change search part when called with parameter and return $location. | |
956 | + * | |
957 | + * @param search New search params | |
958 | + * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. If paramValue is an array, it will override the property of the search component of $location specified via the first argument. If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. | |
959 | + */ | |
960 | + search(search: string, paramValue: string|number|string[]|boolean): ILocationService; | |
961 | + | |
962 | + state(): any; | |
963 | + state(state: any): ILocationService; | |
964 | + url(): string; | |
965 | + url(url: string): ILocationService; | |
966 | + } | |
967 | + | |
968 | + interface ILocationProvider extends IServiceProvider { | |
969 | + hashPrefix(): string; | |
970 | + hashPrefix(prefix: string): ILocationProvider; | |
971 | + html5Mode(): boolean; | |
972 | + | |
973 | + // Documentation states that parameter is string, but | |
974 | + // implementation tests it as boolean, which makes more sense | |
975 | + // since this is a toggler | |
976 | + html5Mode(active: boolean): ILocationProvider; | |
977 | + html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider; | |
978 | + } | |
979 | + | |
980 | + /////////////////////////////////////////////////////////////////////////// | |
981 | + // DocumentService | |
982 | + // see http://docs.angularjs.org/api/ng.$document | |
983 | + /////////////////////////////////////////////////////////////////////////// | |
984 | + interface IDocumentService extends IAugmentedJQuery {} | |
985 | + | |
986 | + /////////////////////////////////////////////////////////////////////////// | |
987 | + // ExceptionHandlerService | |
988 | + // see http://docs.angularjs.org/api/ng.$exceptionHandler | |
989 | + /////////////////////////////////////////////////////////////////////////// | |
990 | + interface IExceptionHandlerService { | |
991 | + (exception: Error, cause?: string): void; | |
992 | + } | |
993 | + | |
994 | + /////////////////////////////////////////////////////////////////////////// | |
995 | + // RootElementService | |
996 | + // see http://docs.angularjs.org/api/ng.$rootElement | |
997 | + /////////////////////////////////////////////////////////////////////////// | |
998 | + interface IRootElementService extends JQuery {} | |
999 | + | |
1000 | + interface IQResolveReject<T> { | |
1001 | + (): void; | |
1002 | + (value: T): void; | |
1003 | + } | |
1004 | + /** | |
1005 | + * $q - service in module ng | |
1006 | + * A promise/deferred implementation inspired by Kris Kowal's Q. | |
1007 | + * See http://docs.angularjs.org/api/ng/service/$q | |
1008 | + */ | |
1009 | + interface IQService { | |
1010 | + new <T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>; | |
1011 | + new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>; | |
1012 | + <T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>; | |
1013 | + <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>; | |
1014 | + | |
1015 | + /** | |
1016 | + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. | |
1017 | + * | |
1018 | + * Returns a single promise that will be resolved with an array of values, each value corresponding to the promise at the same index in the promises array. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. | |
1019 | + * | |
1020 | + * @param promises An array of promises. | |
1021 | + */ | |
1022 | + all<T>(promises: IPromise<any>[]): IPromise<T[]>; | |
1023 | + /** | |
1024 | + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. | |
1025 | + * | |
1026 | + * Returns a single promise that will be resolved with a hash of values, each value corresponding to the promise at the same key in the promises hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. | |
1027 | + * | |
1028 | + * @param promises A hash of promises. | |
1029 | + */ | |
1030 | + all(promises: { [id: string]: IPromise<any>; }): IPromise<{ [id: string]: any; }>; | |
1031 | + all<T extends {}>(promises: { [id: string]: IPromise<any>; }): IPromise<T>; | |
1032 | + /** | |
1033 | + * Creates a Deferred object which represents a task which will finish in the future. | |
1034 | + */ | |
1035 | + defer<T>(): IDeferred<T>; | |
1036 | + /** | |
1037 | + * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. | |
1038 | + * | |
1039 | + * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. | |
1040 | + * | |
1041 | + * @param reason Constant, message, exception or an object representing the rejection reason. | |
1042 | + */ | |
1043 | + reject(reason?: any): IPromise<any>; | |
1044 | + /** | |
1045 | + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. | |
1046 | + * | |
1047 | + * @param value Value or a promise | |
1048 | + */ | |
1049 | + resolve<T>(value: IPromise<T>|T): IPromise<T>; | |
1050 | + /** | |
1051 | + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. | |
1052 | + */ | |
1053 | + resolve(): IPromise<void>; | |
1054 | + /** | |
1055 | + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. | |
1056 | + * | |
1057 | + * @param value Value or a promise | |
1058 | + */ | |
1059 | + when<T>(value: IPromise<T>|T): IPromise<T>; | |
1060 | + /** | |
1061 | + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. | |
1062 | + */ | |
1063 | + when(): IPromise<void>; | |
1064 | + } | |
1065 | + | |
1066 | + interface IPromise<T> { | |
1067 | + /** | |
1068 | + * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. | |
1069 | + * The successCallBack may return IPromise<void> for when a $q.reject() needs to be returned | |
1070 | + * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. | |
1071 | + */ | |
1072 | + then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>; | |
1073 | + | |
1074 | + /** | |
1075 | + * Shorthand for promise.then(null, errorCallback) | |
1076 | + */ | |
1077 | + catch<TResult>(onRejected: (reason: any) => IPromise<TResult>|TResult): IPromise<TResult>; | |
1078 | + | |
1079 | + /** | |
1080 | + * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. | |
1081 | + * | |
1082 | + * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. | |
1083 | + */ | |
1084 | + finally(finallyCallback: () => any): IPromise<T>; | |
1085 | + } | |
1086 | + | |
1087 | + interface IDeferred<T> { | |
1088 | + resolve(value?: T|IPromise<T>): void; | |
1089 | + reject(reason?: any): void; | |
1090 | + notify(state?: any): void; | |
1091 | + promise: IPromise<T>; | |
1092 | + } | |
1093 | + | |
1094 | + /////////////////////////////////////////////////////////////////////////// | |
1095 | + // AnchorScrollService | |
1096 | + // see http://docs.angularjs.org/api/ng.$anchorScroll | |
1097 | + /////////////////////////////////////////////////////////////////////////// | |
1098 | + interface IAnchorScrollService { | |
1099 | + (): void; | |
1100 | + (hash: string): void; | |
1101 | + yOffset: any; | |
1102 | + } | |
1103 | + | |
1104 | + interface IAnchorScrollProvider extends IServiceProvider { | |
1105 | + disableAutoScrolling(): void; | |
1106 | + } | |
1107 | + | |
1108 | + /** | |
1109 | + * $cacheFactory - service in module ng | |
1110 | + * | |
1111 | + * Factory that constructs Cache objects and gives access to them. | |
1112 | + * | |
1113 | + * see https://docs.angularjs.org/api/ng/service/$cacheFactory | |
1114 | + */ | |
1115 | + interface ICacheFactoryService { | |
1116 | + /** | |
1117 | + * Factory that constructs Cache objects and gives access to them. | |
1118 | + * | |
1119 | + * @param cacheId Name or id of the newly created cache. | |
1120 | + * @param optionsMap Options object that specifies the cache behavior. Properties: | |
1121 | + * | |
1122 | + * capacity — turns the cache into LRU cache. | |
1123 | + */ | |
1124 | + (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; | |
1125 | + | |
1126 | + /** | |
1127 | + * Get information about all the caches that have been created. | |
1128 | + * @returns key-value map of cacheId to the result of calling cache#info | |
1129 | + */ | |
1130 | + info(): any; | |
1131 | + | |
1132 | + /** | |
1133 | + * Get access to a cache object by the cacheId used when it was created. | |
1134 | + * | |
1135 | + * @param cacheId Name or id of a cache to access. | |
1136 | + */ | |
1137 | + get(cacheId: string): ICacheObject; | |
1138 | + } | |
1139 | + | |
1140 | + /** | |
1141 | + * $cacheFactory.Cache - type in module ng | |
1142 | + * | |
1143 | + * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. | |
1144 | + * | |
1145 | + * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache | |
1146 | + */ | |
1147 | + interface ICacheObject { | |
1148 | + /** | |
1149 | + * Retrieve information regarding a particular Cache. | |
1150 | + */ | |
1151 | + info(): { | |
1152 | + /** | |
1153 | + * the id of the cache instance | |
1154 | + */ | |
1155 | + id: string; | |
1156 | + | |
1157 | + /** | |
1158 | + * the number of entries kept in the cache instance | |
1159 | + */ | |
1160 | + size: number; | |
1161 | + | |
1162 | + //...: any additional properties from the options object when creating the cache. | |
1163 | + }; | |
1164 | + | |
1165 | + /** | |
1166 | + * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. | |
1167 | + * | |
1168 | + * It will not insert undefined values into the cache. | |
1169 | + * | |
1170 | + * @param key the key under which the cached data is stored. | |
1171 | + * @param value the value to store alongside the key. If it is undefined, the key will not be stored. | |
1172 | + */ | |
1173 | + put<T>(key: string, value?: T): T; | |
1174 | + | |
1175 | + /** | |
1176 | + * Retrieves named data stored in the Cache object. | |
1177 | + * | |
1178 | + * @param key the key of the data to be retrieved | |
1179 | + */ | |
1180 | + get<T>(key: string): T; | |
1181 | + | |
1182 | + /** | |
1183 | + * Removes an entry from the Cache object. | |
1184 | + * | |
1185 | + * @param key the key of the entry to be removed | |
1186 | + */ | |
1187 | + remove(key: string): void; | |
1188 | + | |
1189 | + /** | |
1190 | + * Clears the cache object of any entries. | |
1191 | + */ | |
1192 | + removeAll(): void; | |
1193 | + | |
1194 | + /** | |
1195 | + * Destroys the Cache object entirely, removing it from the $cacheFactory set. | |
1196 | + */ | |
1197 | + destroy(): void; | |
1198 | + } | |
1199 | + | |
1200 | + /////////////////////////////////////////////////////////////////////////// | |
1201 | + // CompileService | |
1202 | + // see http://docs.angularjs.org/api/ng.$compile | |
1203 | + // see http://docs.angularjs.org/api/ng.$compileProvider | |
1204 | + /////////////////////////////////////////////////////////////////////////// | |
1205 | + interface ICompileService { | |
1206 | + (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; | |
1207 | + (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; | |
1208 | + (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; | |
1209 | + } | |
1210 | + | |
1211 | + interface ICompileProvider extends IServiceProvider { | |
1212 | + directive(name: string, directiveFactory: Function): ICompileProvider; | |
1213 | + | |
1214 | + // Undocumented, but it is there... | |
1215 | + directive(directivesMap: any): ICompileProvider; | |
1216 | + | |
1217 | + aHrefSanitizationWhitelist(): RegExp; | |
1218 | + aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; | |
1219 | + | |
1220 | + imgSrcSanitizationWhitelist(): RegExp; | |
1221 | + imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; | |
1222 | + | |
1223 | + debugInfoEnabled(enabled?: boolean): any; | |
1224 | + } | |
1225 | + | |
1226 | + interface ICloneAttachFunction { | |
1227 | + // Let's hint but not force cloneAttachFn's signature | |
1228 | + (clonedElement?: JQuery, scope?: IScope): any; | |
1229 | + } | |
1230 | + | |
1231 | + // This corresponds to the "publicLinkFn" returned by $compile. | |
1232 | + interface ITemplateLinkingFunction { | |
1233 | + (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; | |
1234 | + } | |
1235 | + | |
1236 | + // This corresponds to $transclude (and also the transclude function passed to link). | |
1237 | + interface ITranscludeFunction { | |
1238 | + // If the scope is provided, then the cloneAttachFn must be as well. | |
1239 | + (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; | |
1240 | + // If one argument is provided, then it's assumed to be the cloneAttachFn. | |
1241 | + (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; | |
1242 | + } | |
1243 | + | |
1244 | + /////////////////////////////////////////////////////////////////////////// | |
1245 | + // ControllerService | |
1246 | + // see http://docs.angularjs.org/api/ng.$controller | |
1247 | + // see http://docs.angularjs.org/api/ng.$controllerProvider | |
1248 | + /////////////////////////////////////////////////////////////////////////// | |
1249 | + interface IControllerService { | |
1250 | + // Although the documentation doesn't state this, locals are optional | |
1251 | + <T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindToController?: any): T; | |
1252 | + <T>(controllerConstructor: Function, locals?: any, bindToController?: any): T; | |
1253 | + <T>(controllerName: string, locals?: any, bindToController?: any): T; | |
1254 | + } | |
1255 | + | |
1256 | + interface IControllerProvider extends IServiceProvider { | |
1257 | + register(name: string, controllerConstructor: Function): void; | |
1258 | + register(name: string, dependencyAnnotatedConstructor: any[]): void; | |
1259 | + allowGlobals(): void; | |
1260 | + } | |
1261 | + | |
1262 | + /** | |
1263 | + * HttpService | |
1264 | + * see http://docs.angularjs.org/api/ng/service/$http | |
1265 | + */ | |
1266 | + interface IHttpService { | |
1267 | + /** | |
1268 | + * Object describing the request to be made and how it should be processed. | |
1269 | + */ | |
1270 | + <T>(config: IRequestConfig): IHttpPromise<T>; | |
1271 | + | |
1272 | + /** | |
1273 | + * Shortcut method to perform GET request. | |
1274 | + * | |
1275 | + * @param url Relative or absolute URL specifying the destination of the request | |
1276 | + * @param config Optional configuration object | |
1277 | + */ | |
1278 | + get<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1279 | + | |
1280 | + /** | |
1281 | + * Shortcut method to perform DELETE request. | |
1282 | + * | |
1283 | + * @param url Relative or absolute URL specifying the destination of the request | |
1284 | + * @param config Optional configuration object | |
1285 | + */ | |
1286 | + delete<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1287 | + | |
1288 | + /** | |
1289 | + * Shortcut method to perform HEAD request. | |
1290 | + * | |
1291 | + * @param url Relative or absolute URL specifying the destination of the request | |
1292 | + * @param config Optional configuration object | |
1293 | + */ | |
1294 | + head<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1295 | + | |
1296 | + /** | |
1297 | + * Shortcut method to perform JSONP request. | |
1298 | + * | |
1299 | + * @param url Relative or absolute URL specifying the destination of the request | |
1300 | + * @param config Optional configuration object | |
1301 | + */ | |
1302 | + jsonp<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1303 | + | |
1304 | + /** | |
1305 | + * Shortcut method to perform POST request. | |
1306 | + * | |
1307 | + * @param url Relative or absolute URL specifying the destination of the request | |
1308 | + * @param data Request content | |
1309 | + * @param config Optional configuration object | |
1310 | + */ | |
1311 | + post<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1312 | + | |
1313 | + /** | |
1314 | + * Shortcut method to perform PUT request. | |
1315 | + * | |
1316 | + * @param url Relative or absolute URL specifying the destination of the request | |
1317 | + * @param data Request content | |
1318 | + * @param config Optional configuration object | |
1319 | + */ | |
1320 | + put<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1321 | + | |
1322 | + /** | |
1323 | + * Shortcut method to perform PATCH request. | |
1324 | + * | |
1325 | + * @param url Relative or absolute URL specifying the destination of the request | |
1326 | + * @param data Request content | |
1327 | + * @param config Optional configuration object | |
1328 | + */ | |
1329 | + patch<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>; | |
1330 | + | |
1331 | + /** | |
1332 | + * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. | |
1333 | + */ | |
1334 | + defaults: IHttpProviderDefaults; | |
1335 | + | |
1336 | + /** | |
1337 | + * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. | |
1338 | + */ | |
1339 | + pendingRequests: IRequestConfig[]; | |
1340 | + } | |
1341 | + | |
1342 | + /** | |
1343 | + * Object describing the request to be made and how it should be processed. | |
1344 | + * see http://docs.angularjs.org/api/ng/service/$http#usage | |
1345 | + */ | |
1346 | + interface IRequestShortcutConfig extends IHttpProviderDefaults { | |
1347 | + /** | |
1348 | + * {Object.<string|Object>} | |
1349 | + * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. | |
1350 | + */ | |
1351 | + params?: any; | |
1352 | + | |
1353 | + /** | |
1354 | + * {string|Object} | |
1355 | + * Data to be sent as the request message data. | |
1356 | + */ | |
1357 | + data?: any; | |
1358 | + | |
1359 | + /** | |
1360 | + * Timeout in milliseconds, or promise that should abort the request when resolved. | |
1361 | + */ | |
1362 | + timeout?: number|IPromise<any>; | |
1363 | + | |
1364 | + /** | |
1365 | + * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype | |
1366 | + */ | |
1367 | + responseType?: string; | |
1368 | + } | |
1369 | + | |
1370 | + /** | |
1371 | + * Object describing the request to be made and how it should be processed. | |
1372 | + * see http://docs.angularjs.org/api/ng/service/$http#usage | |
1373 | + */ | |
1374 | + interface IRequestConfig extends IRequestShortcutConfig { | |
1375 | + /** | |
1376 | + * HTTP method (e.g. 'GET', 'POST', etc) | |
1377 | + */ | |
1378 | + method: string; | |
1379 | + /** | |
1380 | + * Absolute or relative URL of the resource that is being requested. | |
1381 | + */ | |
1382 | + url: string; | |
1383 | + } | |
1384 | + | |
1385 | + interface IHttpHeadersGetter { | |
1386 | + (): { [name: string]: string; }; | |
1387 | + (headerName: string): string; | |
1388 | + } | |
1389 | + | |
1390 | + interface IHttpPromiseCallback<T> { | |
1391 | + (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void; | |
1392 | + } | |
1393 | + | |
1394 | + interface IHttpPromiseCallbackArg<T> { | |
1395 | + data?: T; | |
1396 | + status?: number; | |
1397 | + headers?: IHttpHeadersGetter; | |
1398 | + config?: IRequestConfig; | |
1399 | + statusText?: string; | |
1400 | + } | |
1401 | + | |
1402 | + interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> { | |
1403 | + success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>; | |
1404 | + error(callback: IHttpPromiseCallback<any>): IHttpPromise<T>; | |
1405 | + } | |
1406 | + | |
1407 | + // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228 | |
1408 | + interface IHttpRequestTransformer { | |
1409 | + (data: any, headersGetter: IHttpHeadersGetter): any; | |
1410 | + } | |
1411 | + | |
1412 | + // The definition of fields are the same as IHttpPromiseCallbackArg | |
1413 | + interface IHttpResponseTransformer { | |
1414 | + (data: any, headersGetter: IHttpHeadersGetter, status: number): any; | |
1415 | + } | |
1416 | + | |
1417 | + interface IHttpRequestConfigHeaders { | |
1418 | + [requestType: string]: string|(() => string); | |
1419 | + common?: string|(() => string); | |
1420 | + get?: string|(() => string); | |
1421 | + post?: string|(() => string); | |
1422 | + put?: string|(() => string); | |
1423 | + patch?: string|(() => string); | |
1424 | + } | |
1425 | + | |
1426 | + /** | |
1427 | + * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured | |
1428 | + * via defaults and the docs do not say which. The following is based on the inspection of the source code. | |
1429 | + * https://docs.angularjs.org/api/ng/service/$http#defaults | |
1430 | + * https://docs.angularjs.org/api/ng/service/$http#usage | |
1431 | + * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section | |
1432 | + */ | |
1433 | + interface IHttpProviderDefaults { | |
1434 | + /** | |
1435 | + * {boolean|Cache} | |
1436 | + * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. | |
1437 | + */ | |
1438 | + cache?: any; | |
1439 | + | |
1440 | + /** | |
1441 | + * Transform function or an array of such functions. The transform function takes the http request body and | |
1442 | + * headers and returns its transformed (typically serialized) version. | |
1443 | + * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses} | |
1444 | + */ | |
1445 | + transformRequest?: IHttpRequestTransformer |IHttpRequestTransformer[]; | |
1446 | + | |
1447 | + /** | |
1448 | + * Transform function or an array of such functions. The transform function takes the http response body and | |
1449 | + * headers and returns its transformed (typically deserialized) version. | |
1450 | + */ | |
1451 | + transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; | |
1452 | + | |
1453 | + /** | |
1454 | + * Map of strings or functions which return strings representing HTTP headers to send to the server. If the | |
1455 | + * return value of a function is null, the header will not be sent. | |
1456 | + * The key of the map is the request verb in lower case. The "common" key applies to all requests. | |
1457 | + * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers} | |
1458 | + */ | |
1459 | + headers?: IHttpRequestConfigHeaders; | |
1460 | + | |
1461 | + /** Name of HTTP header to populate with the XSRF token. */ | |
1462 | + xsrfHeaderName?: string; | |
1463 | + | |
1464 | + /** Name of cookie containing the XSRF token. */ | |
1465 | + xsrfCookieName?: string; | |
1466 | + | |
1467 | + /** | |
1468 | + * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. | |
1469 | + */ | |
1470 | + withCredentials?: boolean; | |
1471 | + | |
1472 | + /** | |
1473 | + * A function used to the prepare string representation of request parameters (specified as an object). If | |
1474 | + * specified as string, it is interpreted as a function registered with the $injector. Defaults to | |
1475 | + * $httpParamSerializer. | |
1476 | + */ | |
1477 | + paramSerializer?: string | ((obj: any) => string); | |
1478 | + } | |
1479 | + | |
1480 | + interface IHttpInterceptor { | |
1481 | + request?: (config: IRequestConfig) => IRequestConfig|IPromise<IRequestConfig>; | |
1482 | + requestError?: (rejection: any) => any; | |
1483 | + response?: <T>(response: IHttpPromiseCallbackArg<T>) => IPromise<T>|T; | |
1484 | + responseError?: (rejection: any) => any; | |
1485 | + } | |
1486 | + | |
1487 | + interface IHttpInterceptorFactory { | |
1488 | + (...args: any[]): IHttpInterceptor; | |
1489 | + } | |
1490 | + | |
1491 | + interface IHttpProvider extends IServiceProvider { | |
1492 | + defaults: IHttpProviderDefaults; | |
1493 | + | |
1494 | + /** | |
1495 | + * Register service factories (names or implementations) for interceptors which are called before and after | |
1496 | + * each request. | |
1497 | + */ | |
1498 | + interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[]; | |
1499 | + useApplyAsync(): boolean; | |
1500 | + useApplyAsync(value: boolean): IHttpProvider; | |
1501 | + | |
1502 | + /** | |
1503 | + * | |
1504 | + * @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods. | |
1505 | + * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. | |
1506 | + * otherwise, returns the current configured value. | |
1507 | + */ | |
1508 | + useLegacyPromiseExtensions(value:boolean) : boolean | IHttpProvider; | |
1509 | + } | |
1510 | + | |
1511 | + /////////////////////////////////////////////////////////////////////////// | |
1512 | + // HttpBackendService | |
1513 | + // see http://docs.angularjs.org/api/ng.$httpBackend | |
1514 | + // You should never need to use this service directly. | |
1515 | + /////////////////////////////////////////////////////////////////////////// | |
1516 | + interface IHttpBackendService { | |
1517 | + // XXX Perhaps define callback signature in the future | |
1518 | + (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; | |
1519 | + } | |
1520 | + | |
1521 | + /////////////////////////////////////////////////////////////////////////// | |
1522 | + // InterpolateService | |
1523 | + // see http://docs.angularjs.org/api/ng.$interpolate | |
1524 | + // see http://docs.angularjs.org/api/ng.$interpolateProvider | |
1525 | + /////////////////////////////////////////////////////////////////////////// | |
1526 | + interface IInterpolateService { | |
1527 | + (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction; | |
1528 | + endSymbol(): string; | |
1529 | + startSymbol(): string; | |
1530 | + } | |
1531 | + | |
1532 | + interface IInterpolationFunction { | |
1533 | + (context: any): string; | |
1534 | + } | |
1535 | + | |
1536 | + interface IInterpolateProvider extends IServiceProvider { | |
1537 | + startSymbol(): string; | |
1538 | + startSymbol(value: string): IInterpolateProvider; | |
1539 | + endSymbol(): string; | |
1540 | + endSymbol(value: string): IInterpolateProvider; | |
1541 | + } | |
1542 | + | |
1543 | + /////////////////////////////////////////////////////////////////////////// | |
1544 | + // TemplateCacheService | |
1545 | + // see http://docs.angularjs.org/api/ng.$templateCache | |
1546 | + /////////////////////////////////////////////////////////////////////////// | |
1547 | + interface ITemplateCacheService extends ICacheObject {} | |
1548 | + | |
1549 | + /////////////////////////////////////////////////////////////////////////// | |
1550 | + // SCEService | |
1551 | + // see http://docs.angularjs.org/api/ng.$sce | |
1552 | + /////////////////////////////////////////////////////////////////////////// | |
1553 | + interface ISCEService { | |
1554 | + getTrusted(type: string, mayBeTrusted: any): any; | |
1555 | + getTrustedCss(value: any): any; | |
1556 | + getTrustedHtml(value: any): any; | |
1557 | + getTrustedJs(value: any): any; | |
1558 | + getTrustedResourceUrl(value: any): any; | |
1559 | + getTrustedUrl(value: any): any; | |
1560 | + parse(type: string, expression: string): (context: any, locals: any) => any; | |
1561 | + parseAsCss(expression: string): (context: any, locals: any) => any; | |
1562 | + parseAsHtml(expression: string): (context: any, locals: any) => any; | |
1563 | + parseAsJs(expression: string): (context: any, locals: any) => any; | |
1564 | + parseAsResourceUrl(expression: string): (context: any, locals: any) => any; | |
1565 | + parseAsUrl(expression: string): (context: any, locals: any) => any; | |
1566 | + trustAs(type: string, value: any): any; | |
1567 | + trustAsHtml(value: any): any; | |
1568 | + trustAsJs(value: any): any; | |
1569 | + trustAsResourceUrl(value: any): any; | |
1570 | + trustAsUrl(value: any): any; | |
1571 | + isEnabled(): boolean; | |
1572 | + } | |
1573 | + | |
1574 | + /////////////////////////////////////////////////////////////////////////// | |
1575 | + // SCEProvider | |
1576 | + // see http://docs.angularjs.org/api/ng.$sceProvider | |
1577 | + /////////////////////////////////////////////////////////////////////////// | |
1578 | + interface ISCEProvider extends IServiceProvider { | |
1579 | + enabled(value: boolean): void; | |
1580 | + } | |
1581 | + | |
1582 | + /////////////////////////////////////////////////////////////////////////// | |
1583 | + // SCEDelegateService | |
1584 | + // see http://docs.angularjs.org/api/ng.$sceDelegate | |
1585 | + /////////////////////////////////////////////////////////////////////////// | |
1586 | + interface ISCEDelegateService { | |
1587 | + getTrusted(type: string, mayBeTrusted: any): any; | |
1588 | + trustAs(type: string, value: any): any; | |
1589 | + valueOf(value: any): any; | |
1590 | + } | |
1591 | + | |
1592 | + | |
1593 | + /////////////////////////////////////////////////////////////////////////// | |
1594 | + // SCEDelegateProvider | |
1595 | + // see http://docs.angularjs.org/api/ng.$sceDelegateProvider | |
1596 | + /////////////////////////////////////////////////////////////////////////// | |
1597 | + interface ISCEDelegateProvider extends IServiceProvider { | |
1598 | + resourceUrlBlacklist(blacklist: any[]): void; | |
1599 | + resourceUrlWhitelist(whitelist: any[]): void; | |
1600 | + resourceUrlBlacklist(): any[]; | |
1601 | + resourceUrlWhitelist(): any[]; | |
1602 | + } | |
1603 | + | |
1604 | + /** | |
1605 | + * $templateRequest service | |
1606 | + * see http://docs.angularjs.org/api/ng/service/$templateRequest | |
1607 | + */ | |
1608 | + interface ITemplateRequestService { | |
1609 | + /** | |
1610 | + * Downloads a template using $http and, upon success, stores the | |
1611 | + * contents inside of $templateCache. | |
1612 | + * | |
1613 | + * If the HTTP request fails or the response data of the HTTP request is | |
1614 | + * empty then a $compile error will be thrown (unless | |
1615 | + * {ignoreRequestError} is set to true). | |
1616 | + * | |
1617 | + * @param tpl The template URL. | |
1618 | + * @param ignoreRequestError Whether or not to ignore the exception | |
1619 | + * when the request fails or the template is | |
1620 | + * empty. | |
1621 | + * | |
1622 | + * @return A promise whose value is the template content. | |
1623 | + */ | |
1624 | + (tpl: string, ignoreRequestError?: boolean): IPromise<string>; | |
1625 | + /** | |
1626 | + * total amount of pending template requests being downloaded. | |
1627 | + * @type {number} | |
1628 | + */ | |
1629 | + totalPendingRequests: number; | |
1630 | + } | |
1631 | + | |
1632 | + /////////////////////////////////////////////////////////////////////////// | |
1633 | + // Component | |
1634 | + // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html | |
1635 | + // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ | |
1636 | + /////////////////////////////////////////////////////////////////////////// | |
1637 | + /** | |
1638 | + * Runtime representation a type that a Component or other object is instances of. | |
1639 | + * | |
1640 | + * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by | |
1641 | + * the `MyCustomComponent` constructor function. | |
1642 | + */ | |
1643 | + interface Type extends Function { | |
1644 | + } | |
1645 | + | |
1646 | + /** | |
1647 | + * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. | |
1648 | + * | |
1649 | + * Supported keys: | |
1650 | + * - `path` or `aux` (requires exactly one of these) | |
1651 | + * - `component`, `loader`, `redirectTo` (requires exactly one of these) | |
1652 | + * - `name` or `as` (optional) (requires exactly one of these) | |
1653 | + * - `data` (optional) | |
1654 | + * | |
1655 | + * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. | |
1656 | + */ | |
1657 | + interface RouteDefinition { | |
1658 | + path?: string; | |
1659 | + aux?: string; | |
1660 | + component?: Type | ComponentDefinition | string; | |
1661 | + loader?: Function; | |
1662 | + redirectTo?: any[]; | |
1663 | + as?: string; | |
1664 | + name?: string; | |
1665 | + data?: any; | |
1666 | + useAsDefault?: boolean; | |
1667 | + } | |
1668 | + | |
1669 | + /** | |
1670 | + * Represents either a component type (`type` is `component`) or a loader function | |
1671 | + * (`type` is `loader`). | |
1672 | + * | |
1673 | + * See also {@link RouteDefinition}. | |
1674 | + */ | |
1675 | + interface ComponentDefinition { | |
1676 | + type: string; | |
1677 | + loader?: Function; | |
1678 | + component?: Type; | |
1679 | + } | |
1680 | + | |
1681 | + /** | |
1682 | + * Component definition object (a simplified directive definition object) | |
1683 | + */ | |
1684 | + interface IComponentOptions { | |
1685 | + /** | |
1686 | + * Controller constructor function that should be associated with newly created scope or the name of a registered | |
1687 | + * controller if passed as a string. Empty function by default. | |
1688 | + */ | |
1689 | + controller?: any; | |
1690 | + /** | |
1691 | + * An identifier name for a reference to the controller. If present, the controller will be published to scope under | |
1692 | + * the controllerAs name. If not present, this will default to be the same as the component name. | |
1693 | + */ | |
1694 | + controllerAs?: string; | |
1695 | + /** | |
1696 | + * html template as a string or a function that returns an html template as a string which should be used as the | |
1697 | + * contents of this component. Empty string by default. | |
1698 | + * If template is a function, then it is injected with the following locals: | |
1699 | + * $element - Current element | |
1700 | + * $attrs - Current attributes object for the element | |
1701 | + */ | |
1702 | + template?: string | Function; | |
1703 | + /** | |
1704 | + * path or function that returns a path to an html template that should be used as the contents of this component. | |
1705 | + * If templateUrl is a function, then it is injected with the following locals: | |
1706 | + * $element - Current element | |
1707 | + * $attrs - Current attributes object for the element | |
1708 | + */ | |
1709 | + templateUrl?: string | Function; | |
1710 | + /** | |
1711 | + * Define DOM attribute binding to component properties. Component properties are always bound to the component | |
1712 | + * controller and not to the scope. | |
1713 | + */ | |
1714 | + bindings?: any; | |
1715 | + /** | |
1716 | + * Whether transclusion is enabled. Enabled by default. | |
1717 | + */ | |
1718 | + transclude?: boolean; | |
1719 | + require? : Object; | |
1720 | + $canActivate?: () => boolean; | |
1721 | + $routeConfig?: RouteDefinition[]; | |
1722 | + } | |
1723 | + | |
1724 | + interface IComponentTemplateFn { | |
1725 | + ( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string; | |
1726 | + } | |
1727 | + | |
1728 | + /////////////////////////////////////////////////////////////////////////// | |
1729 | + // Directive | |
1730 | + // see http://docs.angularjs.org/api/ng.$compileProvider#directive | |
1731 | + // and http://docs.angularjs.org/guide/directive | |
1732 | + /////////////////////////////////////////////////////////////////////////// | |
1733 | + | |
1734 | + interface IDirectiveFactory { | |
1735 | + (...args: any[]): IDirective; | |
1736 | + } | |
1737 | + | |
1738 | + interface IDirectiveLinkFn { | |
1739 | + ( | |
1740 | + scope: IScope, | |
1741 | + instanceElement: IAugmentedJQuery, | |
1742 | + instanceAttributes: IAttributes, | |
1743 | + controller: {}, | |
1744 | + transclude: ITranscludeFunction | |
1745 | + ): void; | |
1746 | + } | |
1747 | + | |
1748 | + interface IDirectivePrePost { | |
1749 | + pre?: IDirectiveLinkFn; | |
1750 | + post?: IDirectiveLinkFn; | |
1751 | + } | |
1752 | + | |
1753 | + interface IDirectiveCompileFn { | |
1754 | + ( | |
1755 | + templateElement: IAugmentedJQuery, | |
1756 | + templateAttributes: IAttributes, | |
1757 | + transclude: ITranscludeFunction | |
1758 | + ): IDirectivePrePost; | |
1759 | + } | |
1760 | + | |
1761 | + interface IDirective { | |
1762 | + compile?: IDirectiveCompileFn; | |
1763 | + controller?: any; | |
1764 | + controllerAs?: string; | |
1765 | + bindToController?: boolean|Object; | |
1766 | + link?: IDirectiveLinkFn | IDirectivePrePost; | |
1767 | + name?: string; | |
1768 | + priority?: number; | |
1769 | + replace?: boolean; | |
1770 | + require? : any; | |
1771 | + restrict?: string; | |
1772 | + scope?: any; | |
1773 | + template?: string | Function; | |
1774 | + templateNamespace?: string; | |
1775 | + templateUrl?: string | Function; | |
1776 | + terminal?: boolean; | |
1777 | + transclude?: any; | |
1778 | + } | |
1779 | + | |
1780 | + /** | |
1781 | + * angular.element | |
1782 | + * when calling angular.element, angular returns a jQuery object, | |
1783 | + * augmented with additional methods like e.g. scope. | |
1784 | + * see: http://docs.angularjs.org/api/angular.element | |
1785 | + */ | |
1786 | + interface IAugmentedJQueryStatic extends JQueryStatic { | |
1787 | + (selector: string, context?: any): IAugmentedJQuery; | |
1788 | + (element: Element): IAugmentedJQuery; | |
1789 | + (object: {}): IAugmentedJQuery; | |
1790 | + (elementArray: Element[]): IAugmentedJQuery; | |
1791 | + (object: JQuery): IAugmentedJQuery; | |
1792 | + (func: Function): IAugmentedJQuery; | |
1793 | + (array: any[]): IAugmentedJQuery; | |
1794 | + (): IAugmentedJQuery; | |
1795 | + } | |
1796 | + | |
1797 | + interface IAugmentedJQuery extends JQuery { | |
1798 | + // TODO: events, how to define? | |
1799 | + //$destroy | |
1800 | + | |
1801 | + find(selector: string): IAugmentedJQuery; | |
1802 | + find(element: any): IAugmentedJQuery; | |
1803 | + find(obj: JQuery): IAugmentedJQuery; | |
1804 | + controller(): any; | |
1805 | + controller(name: string): any; | |
1806 | + injector(): any; | |
1807 | + scope(): IScope; | |
1808 | + isolateScope(): IScope; | |
1809 | + | |
1810 | + inheritedData(key: string, value: any): JQuery; | |
1811 | + inheritedData(obj: { [key: string]: any; }): JQuery; | |
1812 | + inheritedData(key?: string): any; | |
1813 | + } | |
1814 | + | |
1815 | + /////////////////////////////////////////////////////////////////////////// | |
1816 | + // AUTO module (angular.js) | |
1817 | + /////////////////////////////////////////////////////////////////////////// | |
1818 | + export module auto { | |
1819 | + | |
1820 | + /////////////////////////////////////////////////////////////////////// | |
1821 | + // InjectorService | |
1822 | + // see http://docs.angularjs.org/api/AUTO.$injector | |
1823 | + /////////////////////////////////////////////////////////////////////// | |
1824 | + interface IInjectorService { | |
1825 | + annotate(fn: Function): string[]; | |
1826 | + annotate(inlineAnnotatedFunction: any[]): string[]; | |
1827 | + get<T>(name: string, caller?: string): T; | |
1828 | + has(name: string): boolean; | |
1829 | + instantiate<T>(typeConstructor: Function, locals?: any): T; | |
1830 | + invoke(inlineAnnotatedFunction: any[]): any; | |
1831 | + invoke(func: Function, context?: any, locals?: any): any; | |
1832 | + } | |
1833 | + | |
1834 | + /////////////////////////////////////////////////////////////////////// | |
1835 | + // ProvideService | |
1836 | + // see http://docs.angularjs.org/api/AUTO.$provide | |
1837 | + /////////////////////////////////////////////////////////////////////// | |
1838 | + interface IProvideService { | |
1839 | + // Documentation says it returns the registered instance, but actual | |
1840 | + // implementation does not return anything. | |
1841 | + // constant(name: string, value: any): any; | |
1842 | + /** | |
1843 | + * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. | |
1844 | + * | |
1845 | + * @param name The name of the constant. | |
1846 | + * @param value The constant value. | |
1847 | + */ | |
1848 | + constant(name: string, value: any): void; | |
1849 | + | |
1850 | + /** | |
1851 | + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. | |
1852 | + * | |
1853 | + * @param name The name of the service to decorate. | |
1854 | + * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: | |
1855 | + * | |
1856 | + * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. | |
1857 | + */ | |
1858 | + decorator(name: string, decorator: Function): void; | |
1859 | + /** | |
1860 | + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. | |
1861 | + * | |
1862 | + * @param name The name of the service to decorate. | |
1863 | + * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: | |
1864 | + * | |
1865 | + * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. | |
1866 | + */ | |
1867 | + decorator(name: string, inlineAnnotatedFunction: any[]): void; | |
1868 | + factory(name: string, serviceFactoryFunction: Function): IServiceProvider; | |
1869 | + factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; | |
1870 | + provider(name: string, provider: IServiceProvider): IServiceProvider; | |
1871 | + provider(name: string, serviceProviderConstructor: Function): IServiceProvider; | |
1872 | + service(name: string, constructor: Function): IServiceProvider; | |
1873 | + service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; | |
1874 | + value(name: string, value: any): IServiceProvider; | |
1875 | + } | |
1876 | + | |
1877 | + } | |
1878 | +} | |
0 | 1879 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,670 @@ |
1 | +// Compiled using typings@0.6.8 | |
2 | +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4de74cb527395c13ba20b438c3a7a419ad931f1c/es6-shim/es6-shim.d.ts | |
3 | +// Type definitions for es6-shim v0.31.2 | |
4 | +// Project: https://github.com/paulmillr/es6-shim | |
5 | +// Definitions by: Ron Buckton <http://github.com/rbuckton> | |
6 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped | |
7 | + | |
8 | +declare type PropertyKey = string | number | symbol; | |
9 | + | |
10 | +interface IteratorResult<T> { | |
11 | + done: boolean; | |
12 | + value?: T; | |
13 | +} | |
14 | + | |
15 | +interface IterableShim<T> { | |
16 | + /** | |
17 | + * Shim for an ES6 iterable. Not intended for direct use by user code. | |
18 | + */ | |
19 | + "_es6-shim iterator_"(): Iterator<T>; | |
20 | +} | |
21 | + | |
22 | +interface Iterator<T> { | |
23 | + next(value?: any): IteratorResult<T>; | |
24 | + return?(value?: any): IteratorResult<T>; | |
25 | + throw?(e?: any): IteratorResult<T>; | |
26 | +} | |
27 | + | |
28 | +interface IterableIteratorShim<T> extends IterableShim<T>, Iterator<T> { | |
29 | + /** | |
30 | + * Shim for an ES6 iterable iterator. Not intended for direct use by user code. | |
31 | + */ | |
32 | + "_es6-shim iterator_"(): IterableIteratorShim<T>; | |
33 | +} | |
34 | + | |
35 | +interface StringConstructor { | |
36 | + /** | |
37 | + * Return the String value whose elements are, in order, the elements in the List elements. | |
38 | + * If length is 0, the empty string is returned. | |
39 | + */ | |
40 | + fromCodePoint(...codePoints: number[]): string; | |
41 | + | |
42 | + /** | |
43 | + * String.raw is intended for use as a tag function of a Tagged Template String. When called | |
44 | + * as such the first argument will be a well formed template call site object and the rest | |
45 | + * parameter will contain the substitution values. | |
46 | + * @param template A well-formed template string call site representation. | |
47 | + * @param substitutions A set of substitution values. | |
48 | + */ | |
49 | + raw(template: TemplateStringsArray, ...substitutions: any[]): string; | |
50 | +} | |
51 | + | |
52 | +interface String { | |
53 | + /** | |
54 | + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point | |
55 | + * value of the UTF-16 encoded code point starting at the string element at position pos in | |
56 | + * the String resulting from converting this object to a String. | |
57 | + * If there is no element at that position, the result is undefined. | |
58 | + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. | |
59 | + */ | |
60 | + codePointAt(pos: number): number; | |
61 | + | |
62 | + /** | |
63 | + * Returns true if searchString appears as a substring of the result of converting this | |
64 | + * object to a String, at one or more positions that are | |
65 | + * greater than or equal to position; otherwise, returns false. | |
66 | + * @param searchString search string | |
67 | + * @param position If position is undefined, 0 is assumed, so as to search all of the String. | |
68 | + */ | |
69 | + includes(searchString: string, position?: number): boolean; | |
70 | + | |
71 | + /** | |
72 | + * Returns true if the sequence of elements of searchString converted to a String is the | |
73 | + * same as the corresponding elements of this object (converted to a String) starting at | |
74 | + * endPosition – length(this). Otherwise returns false. | |
75 | + */ | |
76 | + endsWith(searchString: string, endPosition?: number): boolean; | |
77 | + | |
78 | + /** | |
79 | + * Returns a String value that is made from count copies appended together. If count is 0, | |
80 | + * T is the empty String is returned. | |
81 | + * @param count number of copies to append | |
82 | + */ | |
83 | + repeat(count: number): string; | |
84 | + | |
85 | + /** | |
86 | + * Returns true if the sequence of elements of searchString converted to a String is the | |
87 | + * same as the corresponding elements of this object (converted to a String) starting at | |
88 | + * position. Otherwise returns false. | |
89 | + */ | |
90 | + startsWith(searchString: string, position?: number): boolean; | |
91 | + | |
92 | + /** | |
93 | + * Returns an <a> HTML anchor element and sets the name attribute to the text value | |
94 | + * @param name | |
95 | + */ | |
96 | + anchor(name: string): string; | |
97 | + | |
98 | + /** Returns a <big> HTML element */ | |
99 | + big(): string; | |
100 | + | |
101 | + /** Returns a <blink> HTML element */ | |
102 | + blink(): string; | |
103 | + | |
104 | + /** Returns a <b> HTML element */ | |
105 | + bold(): string; | |
106 | + | |
107 | + /** Returns a <tt> HTML element */ | |
108 | + fixed(): string | |
109 | + | |
110 | + /** Returns a <font> HTML element and sets the color attribute value */ | |
111 | + fontcolor(color: string): string | |
112 | + | |
113 | + /** Returns a <font> HTML element and sets the size attribute value */ | |
114 | + fontsize(size: number): string; | |
115 | + | |
116 | + /** Returns a <font> HTML element and sets the size attribute value */ | |
117 | + fontsize(size: string): string; | |
118 | + | |
119 | + /** Returns an <i> HTML element */ | |
120 | + italics(): string; | |
121 | + | |
122 | + /** Returns an <a> HTML element and sets the href attribute value */ | |
123 | + link(url: string): string; | |
124 | + | |
125 | + /** Returns a <small> HTML element */ | |
126 | + small(): string; | |
127 | + | |
128 | + /** Returns a <strike> HTML element */ | |
129 | + strike(): string; | |
130 | + | |
131 | + /** Returns a <sub> HTML element */ | |
132 | + sub(): string; | |
133 | + | |
134 | + /** Returns a <sup> HTML element */ | |
135 | + sup(): string; | |
136 | + | |
137 | + /** | |
138 | + * Shim for an ES6 iterable. Not intended for direct use by user code. | |
139 | + */ | |
140 | + "_es6-shim iterator_"(): IterableIteratorShim<string>; | |
141 | +} | |
142 | + | |
143 | +interface ArrayConstructor { | |
144 | + /** | |
145 | + * Creates an array from an array-like object. | |
146 | + * @param arrayLike An array-like object to convert to an array. | |
147 | + * @param mapfn A mapping function to call on every element of the array. | |
148 | + * @param thisArg Value of 'this' used to invoke the mapfn. | |
149 | + */ | |
150 | + from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>; | |
151 | + | |
152 | + /** | |
153 | + * Creates an array from an iterable object. | |
154 | + * @param iterable An iterable object to convert to an array. | |
155 | + * @param mapfn A mapping function to call on every element of the array. | |
156 | + * @param thisArg Value of 'this' used to invoke the mapfn. | |
157 | + */ | |
158 | + from<T, U>(iterable: IterableShim<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>; | |
159 | + | |
160 | + /** | |
161 | + * Creates an array from an array-like object. | |
162 | + * @param arrayLike An array-like object to convert to an array. | |
163 | + */ | |
164 | + from<T>(arrayLike: ArrayLike<T>): Array<T>; | |
165 | + | |
166 | + /** | |
167 | + * Creates an array from an iterable object. | |
168 | + * @param iterable An iterable object to convert to an array. | |
169 | + */ | |
170 | + from<T>(iterable: IterableShim<T>): Array<T>; | |
171 | + | |
172 | + /** | |
173 | + * Returns a new array from a set of elements. | |
174 | + * @param items A set of elements to include in the new array object. | |
175 | + */ | |
176 | + of<T>(...items: T[]): Array<T>; | |
177 | +} | |
178 | + | |
179 | +interface Array<T> { | |
180 | + /** | |
181 | + * Returns the value of the first element in the array where predicate is true, and undefined | |
182 | + * otherwise. | |
183 | + * @param predicate find calls predicate once for each element of the array, in ascending | |
184 | + * order, until it finds one where predicate returns true. If such an element is found, find | |
185 | + * immediately returns that element value. Otherwise, find returns undefined. | |
186 | + * @param thisArg If provided, it will be used as the this value for each invocation of | |
187 | + * predicate. If it is not provided, undefined is used instead. | |
188 | + */ | |
189 | + find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T; | |
190 | + | |
191 | + /** | |
192 | + * Returns the index of the first element in the array where predicate is true, and undefined | |
193 | + * otherwise. | |
194 | + * @param predicate find calls predicate once for each element of the array, in ascending | |
195 | + * order, until it finds one where predicate returns true. If such an element is found, find | |
196 | + * immediately returns that element value. Otherwise, find returns undefined. | |
197 | + * @param thisArg If provided, it will be used as the this value for each invocation of | |
198 | + * predicate. If it is not provided, undefined is used instead. | |
199 | + */ | |
200 | + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; | |
201 | + | |
202 | + /** | |
203 | + * Returns the this object after filling the section identified by start and end with value | |
204 | + * @param value value to fill array section with | |
205 | + * @param start index to start filling the array at. If start is negative, it is treated as | |
206 | + * length+start where length is the length of the array. | |
207 | + * @param end index to stop filling the array at. If end is negative, it is treated as | |
208 | + * length+end. | |
209 | + */ | |
210 | + fill(value: T, start?: number, end?: number): T[]; | |
211 | + | |
212 | + /** | |
213 | + * Returns the this object after copying a section of the array identified by start and end | |
214 | + * to the same array starting at position target | |
215 | + * @param target If target is negative, it is treated as length+target where length is the | |
216 | + * length of the array. | |
217 | + * @param start If start is negative, it is treated as length+start. If end is negative, it | |
218 | + * is treated as length+end. | |
219 | + * @param end If not specified, length of the this object is used as its default value. | |
220 | + */ | |
221 | + copyWithin(target: number, start: number, end?: number): T[]; | |
222 | + | |
223 | + /** | |
224 | + * Returns an array of key, value pairs for every entry in the array | |
225 | + */ | |
226 | + entries(): IterableIteratorShim<[number, T]>; | |
227 | + | |
228 | + /** | |
229 | + * Returns an list of keys in the array | |
230 | + */ | |
231 | + keys(): IterableIteratorShim<number>; | |
232 | + | |
233 | + /** | |
234 | + * Returns an list of values in the array | |
235 | + */ | |
236 | + values(): IterableIteratorShim<T>; | |
237 | + | |
238 | + /** | |
239 | + * Shim for an ES6 iterable. Not intended for direct use by user code. | |
240 | + */ | |
241 | + "_es6-shim iterator_"(): IterableIteratorShim<T>; | |
242 | +} | |
243 | + | |
244 | +interface NumberConstructor { | |
245 | + /** | |
246 | + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 | |
247 | + * that is representable as a Number value, which is approximately: | |
248 | + * 2.2204460492503130808472633361816 x 10−16. | |
249 | + */ | |
250 | + EPSILON: number; | |
251 | + | |
252 | + /** | |
253 | + * Returns true if passed value is finite. | |
254 | + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a | |
255 | + * number. Only finite values of the type number, result in true. | |
256 | + * @param number A numeric value. | |
257 | + */ | |
258 | + isFinite(number: number): boolean; | |
259 | + | |
260 | + /** | |
261 | + * Returns true if the value passed is an integer, false otherwise. | |
262 | + * @param number A numeric value. | |
263 | + */ | |
264 | + isInteger(number: number): boolean; | |
265 | + | |
266 | + /** | |
267 | + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a | |
268 | + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter | |
269 | + * to a number. Only values of the type number, that are also NaN, result in true. | |
270 | + * @param number A numeric value. | |
271 | + */ | |
272 | + isNaN(number: number): boolean; | |
273 | + | |
274 | + /** | |
275 | + * Returns true if the value passed is a safe integer. | |
276 | + * @param number A numeric value. | |
277 | + */ | |
278 | + isSafeInteger(number: number): boolean; | |
279 | + | |
280 | + /** | |
281 | + * The value of the largest integer n such that n and n + 1 are both exactly representable as | |
282 | + * a Number value. | |
283 | + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. | |
284 | + */ | |
285 | + MAX_SAFE_INTEGER: number; | |
286 | + | |
287 | + /** | |
288 | + * The value of the smallest integer n such that n and n − 1 are both exactly representable as | |
289 | + * a Number value. | |
290 | + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). | |
291 | + */ | |
292 | + MIN_SAFE_INTEGER: number; | |
293 | + | |
294 | + /** | |
295 | + * Converts a string to a floating-point number. | |
296 | + * @param string A string that contains a floating-point number. | |
297 | + */ | |
298 | + parseFloat(string: string): number; | |
299 | + | |
300 | + /** | |
301 | + * Converts A string to an integer. | |
302 | + * @param s A string to convert into a number. | |
303 | + * @param radix A value between 2 and 36 that specifies the base of the number in numString. | |
304 | + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. | |
305 | + * All other strings are considered decimal. | |
306 | + */ | |
307 | + parseInt(string: string, radix?: number): number; | |
308 | +} | |
309 | + | |
310 | +interface ObjectConstructor { | |
311 | + /** | |
312 | + * Copy the values of all of the enumerable own properties from one or more source objects to a | |
313 | + * target object. Returns the target object. | |
314 | + * @param target The target object to copy to. | |
315 | + * @param sources One or more source objects to copy properties from. | |
316 | + */ | |
317 | + assign(target: any, ...sources: any[]): any; | |
318 | + | |
319 | + /** | |
320 | + * Returns true if the values are the same value, false otherwise. | |
321 | + * @param value1 The first value. | |
322 | + * @param value2 The second value. | |
323 | + */ | |
324 | + is(value1: any, value2: any): boolean; | |
325 | + | |
326 | + /** | |
327 | + * Sets the prototype of a specified object o to object proto or null. Returns the object o. | |
328 | + * @param o The object to change its prototype. | |
329 | + * @param proto The value of the new prototype or null. | |
330 | + * @remarks Requires `__proto__` support. | |
331 | + */ | |
332 | + setPrototypeOf(o: any, proto: any): any; | |
333 | +} | |
334 | + | |
335 | +interface RegExp { | |
336 | + /** | |
337 | + * Returns a string indicating the flags of the regular expression in question. This field is read-only. | |
338 | + * The characters in this string are sequenced and concatenated in the following order: | |
339 | + * | |
340 | + * - "g" for global | |
341 | + * - "i" for ignoreCase | |
342 | + * - "m" for multiline | |
343 | + * - "u" for unicode | |
344 | + * - "y" for sticky | |
345 | + * | |
346 | + * If no flags are set, the value is the empty string. | |
347 | + */ | |
348 | + flags: string; | |
349 | +} | |
350 | + | |
351 | +interface Math { | |
352 | + /** | |
353 | + * Returns the number of leading zero bits in the 32-bit binary representation of a number. | |
354 | + * @param x A numeric expression. | |
355 | + */ | |
356 | + clz32(x: number): number; | |
357 | + | |
358 | + /** | |
359 | + * Returns the result of 32-bit multiplication of two numbers. | |
360 | + * @param x First number | |
361 | + * @param y Second number | |
362 | + */ | |
363 | + imul(x: number, y: number): number; | |
364 | + | |
365 | + /** | |
366 | + * Returns the sign of the x, indicating whether x is positive, negative or zero. | |
367 | + * @param x The numeric expression to test | |
368 | + */ | |
369 | + sign(x: number): number; | |
370 | + | |
371 | + /** | |
372 | + * Returns the base 10 logarithm of a number. | |
373 | + * @param x A numeric expression. | |
374 | + */ | |
375 | + log10(x: number): number; | |
376 | + | |
377 | + /** | |
378 | + * Returns the base 2 logarithm of a number. | |
379 | + * @param x A numeric expression. | |
380 | + */ | |
381 | + log2(x: number): number; | |
382 | + | |
383 | + /** | |
384 | + * Returns the natural logarithm of 1 + x. | |
385 | + * @param x A numeric expression. | |
386 | + */ | |
387 | + log1p(x: number): number; | |
388 | + | |
389 | + /** | |
390 | + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of | |
391 | + * the natural logarithms). | |
392 | + * @param x A numeric expression. | |
393 | + */ | |
394 | + expm1(x: number): number; | |
395 | + | |
396 | + /** | |
397 | + * Returns the hyperbolic cosine of a number. | |
398 | + * @param x A numeric expression that contains an angle measured in radians. | |
399 | + */ | |
400 | + cosh(x: number): number; | |
401 | + | |
402 | + /** | |
403 | + * Returns the hyperbolic sine of a number. | |
404 | + * @param x A numeric expression that contains an angle measured in radians. | |
405 | + */ | |
406 | + sinh(x: number): number; | |
407 | + | |
408 | + /** | |
409 | + * Returns the hyperbolic tangent of a number. | |
410 | + * @param x A numeric expression that contains an angle measured in radians. | |
411 | + */ | |
412 | + tanh(x: number): number; | |
413 | + | |
414 | + /** | |
415 | + * Returns the inverse hyperbolic cosine of a number. | |
416 | + * @param x A numeric expression that contains an angle measured in radians. | |
417 | + */ | |
418 | + acosh(x: number): number; | |
419 | + | |
420 | + /** | |
421 | + * Returns the inverse hyperbolic sine of a number. | |
422 | + * @param x A numeric expression that contains an angle measured in radians. | |
423 | + */ | |
424 | + asinh(x: number): number; | |
425 | + | |
426 | + /** | |
427 | + * Returns the inverse hyperbolic tangent of a number. | |
428 | + * @param x A numeric expression that contains an angle measured in radians. | |
429 | + */ | |
430 | + atanh(x: number): number; | |
431 | + | |
432 | + /** | |
433 | + * Returns the square root of the sum of squares of its arguments. | |
434 | + * @param values Values to compute the square root for. | |
435 | + * If no arguments are passed, the result is +0. | |
436 | + * If there is only one argument, the result is the absolute value. | |
437 | + * If any argument is +Infinity or -Infinity, the result is +Infinity. | |
438 | + * If any argument is NaN, the result is NaN. | |
439 | + * If all arguments are either +0 or −0, the result is +0. | |
440 | + */ | |
441 | + hypot(...values: number[]): number; | |
442 | + | |
443 | + /** | |
444 | + * Returns the integral part of the a numeric expression, x, removing any fractional digits. | |
445 | + * If x is already an integer, the result is x. | |
446 | + * @param x A numeric expression. | |
447 | + */ | |
448 | + trunc(x: number): number; | |
449 | + | |
450 | + /** | |
451 | + * Returns the nearest single precision float representation of a number. | |
452 | + * @param x A numeric expression. | |
453 | + */ | |
454 | + fround(x: number): number; | |
455 | + | |
456 | + /** | |
457 | + * Returns an implementation-dependent approximation to the cube root of number. | |
458 | + * @param x A numeric expression. | |
459 | + */ | |
460 | + cbrt(x: number): number; | |
461 | +} | |
462 | + | |
463 | +interface PromiseLike<T> { | |
464 | + /** | |
465 | + * Attaches callbacks for the resolution and/or rejection of the Promise. | |
466 | + * @param onfulfilled The callback to execute when the Promise is resolved. | |
467 | + * @param onrejected The callback to execute when the Promise is rejected. | |
468 | + * @returns A Promise for the completion of which ever callback is executed. | |
469 | + */ | |
470 | + then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; | |
471 | + then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; | |
472 | +} | |
473 | + | |
474 | +/** | |
475 | + * Represents the completion of an asynchronous operation | |
476 | + */ | |
477 | +interface Promise<T> { | |
478 | + /** | |
479 | + * Attaches callbacks for the resolution and/or rejection of the Promise. | |
480 | + * @param onfulfilled The callback to execute when the Promise is resolved. | |
481 | + * @param onrejected The callback to execute when the Promise is rejected. | |
482 | + * @returns A Promise for the completion of which ever callback is executed. | |
483 | + */ | |
484 | + then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; | |
485 | + then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; | |
486 | + | |
487 | + /** | |
488 | + * Attaches a callback for only the rejection of the Promise. | |
489 | + * @param onrejected The callback to execute when the Promise is rejected. | |
490 | + * @returns A Promise for the completion of the callback. | |
491 | + */ | |
492 | + catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>; | |
493 | + catch(onrejected?: (reason: any) => void): Promise<T>; | |
494 | +} | |
495 | + | |
496 | +interface PromiseConstructor { | |
497 | + /** | |
498 | + * A reference to the prototype. | |
499 | + */ | |
500 | + prototype: Promise<any>; | |
501 | + | |
502 | + /** | |
503 | + * Creates a new Promise. | |
504 | + * @param executor A callback used to initialize the promise. This callback is passed two arguments: | |
505 | + * a resolve callback used resolve the promise with a value or the result of another promise, | |
506 | + * and a reject callback used to reject the promise with a provided reason or error. | |
507 | + */ | |
508 | + new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>; | |
509 | + | |
510 | + /** | |
511 | + * Creates a Promise that is resolved with an array of results when all of the provided Promises | |
512 | + * resolve, or rejected when any Promise is rejected. | |
513 | + * @param values An array of Promises. | |
514 | + * @returns A new Promise. | |
515 | + */ | |
516 | + all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>; | |
517 | + | |
518 | + /** | |
519 | + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved | |
520 | + * or rejected. | |
521 | + * @param values An array of Promises. | |
522 | + * @returns A new Promise. | |
523 | + */ | |
524 | + race<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T>; | |
525 | + | |
526 | + /** | |
527 | + * Creates a new rejected promise for the provided reason. | |
528 | + * @param reason The reason the promise was rejected. | |
529 | + * @returns A new rejected Promise. | |
530 | + */ | |
531 | + reject(reason: any): Promise<void>; | |
532 | + | |
533 | + /** | |
534 | + * Creates a new rejected promise for the provided reason. | |
535 | + * @param reason The reason the promise was rejected. | |
536 | + * @returns A new rejected Promise. | |
537 | + */ | |
538 | + reject<T>(reason: any): Promise<T>; | |
539 | + | |
540 | + /** | |
541 | + * Creates a new resolved promise for the provided value. | |
542 | + * @param value A promise. | |
543 | + * @returns A promise whose internal state matches the provided promise. | |
544 | + */ | |
545 | + resolve<T>(value: T | PromiseLike<T>): Promise<T>; | |
546 | + | |
547 | + /** | |
548 | + * Creates a new resolved promise . | |
549 | + * @returns A resolved promise. | |
550 | + */ | |
551 | + resolve(): Promise<void>; | |
552 | +} | |
553 | + | |
554 | +declare var Promise: PromiseConstructor; | |
555 | + | |
556 | +interface Map<K, V> { | |
557 | + clear(): void; | |
558 | + delete(key: K): boolean; | |
559 | + forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void; | |
560 | + get(key: K): V; | |
561 | + has(key: K): boolean; | |
562 | + set(key: K, value?: V): Map<K, V>; | |
563 | + size: number; | |
564 | + entries(): IterableIteratorShim<[K, V]>; | |
565 | + keys(): IterableIteratorShim<K>; | |
566 | + values(): IterableIteratorShim<V>; | |
567 | +} | |
568 | + | |
569 | +interface MapConstructor { | |
570 | + new <K, V>(): Map<K, V>; | |
571 | + new <K, V>(iterable: IterableShim<[K, V]>): Map<K, V>; | |
572 | + prototype: Map<any, any>; | |
573 | +} | |
574 | + | |
575 | +declare var Map: MapConstructor; | |
576 | + | |
577 | +interface Set<T> { | |
578 | + add(value: T): Set<T>; | |
579 | + clear(): void; | |
580 | + delete(value: T): boolean; | |
581 | + forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void; | |
582 | + has(value: T): boolean; | |
583 | + size: number; | |
584 | + entries(): IterableIteratorShim<[T, T]>; | |
585 | + keys(): IterableIteratorShim<T>; | |
586 | + values(): IterableIteratorShim<T>; | |
587 | +} | |
588 | + | |
589 | +interface SetConstructor { | |
590 | + new <T>(): Set<T>; | |
591 | + new <T>(iterable: IterableShim<T>): Set<T>; | |
592 | + prototype: Set<any>; | |
593 | +} | |
594 | + | |
595 | +declare var Set: SetConstructor; | |
596 | + | |
597 | +interface WeakMap<K, V> { | |
598 | + delete(key: K): boolean; | |
599 | + get(key: K): V; | |
600 | + has(key: K): boolean; | |
601 | + set(key: K, value?: V): WeakMap<K, V>; | |
602 | +} | |
603 | + | |
604 | +interface WeakMapConstructor { | |
605 | + new <K, V>(): WeakMap<K, V>; | |
606 | + new <K, V>(iterable: IterableShim<[K, V]>): WeakMap<K, V>; | |
607 | + prototype: WeakMap<any, any>; | |
608 | +} | |
609 | + | |
610 | +declare var WeakMap: WeakMapConstructor; | |
611 | + | |
612 | +interface WeakSet<T> { | |
613 | + add(value: T): WeakSet<T>; | |
614 | + delete(value: T): boolean; | |
615 | + has(value: T): boolean; | |
616 | +} | |
617 | + | |
618 | +interface WeakSetConstructor { | |
619 | + new <T>(): WeakSet<T>; | |
620 | + new <T>(iterable: IterableShim<T>): WeakSet<T>; | |
621 | + prototype: WeakSet<any>; | |
622 | +} | |
623 | + | |
624 | +declare var WeakSet: WeakSetConstructor; | |
625 | + | |
626 | +declare module Reflect { | |
627 | + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any; | |
628 | + function construct(target: Function, argumentsList: ArrayLike<any>): any; | |
629 | + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; | |
630 | + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; | |
631 | + function enumerate(target: any): IterableIteratorShim<any>; | |
632 | + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; | |
633 | + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; | |
634 | + function getPrototypeOf(target: any): any; | |
635 | + function has(target: any, propertyKey: PropertyKey): boolean; | |
636 | + function isExtensible(target: any): boolean; | |
637 | + function ownKeys(target: any): Array<PropertyKey>; | |
638 | + function preventExtensions(target: any): boolean; | |
639 | + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; | |
640 | + function setPrototypeOf(target: any, proto: any): boolean; | |
641 | +} | |
642 | + | |
643 | +declare module "es6-shim" { | |
644 | + var String: StringConstructor; | |
645 | + var Array: ArrayConstructor; | |
646 | + var Number: NumberConstructor; | |
647 | + var Math: Math; | |
648 | + var Object: ObjectConstructor; | |
649 | + var Map: MapConstructor; | |
650 | + var Set: SetConstructor; | |
651 | + var WeakMap: WeakMapConstructor; | |
652 | + var WeakSet: WeakSetConstructor; | |
653 | + var Promise: PromiseConstructor; | |
654 | + module Reflect { | |
655 | + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any; | |
656 | + function construct(target: Function, argumentsList: ArrayLike<any>): any; | |
657 | + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; | |
658 | + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; | |
659 | + function enumerate(target: any): Iterator<any>; | |
660 | + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; | |
661 | + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; | |
662 | + function getPrototypeOf(target: any): any; | |
663 | + function has(target: any, propertyKey: PropertyKey): boolean; | |
664 | + function isExtensible(target: any): boolean; | |
665 | + function ownKeys(target: any): Array<PropertyKey>; | |
666 | + function preventExtensions(target: any): boolean; | |
667 | + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; | |
668 | + function setPrototypeOf(target: any, proto: any): boolean; | |
669 | + } | |
670 | +} | |
0 | 671 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,3212 @@ |
1 | +// Compiled using typings@0.6.8 | |
2 | +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/470954c4f427e0805a2d633636a7c6aa7170def8/jquery/jquery.d.ts | |
3 | +// Type definitions for jQuery 1.10.x / 2.0.x | |
4 | +// Project: http://jquery.com/ | |
5 | +// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Christian Hoffmeister <https://github.com/choffmeister>, Steve Fenton <https://github.com/Steve-Fenton>, Diullei Gomes <https://github.com/Diullei>, Tass Iliopoulos <https://github.com/tasoili>, Jason Swearingen <https://github.com/jasons-novaleaf>, 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/>, Dick van den Brink <https://github.com/DickvdBrink> | |
6 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped | |
7 | + | |
8 | +/* ***************************************************************************** | |
9 | +Copyright (c) Microsoft Corporation. All rights reserved. | |
10 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use | |
11 | +this file except in compliance with the License. You may obtain a copy of the | |
12 | +License at http://www.apache.org/licenses/LICENSE-2.0 | |
13 | + | |
14 | +THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | |
16 | +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | |
17 | +MERCHANTABLITY OR NON-INFRINGEMENT. | |
18 | + | |
19 | +See the Apache Version 2.0 License for specific language governing permissions | |
20 | +and limitations under the License. | |
21 | +***************************************************************************** */ | |
22 | + | |
23 | + | |
24 | +/** | |
25 | + * Interface for the AJAX setting that will configure the AJAX request | |
26 | + */ | |
27 | +interface JQueryAjaxSettings { | |
28 | + /** | |
29 | + * 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. | |
30 | + */ | |
31 | + accepts?: any; | |
32 | + /** | |
33 | + * 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(). | |
34 | + */ | |
35 | + async?: boolean; | |
36 | + /** | |
37 | + * 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. | |
38 | + */ | |
39 | + beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; | |
40 | + /** | |
41 | + * 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. | |
42 | + */ | |
43 | + cache?: boolean; | |
44 | + /** | |
45 | + * 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. | |
46 | + */ | |
47 | + complete? (jqXHR: JQueryXHR, textStatus: string): any; | |
48 | + /** | |
49 | + * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) | |
50 | + */ | |
51 | + contents?: { [key: string]: any; }; | |
52 | + //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" | |
53 | + // https://github.com/borisyankov/DefinitelyTyped/issues/742 | |
54 | + /** | |
55 | + * 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. | |
56 | + */ | |
57 | + contentType?: any; | |
58 | + /** | |
59 | + * 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). | |
60 | + */ | |
61 | + context?: any; | |
62 | + /** | |
63 | + * 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) | |
64 | + */ | |
65 | + converters?: { [key: string]: any; }; | |
66 | + /** | |
67 | + * 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) | |
68 | + */ | |
69 | + crossDomain?: boolean; | |
70 | + /** | |
71 | + * 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). | |
72 | + */ | |
73 | + data?: any; | |
74 | + /** | |
75 | + * 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. | |
76 | + */ | |
77 | + dataFilter? (data: any, ty: any): any; | |
78 | + /** | |
79 | + * 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). | |
80 | + */ | |
81 | + dataType?: string; | |
82 | + /** | |
83 | + * 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. | |
84 | + */ | |
85 | + error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; | |
86 | + /** | |
87 | + * 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. | |
88 | + */ | |
89 | + global?: boolean; | |
90 | + /** | |
91 | + * 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) | |
92 | + */ | |
93 | + headers?: { [key: string]: any; }; | |
94 | + /** | |
95 | + * 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. | |
96 | + */ | |
97 | + ifModified?: boolean; | |
98 | + /** | |
99 | + * 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) | |
100 | + */ | |
101 | + isLocal?: boolean; | |
102 | + /** | |
103 | + * 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" } | |
104 | + */ | |
105 | + jsonp?: any; | |
106 | + /** | |
107 | + * 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. | |
108 | + */ | |
109 | + jsonpCallback?: any; | |
110 | + /** | |
111 | + * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0) | |
112 | + */ | |
113 | + method?: string; | |
114 | + /** | |
115 | + * A mime type to override the XHR mime type. (version added: 1.5.1) | |
116 | + */ | |
117 | + mimeType?: string; | |
118 | + /** | |
119 | + * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. | |
120 | + */ | |
121 | + password?: string; | |
122 | + /** | |
123 | + * 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. | |
124 | + */ | |
125 | + processData?: boolean; | |
126 | + /** | |
127 | + * 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. | |
128 | + */ | |
129 | + scriptCharset?: string; | |
130 | + /** | |
131 | + * 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) | |
132 | + */ | |
133 | + statusCode?: { [key: string]: any; }; | |
134 | + /** | |
135 | + * 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. | |
136 | + */ | |
137 | + success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; | |
138 | + /** | |
139 | + * 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. | |
140 | + */ | |
141 | + timeout?: number; | |
142 | + /** | |
143 | + * Set this to true if you wish to use the traditional style of param serialization. | |
144 | + */ | |
145 | + traditional?: boolean; | |
146 | + /** | |
147 | + * 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. | |
148 | + */ | |
149 | + type?: string; | |
150 | + /** | |
151 | + * A string containing the URL to which the request is sent. | |
152 | + */ | |
153 | + url?: string; | |
154 | + /** | |
155 | + * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. | |
156 | + */ | |
157 | + username?: string; | |
158 | + /** | |
159 | + * 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. | |
160 | + */ | |
161 | + xhr?: any; | |
162 | + /** | |
163 | + * 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) | |
164 | + */ | |
165 | + xhrFields?: { [key: string]: any; }; | |
166 | +} | |
167 | + | |
168 | +/** | |
169 | + * Interface for the jqXHR object | |
170 | + */ | |
171 | +interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> { | |
172 | + /** | |
173 | + * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). | |
174 | + */ | |
175 | + overrideMimeType(mimeType: string): any; | |
176 | + /** | |
177 | + * Cancel the request. | |
178 | + * | |
179 | + * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" | |
180 | + */ | |
181 | + abort(statusText?: string): void; | |
182 | + /** | |
183 | + * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. | |
184 | + */ | |
185 | + then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => void, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise<any>; | |
186 | + /** | |
187 | + * Property containing the parsed response if the response Content-Type is json | |
188 | + */ | |
189 | + responseJSON?: any; | |
190 | + /** | |
191 | + * A function to be called if the request fails. | |
192 | + */ | |
193 | + error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void; | |
194 | +} | |
195 | + | |
196 | +/** | |
197 | + * Interface for the JQuery callback | |
198 | + */ | |
199 | +interface JQueryCallback { | |
200 | + /** | |
201 | + * Add a callback or a collection of callbacks to a callback list. | |
202 | + * | |
203 | + * @param callbacks A function, or array of functions, that are to be added to the callback list. | |
204 | + */ | |
205 | + add(callbacks: Function): JQueryCallback; | |
206 | + /** | |
207 | + * Add a callback or a collection of callbacks to a callback list. | |
208 | + * | |
209 | + * @param callbacks A function, or array of functions, that are to be added to the callback list. | |
210 | + */ | |
211 | + add(callbacks: Function[]): JQueryCallback; | |
212 | + | |
213 | + /** | |
214 | + * Disable a callback list from doing anything more. | |
215 | + */ | |
216 | + disable(): JQueryCallback; | |
217 | + | |
218 | + /** | |
219 | + * Determine if the callbacks list has been disabled. | |
220 | + */ | |
221 | + disabled(): boolean; | |
222 | + | |
223 | + /** | |
224 | + * Remove all of the callbacks from a list. | |
225 | + */ | |
226 | + empty(): JQueryCallback; | |
227 | + | |
228 | + /** | |
229 | + * Call all of the callbacks with the given arguments | |
230 | + * | |
231 | + * @param arguments The argument or list of arguments to pass back to the callback list. | |
232 | + */ | |
233 | + fire(...arguments: any[]): JQueryCallback; | |
234 | + | |
235 | + /** | |
236 | + * Determine if the callbacks have already been called at least once. | |
237 | + */ | |
238 | + fired(): boolean; | |
239 | + | |
240 | + /** | |
241 | + * Call all callbacks in a list with the given context and arguments. | |
242 | + * | |
243 | + * @param context A reference to the context in which the callbacks in the list should be fired. | |
244 | + * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. | |
245 | + */ | |
246 | + fireWith(context?: any, args?: any[]): JQueryCallback; | |
247 | + | |
248 | + /** | |
249 | + * Determine whether a supplied callback is in a list | |
250 | + * | |
251 | + * @param callback The callback to search for. | |
252 | + */ | |
253 | + has(callback: Function): boolean; | |
254 | + | |
255 | + /** | |
256 | + * Lock a callback list in its current state. | |
257 | + */ | |
258 | + lock(): JQueryCallback; | |
259 | + | |
260 | + /** | |
261 | + * Determine if the callbacks list has been locked. | |
262 | + */ | |
263 | + locked(): boolean; | |
264 | + | |
265 | + /** | |
266 | + * Remove a callback or a collection of callbacks from a callback list. | |
267 | + * | |
268 | + * @param callbacks A function, or array of functions, that are to be removed from the callback list. | |
269 | + */ | |
270 | + remove(callbacks: Function): JQueryCallback; | |
271 | + /** | |
272 | + * Remove a callback or a collection of callbacks from a callback list. | |
273 | + * | |
274 | + * @param callbacks A function, or array of functions, that are to be removed from the callback list. | |
275 | + */ | |
276 | + remove(callbacks: Function[]): JQueryCallback; | |
277 | +} | |
278 | + | |
279 | +/** | |
280 | + * Allows jQuery Promises to interop with non-jQuery promises | |
281 | + */ | |
282 | +interface JQueryGenericPromise<T> { | |
283 | + /** | |
284 | + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. | |
285 | + * | |
286 | + * @param doneFilter A function that is called when the Deferred is resolved. | |
287 | + * @param failFilter An optional function that is called when the Deferred is rejected. | |
288 | + */ | |
289 | + then<U>(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise<U>, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise<U>; | |
290 | + | |
291 | + /** | |
292 | + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. | |
293 | + * | |
294 | + * @param doneFilter A function that is called when the Deferred is resolved. | |
295 | + * @param failFilter An optional function that is called when the Deferred is rejected. | |
296 | + */ | |
297 | + then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise<void>; | |
298 | +} | |
299 | + | |
300 | +/** | |
301 | + * Interface for the JQuery promise/deferred callbacks | |
302 | + */ | |
303 | +interface JQueryPromiseCallback<T> { | |
304 | + (value?: T, ...args: any[]): void; | |
305 | +} | |
306 | + | |
307 | +interface JQueryPromiseOperator<T, U> { | |
308 | + (callback1: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...callbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<U>; | |
309 | +} | |
310 | + | |
311 | +/** | |
312 | + * Interface for the JQuery promise, part of callbacks | |
313 | + */ | |
314 | +interface JQueryPromise<T> extends JQueryGenericPromise<T> { | |
315 | + /** | |
316 | + * Determine the current state of a Deferred object. | |
317 | + */ | |
318 | + state(): string; | |
319 | + /** | |
320 | + * Add handlers to be called when the Deferred object is either resolved or rejected. | |
321 | + * | |
322 | + * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. | |
323 | + * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. | |
324 | + */ | |
325 | + always(alwaysCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...alwaysCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>; | |
326 | + /** | |
327 | + * Add handlers to be called when the Deferred object is resolved. | |
328 | + * | |
329 | + * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. | |
330 | + * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. | |
331 | + */ | |
332 | + done(doneCallback1?: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...doneCallbackN: Array<JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[]>): JQueryPromise<T>; | |
333 | + /** | |
334 | + * Add handlers to be called when the Deferred object is rejected. | |
335 | + * | |
336 | + * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. | |
337 | + * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. | |
338 | + */ | |
339 | + fail(failCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>; | |
340 | + /** | |
341 | + * Add handlers to be called when the Deferred object generates progress notifications. | |
342 | + * | |
343 | + * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. | |
344 | + */ | |
345 | + progress(progressCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...progressCallbackN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>; | |
346 | + | |
347 | + // Deprecated - given no typings | |
348 | + pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>; | |
349 | +} | |
350 | + | |
351 | +/** | |
352 | + * Interface for the JQuery deferred, part of callbacks | |
353 | + */ | |
354 | +interface JQueryDeferred<T> extends JQueryGenericPromise<T> { | |
355 | + /** | |
356 | + * Determine the current state of a Deferred object. | |
357 | + */ | |
358 | + state(): string; | |
359 | + /** | |
360 | + * Add handlers to be called when the Deferred object is either resolved or rejected. | |
361 | + * | |
362 | + * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. | |
363 | + * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. | |
364 | + */ | |
365 | + always(alwaysCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...alwaysCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>; | |
366 | + /** | |
367 | + * Add handlers to be called when the Deferred object is resolved. | |
368 | + * | |
369 | + * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. | |
370 | + * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. | |
371 | + */ | |
372 | + done(doneCallback1?: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...doneCallbackN: Array<JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[]>): JQueryDeferred<T>; | |
373 | + /** | |
374 | + * Add handlers to be called when the Deferred object is rejected. | |
375 | + * | |
376 | + * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. | |
377 | + * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. | |
378 | + */ | |
379 | + fail(failCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>; | |
380 | + /** | |
381 | + * Add handlers to be called when the Deferred object generates progress notifications. | |
382 | + * | |
383 | + * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. | |
384 | + */ | |
385 | + progress(progressCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...progressCallbackN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>; | |
386 | + | |
387 | + /** | |
388 | + * Call the progressCallbacks on a Deferred object with the given args. | |
389 | + * | |
390 | + * @param args Optional arguments that are passed to the progressCallbacks. | |
391 | + */ | |
392 | + notify(value?: any, ...args: any[]): JQueryDeferred<T>; | |
393 | + | |
394 | + /** | |
395 | + * Call the progressCallbacks on a Deferred object with the given context and args. | |
396 | + * | |
397 | + * @param context Context passed to the progressCallbacks as the this object. | |
398 | + * @param args Optional arguments that are passed to the progressCallbacks. | |
399 | + */ | |
400 | + notifyWith(context: any, value?: any[]): JQueryDeferred<T>; | |
401 | + | |
402 | + /** | |
403 | + * Reject a Deferred object and call any failCallbacks with the given args. | |
404 | + * | |
405 | + * @param args Optional arguments that are passed to the failCallbacks. | |
406 | + */ | |
407 | + reject(value?: any, ...args: any[]): JQueryDeferred<T>; | |
408 | + /** | |
409 | + * Reject a Deferred object and call any failCallbacks with the given context and args. | |
410 | + * | |
411 | + * @param context Context passed to the failCallbacks as the this object. | |
412 | + * @param args An optional array of arguments that are passed to the failCallbacks. | |
413 | + */ | |
414 | + rejectWith(context: any, value?: any[]): JQueryDeferred<T>; | |
415 | + | |
416 | + /** | |
417 | + * Resolve a Deferred object and call any doneCallbacks with the given args. | |
418 | + * | |
419 | + * @param value First argument passed to doneCallbacks. | |
420 | + * @param args Optional subsequent arguments that are passed to the doneCallbacks. | |
421 | + */ | |
422 | + resolve(value?: T, ...args: any[]): JQueryDeferred<T>; | |
423 | + | |
424 | + /** | |
425 | + * Resolve a Deferred object and call any doneCallbacks with the given context and args. | |
426 | + * | |
427 | + * @param context Context passed to the doneCallbacks as the this object. | |
428 | + * @param args An optional array of arguments that are passed to the doneCallbacks. | |
429 | + */ | |
430 | + resolveWith(context: any, value?: T[]): JQueryDeferred<T>; | |
431 | + | |
432 | + /** | |
433 | + * Return a Deferred's Promise object. | |
434 | + * | |
435 | + * @param target Object onto which the promise methods have to be attached | |
436 | + */ | |
437 | + promise(target?: any): JQueryPromise<T>; | |
438 | + | |
439 | + // Deprecated - given no typings | |
440 | + pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>; | |
441 | +} | |
442 | + | |
443 | +/** | |
444 | + * Interface of the JQuery extension of the W3C event object | |
445 | + */ | |
446 | +interface BaseJQueryEventObject extends Event { | |
447 | + data: any; | |
448 | + delegateTarget: Element; | |
449 | + isDefaultPrevented(): boolean; | |
450 | + isImmediatePropagationStopped(): boolean; | |
451 | + isPropagationStopped(): boolean; | |
452 | + namespace: string; | |
453 | + originalEvent: Event; | |
454 | + preventDefault(): any; | |
455 | + relatedTarget: Element; | |
456 | + result: any; | |
457 | + stopImmediatePropagation(): void; | |
458 | + stopPropagation(): void; | |
459 | + target: Element; | |
460 | + pageX: number; | |
461 | + pageY: number; | |
462 | + which: number; | |
463 | + metaKey: boolean; | |
464 | +} | |
465 | + | |
466 | +interface JQueryInputEventObject extends BaseJQueryEventObject { | |
467 | + altKey: boolean; | |
468 | + ctrlKey: boolean; | |
469 | + metaKey: boolean; | |
470 | + shiftKey: boolean; | |
471 | +} | |
472 | + | |
473 | +interface JQueryMouseEventObject extends JQueryInputEventObject { | |
474 | + button: number; | |
475 | + clientX: number; | |
476 | + clientY: number; | |
477 | + offsetX: number; | |
478 | + offsetY: number; | |
479 | + pageX: number; | |
480 | + pageY: number; | |
481 | + screenX: number; | |
482 | + screenY: number; | |
483 | +} | |
484 | + | |
485 | +interface JQueryKeyEventObject extends JQueryInputEventObject { | |
486 | + char: any; | |
487 | + charCode: number; | |
488 | + key: any; | |
489 | + keyCode: number; | |
490 | +} | |
491 | + | |
492 | +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ | |
493 | +} | |
494 | + | |
495 | +/* | |
496 | + Collection of properties of the current browser | |
497 | +*/ | |
498 | + | |
499 | +interface JQuerySupport { | |
500 | + ajax?: boolean; | |
501 | + boxModel?: boolean; | |
502 | + changeBubbles?: boolean; | |
503 | + checkClone?: boolean; | |
504 | + checkOn?: boolean; | |
505 | + cors?: boolean; | |
506 | + cssFloat?: boolean; | |
507 | + hrefNormalized?: boolean; | |
508 | + htmlSerialize?: boolean; | |
509 | + leadingWhitespace?: boolean; | |
510 | + noCloneChecked?: boolean; | |
511 | + noCloneEvent?: boolean; | |
512 | + opacity?: boolean; | |
513 | + optDisabled?: boolean; | |
514 | + optSelected?: boolean; | |
515 | + scriptEval? (): boolean; | |
516 | + style?: boolean; | |
517 | + submitBubbles?: boolean; | |
518 | + tbody?: boolean; | |
519 | +} | |
520 | + | |
521 | +interface JQueryParam { | |
522 | + /** | |
523 | + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. | |
524 | + * | |
525 | + * @param obj An array or object to serialize. | |
526 | + */ | |
527 | + (obj: any): string; | |
528 | + | |
529 | + /** | |
530 | + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. | |
531 | + * | |
532 | + * @param obj An array or object to serialize. | |
533 | + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. | |
534 | + */ | |
535 | + (obj: any, traditional: boolean): string; | |
536 | +} | |
537 | + | |
538 | +/** | |
539 | + * The interface used to construct jQuery events (with $.Event). It is | |
540 | + * defined separately instead of inline in JQueryStatic to allow | |
541 | + * overriding the construction function with specific strings | |
542 | + * returning specific event objects. | |
543 | + */ | |
544 | +interface JQueryEventConstructor { | |
545 | + (name: string, eventProperties?: any): JQueryEventObject; | |
546 | + new (name: string, eventProperties?: any): JQueryEventObject; | |
547 | +} | |
548 | + | |
549 | +/** | |
550 | + * The interface used to specify coordinates. | |
551 | + */ | |
552 | +interface JQueryCoordinates { | |
553 | + left: number; | |
554 | + top: number; | |
555 | +} | |
556 | + | |
557 | +/** | |
558 | + * Elements in the array returned by serializeArray() | |
559 | + */ | |
560 | +interface JQuerySerializeArrayElement { | |
561 | + name: string; | |
562 | + value: string; | |
563 | +} | |
564 | + | |
565 | +interface JQueryAnimationOptions { | |
566 | + /** | |
567 | + * A string or number determining how long the animation will run. | |
568 | + */ | |
569 | + duration?: any; | |
570 | + /** | |
571 | + * A string indicating which easing function to use for the transition. | |
572 | + */ | |
573 | + easing?: string; | |
574 | + /** | |
575 | + * A function to call once the animation is complete. | |
576 | + */ | |
577 | + complete?: Function; | |
578 | + /** | |
579 | + * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. | |
580 | + */ | |
581 | + step?: (now: number, tween: any) => any; | |
582 | + /** | |
583 | + * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) | |
584 | + */ | |
585 | + progress?: (animation: JQueryPromise<any>, progress: number, remainingMs: number) => any; | |
586 | + /** | |
587 | + * A function to call when the animation begins. (version added: 1.8) | |
588 | + */ | |
589 | + start?: (animation: JQueryPromise<any>) => any; | |
590 | + /** | |
591 | + * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) | |
592 | + */ | |
593 | + done?: (animation: JQueryPromise<any>, jumpedToEnd: boolean) => any; | |
594 | + /** | |
595 | + * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) | |
596 | + */ | |
597 | + fail?: (animation: JQueryPromise<any>, jumpedToEnd: boolean) => any; | |
598 | + /** | |
599 | + * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) | |
600 | + */ | |
601 | + always?: (animation: JQueryPromise<any>, jumpedToEnd: boolean) => any; | |
602 | + /** | |
603 | + * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. | |
604 | + */ | |
605 | + queue?: any; | |
606 | + /** | |
607 | + * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) | |
608 | + */ | |
609 | + specialEasing?: Object; | |
610 | +} | |
611 | + | |
612 | +interface JQueryEasingFunction { | |
613 | + ( percent: number ): number; | |
614 | +} | |
615 | + | |
616 | +interface JQueryEasingFunctions { | |
617 | + [ name: string ]: JQueryEasingFunction; | |
618 | + linear: JQueryEasingFunction; | |
619 | + swing: JQueryEasingFunction; | |
620 | +} | |
621 | + | |
622 | +/** | |
623 | + * Static members of jQuery (those on $ and jQuery themselves) | |
624 | + */ | |
625 | +interface JQueryStatic { | |
626 | + | |
627 | + /** | |
628 | + * Perform an asynchronous HTTP (Ajax) request. | |
629 | + * | |
630 | + * @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(). | |
631 | + */ | |
632 | + ajax(settings: JQueryAjaxSettings): JQueryXHR; | |
633 | + /** | |
634 | + * Perform an asynchronous HTTP (Ajax) request. | |
635 | + * | |
636 | + * @param url A string containing the URL to which the request is sent. | |
637 | + * @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(). | |
638 | + */ | |
639 | + ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; | |
640 | + | |
641 | + /** | |
642 | + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). | |
643 | + * | |
644 | + * @param dataTypes An optional string containing one or more space-separated dataTypes | |
645 | + * @param handler A handler to set default values for future Ajax requests. | |
646 | + */ | |
647 | + ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; | |
648 | + /** | |
649 | + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). | |
650 | + * | |
651 | + * @param handler A handler to set default values for future Ajax requests. | |
652 | + */ | |
653 | + ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; | |
654 | + | |
655 | + ajaxSettings: JQueryAjaxSettings; | |
656 | + | |
657 | + /** | |
658 | + * Set default values for future Ajax requests. Its use is not recommended. | |
659 | + * | |
660 | + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. | |
661 | + */ | |
662 | + ajaxSetup(options: JQueryAjaxSettings): void; | |
663 | + | |
664 | + /** | |
665 | + * Load data from the server using a HTTP GET request. | |
666 | + * | |
667 | + * @param url A string containing the URL to which the request is sent. | |
668 | + * @param success A callback function that is executed if the request succeeds. | |
669 | + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). | |
670 | + */ | |
671 | + get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; | |
672 | + /** | |
673 | + * Load data from the server using a HTTP GET request. | |
674 | + * | |
675 | + * @param url A string containing the URL to which the request is sent. | |
676 | + * @param data A plain object or string that is sent to the server with the request. | |
677 | + * @param success A callback function that is executed if the request succeeds. | |
678 | + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). | |
679 | + */ | |
680 | + get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; | |
681 | + /** | |
682 | + * Load JSON-encoded data from the server using a GET HTTP request. | |
683 | + * | |
684 | + * @param url A string containing the URL to which the request is sent. | |
685 | + * @param success A callback function that is executed if the request succeeds. | |
686 | + */ | |
687 | + getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; | |
688 | + /** | |
689 | + * Load JSON-encoded data from the server using a GET HTTP request. | |
690 | + * | |
691 | + * @param url A string containing the URL to which the request is sent. | |
692 | + * @param data A plain object or string that is sent to the server with the request. | |
693 | + * @param success A callback function that is executed if the request succeeds. | |
694 | + */ | |
695 | + getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; | |
696 | + /** | |
697 | + * Load a JavaScript file from the server using a GET HTTP request, then execute it. | |
698 | + * | |
699 | + * @param url A string containing the URL to which the request is sent. | |
700 | + * @param success A callback function that is executed if the request succeeds. | |
701 | + */ | |
702 | + getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; | |
703 | + | |
704 | + /** | |
705 | + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. | |
706 | + */ | |
707 | + param: JQueryParam; | |
708 | + | |
709 | + /** | |
710 | + * Load data from the server using a HTTP POST request. | |
711 | + * | |
712 | + * @param url A string containing the URL to which the request is sent. | |
713 | + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. | |
714 | + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). | |
715 | + */ | |
716 | + post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; | |
717 | + /** | |
718 | + * Load data from the server using a HTTP POST request. | |
719 | + * | |
720 | + * @param url A string containing the URL to which the request is sent. | |
721 | + * @param data A plain object or string that is sent to the server with the request. | |
722 | + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. | |
723 | + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). | |
724 | + */ | |
725 | + post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; | |
726 | + | |
727 | + /** | |
728 | + * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. | |
729 | + * | |
730 | + * @param flags An optional list of space-separated flags that change how the callback list behaves. | |
731 | + */ | |
732 | + Callbacks(flags?: string): JQueryCallback; | |
733 | + | |
734 | + /** | |
735 | + * Holds or releases the execution of jQuery's ready event. | |
736 | + * | |
737 | + * @param hold Indicates whether the ready hold is being requested or released | |
738 | + */ | |
739 | + holdReady(hold: boolean): void; | |
740 | + | |
741 | + /** | |
742 | + * Accepts a string containing a CSS selector which is then used to match a set of elements. | |
743 | + * | |
744 | + * @param selector A string containing a selector expression | |
745 | + * @param context A DOM Element, Document, or jQuery to use as context | |
746 | + */ | |
747 | + (selector: string, context?: Element|JQuery): JQuery; | |
748 | + | |
749 | + /** | |
750 | + * Accepts a string containing a CSS selector which is then used to match a set of elements. | |
751 | + * | |
752 | + * @param element A DOM element to wrap in a jQuery object. | |
753 | + */ | |
754 | + (element: Element): JQuery; | |
755 | + | |
756 | + /** | |
757 | + * Accepts a string containing a CSS selector which is then used to match a set of elements. | |
758 | + * | |
759 | + * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. | |
760 | + */ | |
761 | + (elementArray: Element[]): JQuery; | |
762 | + | |
763 | + /** | |
764 | + * Binds a function to be executed when the DOM has finished loading. | |
765 | + * | |
766 | + * @param callback A function to execute after the DOM is ready. | |
767 | + */ | |
768 | + (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; | |
769 | + | |
770 | + /** | |
771 | + * Accepts a string containing a CSS selector which is then used to match a set of elements. | |
772 | + * | |
773 | + * @param object A plain object to wrap in a jQuery object. | |
774 | + */ | |
775 | + (object: {}): JQuery; | |
776 | + | |
777 | + /** | |
778 | + * Accepts a string containing a CSS selector which is then used to match a set of elements. | |
779 | + * | |
780 | + * @param object An existing jQuery object to clone. | |
781 | + */ | |
782 | + (object: JQuery): JQuery; | |
783 | + | |
784 | + /** | |
785 | + * Specify a function to execute when the DOM is fully loaded. | |
786 | + */ | |
787 | + (): JQuery; | |
788 | + | |
789 | + /** | |
790 | + * Creates DOM elements on the fly from the provided string of raw HTML. | |
791 | + * | |
792 | + * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. | |
793 | + * @param ownerDocument A document in which the new elements will be created. | |
794 | + */ | |
795 | + (html: string, ownerDocument?: Document): JQuery; | |
796 | + | |
797 | + /** | |
798 | + * Creates DOM elements on the fly from the provided string of raw HTML. | |
799 | + * | |
800 | + * @param html A string defining a single, standalone, HTML element (e.g. <div/> or <div></div>). | |
801 | + * @param attributes An object of attributes, events, and methods to call on the newly-created element. | |
802 | + */ | |
803 | + (html: string, attributes: Object): JQuery; | |
804 | + | |
805 | + /** | |
806 | + * Relinquish jQuery's control of the $ variable. | |
807 | + * | |
808 | + * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). | |
809 | + */ | |
810 | + noConflict(removeAll?: boolean): JQueryStatic; | |
811 | + | |
812 | + /** | |
813 | + * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. | |
814 | + * | |
815 | + * @param deferreds One or more Deferred objects, or plain JavaScript objects. | |
816 | + */ | |
817 | + when<T>(...deferreds: Array<T|JQueryPromise<T>/* as JQueryDeferred<T> */>): JQueryPromise<T>; | |
818 | + | |
819 | + /** | |
820 | + * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. | |
821 | + */ | |
822 | + cssHooks: { [key: string]: any; }; | |
823 | + cssNumber: any; | |
824 | + | |
825 | + /** | |
826 | + * Store arbitrary data associated with the specified element. Returns the value that was set. | |
827 | + * | |
828 | + * @param element The DOM element to associate with the data. | |
829 | + * @param key A string naming the piece of data to set. | |
830 | + * @param value The new data value. | |
831 | + */ | |
832 | + data<T>(element: Element, key: string, value: T): T; | |
833 | + /** | |
834 | + * 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. | |
835 | + * | |
836 | + * @param element The DOM element to associate with the data. | |
837 | + * @param key A string naming the piece of data to set. | |
838 | + */ | |
839 | + data(element: Element, key: string): any; | |
840 | + /** | |
841 | + * 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. | |
842 | + * | |
843 | + * @param element The DOM element to associate with the data. | |
844 | + */ | |
845 | + data(element: Element): any; | |
846 | + | |
847 | + /** | |
848 | + * Execute the next function on the queue for the matched element. | |
849 | + * | |
850 | + * @param element A DOM element from which to remove and execute a queued function. | |
851 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
852 | + */ | |
853 | + dequeue(element: Element, queueName?: string): void; | |
854 | + | |
855 | + /** | |
856 | + * Determine whether an element has any jQuery data associated with it. | |
857 | + * | |
858 | + * @param element A DOM element to be checked for data. | |
859 | + */ | |
860 | + hasData(element: Element): boolean; | |
861 | + | |
862 | + /** | |
863 | + * Show the queue of functions to be executed on the matched element. | |
864 | + * | |
865 | + * @param element A DOM element to inspect for an attached queue. | |
866 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
867 | + */ | |
868 | + queue(element: Element, queueName?: string): any[]; | |
869 | + /** | |
870 | + * Manipulate the queue of functions to be executed on the matched element. | |
871 | + * | |
872 | + * @param element A DOM element where the array of queued functions is attached. | |
873 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
874 | + * @param newQueue An array of functions to replace the current queue contents. | |
875 | + */ | |
876 | + queue(element: Element, queueName: string, newQueue: Function[]): JQuery; | |
877 | + /** | |
878 | + * Manipulate the queue of functions to be executed on the matched element. | |
879 | + * | |
880 | + * @param element A DOM element on which to add a queued function. | |
881 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
882 | + * @param callback The new function to add to the queue. | |
883 | + */ | |
884 | + queue(element: Element, queueName: string, callback: Function): JQuery; | |
885 | + | |
886 | + /** | |
887 | + * Remove a previously-stored piece of data. | |
888 | + * | |
889 | + * @param element A DOM element from which to remove data. | |
890 | + * @param name A string naming the piece of data to remove. | |
891 | + */ | |
892 | + removeData(element: Element, name?: string): JQuery; | |
893 | + | |
894 | + /** | |
895 | + * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. | |
896 | + * | |
897 | + * @param beforeStart A function that is called just before the constructor returns. | |
898 | + */ | |
899 | + Deferred<T>(beforeStart?: (deferred: JQueryDeferred<T>) => any): JQueryDeferred<T>; | |
900 | + | |
901 | + /** | |
902 | + * Effects | |
903 | + */ | |
904 | + | |
905 | + easing: JQueryEasingFunctions; | |
906 | + | |
907 | + fx: { | |
908 | + tick: () => void; | |
909 | + /** | |
910 | + * The rate (in milliseconds) at which animations fire. | |
911 | + */ | |
912 | + interval: number; | |
913 | + stop: () => void; | |
914 | + speeds: { slow: number; fast: number; }; | |
915 | + /** | |
916 | + * Globally disable all animations. | |
917 | + */ | |
918 | + off: boolean; | |
919 | + step: any; | |
920 | + }; | |
921 | + | |
922 | + /** | |
923 | + * Takes a function and returns a new one that will always have a particular context. | |
924 | + * | |
925 | + * @param fnction The function whose context will be changed. | |
926 | + * @param context The object to which the context (this) of the function should be set. | |
927 | + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. | |
928 | + */ | |
929 | + proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; | |
930 | + /** | |
931 | + * Takes a function and returns a new one that will always have a particular context. | |
932 | + * | |
933 | + * @param context The object to which the context (this) of the function should be set. | |
934 | + * @param name The name of the function whose context will be changed (should be a property of the context object). | |
935 | + * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. | |
936 | + */ | |
937 | + proxy(context: Object, name: string, ...additionalArguments: any[]): any; | |
938 | + | |
939 | + Event: JQueryEventConstructor; | |
940 | + | |
941 | + /** | |
942 | + * Takes a string and throws an exception containing it. | |
943 | + * | |
944 | + * @param message The message to send out. | |
945 | + */ | |
946 | + error(message: any): JQuery; | |
947 | + | |
948 | + expr: any; | |
949 | + fn: any; //TODO: Decide how we want to type this | |
950 | + | |
951 | + isReady: boolean; | |
952 | + | |
953 | + // Properties | |
954 | + support: JQuerySupport; | |
955 | + | |
956 | + /** | |
957 | + * Check to see if a DOM element is a descendant of another DOM element. | |
958 | + * | |
959 | + * @param container The DOM element that may contain the other element. | |
960 | + * @param contained The DOM element that may be contained by (a descendant of) the other element. | |
961 | + */ | |
962 | + contains(container: Element, contained: Element): boolean; | |
963 | + | |
964 | + /** | |
965 | + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. | |
966 | + * | |
967 | + * @param collection The object or array to iterate over. | |
968 | + * @param callback The function that will be executed on every object. | |
969 | + */ | |
970 | + each<T>( | |
971 | + collection: T[], | |
972 | + callback: (indexInArray: number, valueOfElement: T) => any | |
973 | + ): any; | |
974 | + | |
975 | + /** | |
976 | + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. | |
977 | + * | |
978 | + * @param collection The object or array to iterate over. | |
979 | + * @param callback The function that will be executed on every object. | |
980 | + */ | |
981 | + each( | |
982 | + collection: any, | |
983 | + callback: (indexInArray: any, valueOfElement: any) => any | |
984 | + ): any; | |
985 | + | |
986 | + /** | |
987 | + * Merge the contents of two or more objects together into the first object. | |
988 | + * | |
989 | + * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. | |
990 | + * @param object1 An object containing additional properties to merge in. | |
991 | + * @param objectN Additional objects containing properties to merge in. | |
992 | + */ | |
993 | + extend(target: any, object1?: any, ...objectN: any[]): any; | |
994 | + /** | |
995 | + * Merge the contents of two or more objects together into the first object. | |
996 | + * | |
997 | + * @param deep If true, the merge becomes recursive (aka. deep copy). | |
998 | + * @param target The object to extend. It will receive the new properties. | |
999 | + * @param object1 An object containing additional properties to merge in. | |
1000 | + * @param objectN Additional objects containing properties to merge in. | |
1001 | + */ | |
1002 | + extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; | |
1003 | + | |
1004 | + /** | |
1005 | + * Execute some JavaScript code globally. | |
1006 | + * | |
1007 | + * @param code The JavaScript code to execute. | |
1008 | + */ | |
1009 | + globalEval(code: string): any; | |
1010 | + | |
1011 | + /** | |
1012 | + * Finds the elements of an array which satisfy a filter function. The original array is not affected. | |
1013 | + * | |
1014 | + * @param array The array to search through. | |
1015 | + * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. | |
1016 | + * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. | |
1017 | + */ | |
1018 | + grep<T>(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; | |
1019 | + | |
1020 | + /** | |
1021 | + * Search for a specified value within an array and return its index (or -1 if not found). | |
1022 | + * | |
1023 | + * @param value The value to search for. | |
1024 | + * @param array An array through which to search. | |
1025 | + * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. | |
1026 | + */ | |
1027 | + inArray<T>(value: T, array: T[], fromIndex?: number): number; | |
1028 | + | |
1029 | + /** | |
1030 | + * Determine whether the argument is an array. | |
1031 | + * | |
1032 | + * @param obj Object to test whether or not it is an array. | |
1033 | + */ | |
1034 | + isArray(obj: any): boolean; | |
1035 | + /** | |
1036 | + * Check to see if an object is empty (contains no enumerable properties). | |
1037 | + * | |
1038 | + * @param obj The object that will be checked to see if it's empty. | |
1039 | + */ | |
1040 | + isEmptyObject(obj: any): boolean; | |
1041 | + /** | |
1042 | + * Determine if the argument passed is a Javascript function object. | |
1043 | + * | |
1044 | + * @param obj Object to test whether or not it is a function. | |
1045 | + */ | |
1046 | + isFunction(obj: any): boolean; | |
1047 | + /** | |
1048 | + * Determines whether its argument is a number. | |
1049 | + * | |
1050 | + * @param obj The value to be tested. | |
1051 | + */ | |
1052 | + isNumeric(value: any): boolean; | |
1053 | + /** | |
1054 | + * Check to see if an object is a plain object (created using "{}" or "new Object"). | |
1055 | + * | |
1056 | + * @param obj The object that will be checked to see if it's a plain object. | |
1057 | + */ | |
1058 | + isPlainObject(obj: any): boolean; | |
1059 | + /** | |
1060 | + * Determine whether the argument is a window. | |
1061 | + * | |
1062 | + * @param obj Object to test whether or not it is a window. | |
1063 | + */ | |
1064 | + isWindow(obj: any): boolean; | |
1065 | + /** | |
1066 | + * Check to see if a DOM node is within an XML document (or is an XML document). | |
1067 | + * | |
1068 | + * @param node he DOM node that will be checked to see if it's in an XML document. | |
1069 | + */ | |
1070 | + isXMLDoc(node: Node): boolean; | |
1071 | + | |
1072 | + /** | |
1073 | + * Convert an array-like object into a true JavaScript array. | |
1074 | + * | |
1075 | + * @param obj Any object to turn into a native Array. | |
1076 | + */ | |
1077 | + makeArray(obj: any): any[]; | |
1078 | + | |
1079 | + /** | |
1080 | + * Translate all items in an array or object to new array of items. | |
1081 | + * | |
1082 | + * @param array The Array to translate. | |
1083 | + * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. | |
1084 | + */ | |
1085 | + map<T, U>(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; | |
1086 | + /** | |
1087 | + * Translate all items in an array or object to new array of items. | |
1088 | + * | |
1089 | + * @param arrayOrObject The Array or Object to translate. | |
1090 | + * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. | |
1091 | + */ | |
1092 | + map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; | |
1093 | + | |
1094 | + /** | |
1095 | + * Merge the contents of two arrays together into the first array. | |
1096 | + * | |
1097 | + * @param first The first array to merge, the elements of second added. | |
1098 | + * @param second The second array to merge into the first, unaltered. | |
1099 | + */ | |
1100 | + merge<T>(first: T[], second: T[]): T[]; | |
1101 | + | |
1102 | + /** | |
1103 | + * An empty function. | |
1104 | + */ | |
1105 | + noop(): any; | |
1106 | + | |
1107 | + /** | |
1108 | + * Return a number representing the current time. | |
1109 | + */ | |
1110 | + now(): number; | |
1111 | + | |
1112 | + /** | |
1113 | + * Takes a well-formed JSON string and returns the resulting JavaScript object. | |
1114 | + * | |
1115 | + * @param json The JSON string to parse. | |
1116 | + */ | |
1117 | + parseJSON(json: string): any; | |
1118 | + | |
1119 | + /** | |
1120 | + * Parses a string into an XML document. | |
1121 | + * | |
1122 | + * @param data a well-formed XML string to be parsed | |
1123 | + */ | |
1124 | + parseXML(data: string): XMLDocument; | |
1125 | + | |
1126 | + /** | |
1127 | + * Remove the whitespace from the beginning and end of a string. | |
1128 | + * | |
1129 | + * @param str Remove the whitespace from the beginning and end of a string. | |
1130 | + */ | |
1131 | + trim(str: string): string; | |
1132 | + | |
1133 | + /** | |
1134 | + * Determine the internal JavaScript [[Class]] of an object. | |
1135 | + * | |
1136 | + * @param obj Object to get the internal JavaScript [[Class]] of. | |
1137 | + */ | |
1138 | + type(obj: any): string; | |
1139 | + | |
1140 | + /** | |
1141 | + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. | |
1142 | + * | |
1143 | + * @param array The Array of DOM elements. | |
1144 | + */ | |
1145 | + unique(array: Element[]): Element[]; | |
1146 | + | |
1147 | + /** | |
1148 | + * Parses a string into an array of DOM nodes. | |
1149 | + * | |
1150 | + * @param data HTML string to be parsed | |
1151 | + * @param context DOM element to serve as the context in which the HTML fragment will be created | |
1152 | + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string | |
1153 | + */ | |
1154 | + parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; | |
1155 | + | |
1156 | + /** | |
1157 | + * Parses a string into an array of DOM nodes. | |
1158 | + * | |
1159 | + * @param data HTML string to be parsed | |
1160 | + * @param context DOM element to serve as the context in which the HTML fragment will be created | |
1161 | + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string | |
1162 | + */ | |
1163 | + parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; | |
1164 | +} | |
1165 | + | |
1166 | +/** | |
1167 | + * The jQuery instance members | |
1168 | + */ | |
1169 | +interface JQuery { | |
1170 | + /** | |
1171 | + * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. | |
1172 | + * | |
1173 | + * @param handler The function to be invoked. | |
1174 | + */ | |
1175 | + ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery; | |
1176 | + /** | |
1177 | + * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. | |
1178 | + * | |
1179 | + * @param handler The function to be invoked. | |
1180 | + */ | |
1181 | + ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery; | |
1182 | + /** | |
1183 | + * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. | |
1184 | + * | |
1185 | + * @param handler The function to be invoked. | |
1186 | + */ | |
1187 | + ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery; | |
1188 | + /** | |
1189 | + * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. | |
1190 | + * | |
1191 | + * @param handler The function to be invoked. | |
1192 | + */ | |
1193 | + ajaxStart(handler: () => any): JQuery; | |
1194 | + /** | |
1195 | + * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. | |
1196 | + * | |
1197 | + * @param handler The function to be invoked. | |
1198 | + */ | |
1199 | + ajaxStop(handler: () => any): JQuery; | |
1200 | + /** | |
1201 | + * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. | |
1202 | + * | |
1203 | + * @param handler The function to be invoked. | |
1204 | + */ | |
1205 | + ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery; | |
1206 | + | |
1207 | + /** | |
1208 | + * Load data from the server and place the returned HTML into the matched element. | |
1209 | + * | |
1210 | + * @param url A string containing the URL to which the request is sent. | |
1211 | + * @param data A plain object or string that is sent to the server with the request. | |
1212 | + * @param complete A callback function that is executed when the request completes. | |
1213 | + */ | |
1214 | + load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; | |
1215 | + | |
1216 | + /** | |
1217 | + * Encode a set of form elements as a string for submission. | |
1218 | + */ | |
1219 | + serialize(): string; | |
1220 | + /** | |
1221 | + * Encode a set of form elements as an array of names and values. | |
1222 | + */ | |
1223 | + serializeArray(): JQuerySerializeArrayElement[]; | |
1224 | + | |
1225 | + /** | |
1226 | + * Adds the specified class(es) to each of the set of matched elements. | |
1227 | + * | |
1228 | + * @param className One or more space-separated classes to be added to the class attribute of each matched element. | |
1229 | + */ | |
1230 | + addClass(className: string): JQuery; | |
1231 | + /** | |
1232 | + * Adds the specified class(es) to each of the set of matched elements. | |
1233 | + * | |
1234 | + * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. | |
1235 | + */ | |
1236 | + addClass(func: (index: number, className: string) => string): JQuery; | |
1237 | + | |
1238 | + /** | |
1239 | + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. | |
1240 | + */ | |
1241 | + addBack(selector?: string): JQuery; | |
1242 | + | |
1243 | + /** | |
1244 | + * Get the value of an attribute for the first element in the set of matched elements. | |
1245 | + * | |
1246 | + * @param attributeName The name of the attribute to get. | |
1247 | + */ | |
1248 | + attr(attributeName: string): string; | |
1249 | + /** | |
1250 | + * Set one or more attributes for the set of matched elements. | |
1251 | + * | |
1252 | + * @param attributeName The name of the attribute to set. | |
1253 | + * @param value A value to set for the attribute. | |
1254 | + */ | |
1255 | + attr(attributeName: string, value: string|number): JQuery; | |
1256 | + /** | |
1257 | + * Set one or more attributes for the set of matched elements. | |
1258 | + * | |
1259 | + * @param attributeName The name of the attribute to set. | |
1260 | + * @param func 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 attribute value as arguments. | |
1261 | + */ | |
1262 | + attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; | |
1263 | + /** | |
1264 | + * Set one or more attributes for the set of matched elements. | |
1265 | + * | |
1266 | + * @param attributes An object of attribute-value pairs to set. | |
1267 | + */ | |
1268 | + attr(attributes: Object): JQuery; | |
1269 | + | |
1270 | + /** | |
1271 | + * Determine whether any of the matched elements are assigned the given class. | |
1272 | + * | |
1273 | + * @param className The class name to search for. | |
1274 | + */ | |
1275 | + hasClass(className: string): boolean; | |
1276 | + | |
1277 | + /** | |
1278 | + * Get the HTML contents of the first element in the set of matched elements. | |
1279 | + */ | |
1280 | + html(): string; | |
1281 | + /** | |
1282 | + * Set the HTML contents of each element in the set of matched elements. | |
1283 | + * | |
1284 | + * @param htmlString A string of HTML to set as the content of each matched element. | |
1285 | + */ | |
1286 | + html(htmlString: string): JQuery; | |
1287 | + /** | |
1288 | + * Set the HTML contents of each element in the set of matched elements. | |
1289 | + * | |
1290 | + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. | |
1291 | + */ | |
1292 | + html(func: (index: number, oldhtml: string) => string): JQuery; | |
1293 | + /** | |
1294 | + * Set the HTML contents of each element in the set of matched elements. | |
1295 | + * | |
1296 | + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. | |
1297 | + */ | |
1298 | + | |
1299 | + /** | |
1300 | + * Get the value of a property for the first element in the set of matched elements. | |
1301 | + * | |
1302 | + * @param propertyName The name of the property to get. | |
1303 | + */ | |
1304 | + prop(propertyName: string): any; | |
1305 | + /** | |
1306 | + * Set one or more properties for the set of matched elements. | |
1307 | + * | |
1308 | + * @param propertyName The name of the property to set. | |
1309 | + * @param value A value to set for the property. | |
1310 | + */ | |
1311 | + prop(propertyName: string, value: string|number|boolean): JQuery; | |
1312 | + /** | |
1313 | + * Set one or more properties for the set of matched elements. | |
1314 | + * | |
1315 | + * @param properties An object of property-value pairs to set. | |
1316 | + */ | |
1317 | + prop(properties: Object): JQuery; | |
1318 | + /** | |
1319 | + * Set one or more properties for the set of matched elements. | |
1320 | + * | |
1321 | + * @param propertyName The name of the property to set. | |
1322 | + * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. | |
1323 | + */ | |
1324 | + prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery; | |
1325 | + | |
1326 | + /** | |
1327 | + * Remove an attribute from each element in the set of matched elements. | |
1328 | + * | |
1329 | + * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. | |
1330 | + */ | |
1331 | + removeAttr(attributeName: string): JQuery; | |
1332 | + | |
1333 | + /** | |
1334 | + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. | |
1335 | + * | |
1336 | + * @param className One or more space-separated classes to be removed from the class attribute of each matched element. | |
1337 | + */ | |
1338 | + removeClass(className?: string): JQuery; | |
1339 | + /** | |
1340 | + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. | |
1341 | + * | |
1342 | + * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. | |
1343 | + */ | |
1344 | + removeClass(func: (index: number, className: string) => string): JQuery; | |
1345 | + | |
1346 | + /** | |
1347 | + * Remove a property for the set of matched elements. | |
1348 | + * | |
1349 | + * @param propertyName The name of the property to remove. | |
1350 | + */ | |
1351 | + removeProp(propertyName: string): JQuery; | |
1352 | + | |
1353 | + /** | |
1354 | + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. | |
1355 | + * | |
1356 | + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. | |
1357 | + * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. | |
1358 | + */ | |
1359 | + toggleClass(className: string, swtch?: boolean): JQuery; | |
1360 | + /** | |
1361 | + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. | |
1362 | + * | |
1363 | + * @param swtch A boolean value to determine whether the class should be added or removed. | |
1364 | + */ | |
1365 | + toggleClass(swtch?: boolean): JQuery; | |
1366 | + /** | |
1367 | + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. | |
1368 | + * | |
1369 | + * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. | |
1370 | + * @param swtch A boolean value to determine whether the class should be added or removed. | |
1371 | + */ | |
1372 | + toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery; | |
1373 | + | |
1374 | + /** | |
1375 | + * Get the current value of the first element in the set of matched elements. | |
1376 | + */ | |
1377 | + val(): any; | |
1378 | + /** | |
1379 | + * Set the value of each element in the set of matched elements. | |
1380 | + * | |
1381 | + * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. | |
1382 | + */ | |
1383 | + val(value: string|string[]|number): JQuery; | |
1384 | + /** | |
1385 | + * Set the value of each element in the set of matched elements. | |
1386 | + * | |
1387 | + * @param func 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. | |
1388 | + */ | |
1389 | + val(func: (index: number, value: string) => string): JQuery; | |
1390 | + | |
1391 | + | |
1392 | + /** | |
1393 | + * Get the value of style properties for the first element in the set of matched elements. | |
1394 | + * | |
1395 | + * @param propertyName A CSS property. | |
1396 | + */ | |
1397 | + css(propertyName: string): string; | |
1398 | + /** | |
1399 | + * Set one or more CSS properties for the set of matched elements. | |
1400 | + * | |
1401 | + * @param propertyName A CSS property name. | |
1402 | + * @param value A value to set for the property. | |
1403 | + */ | |
1404 | + css(propertyName: string, value: string|number): JQuery; | |
1405 | + /** | |
1406 | + * Set one or more CSS properties for the set of matched elements. | |
1407 | + * | |
1408 | + * @param propertyName A CSS property name. | |
1409 | + * @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. | |
1410 | + */ | |
1411 | + css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; | |
1412 | + /** | |
1413 | + * Set one or more CSS properties for the set of matched elements. | |
1414 | + * | |
1415 | + * @param properties An object of property-value pairs to set. | |
1416 | + */ | |
1417 | + css(properties: Object): JQuery; | |
1418 | + | |
1419 | + /** | |
1420 | + * Get the current computed height for the first element in the set of matched elements. | |
1421 | + */ | |
1422 | + height(): number; | |
1423 | + /** | |
1424 | + * Set the CSS height of every matched element. | |
1425 | + * | |
1426 | + * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). | |
1427 | + */ | |
1428 | + height(value: number|string): JQuery; | |
1429 | + /** | |
1430 | + * Set the CSS height of every matched element. | |
1431 | + * | |
1432 | + * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. | |
1433 | + */ | |
1434 | + height(func: (index: number, height: number) => number|string): JQuery; | |
1435 | + | |
1436 | + /** | |
1437 | + * Get the current computed height for the first element in the set of matched elements, including padding but not border. | |
1438 | + */ | |
1439 | + innerHeight(): number; | |
1440 | + | |
1441 | + /** | |
1442 | + * Sets the inner height on elements in the set of matched elements, including padding but not border. | |
1443 | + * | |
1444 | + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). | |
1445 | + */ | |
1446 | + innerHeight(height: number|string): JQuery; | |
1447 | + | |
1448 | + /** | |
1449 | + * Get the current computed width for the first element in the set of matched elements, including padding but not border. | |
1450 | + */ | |
1451 | + innerWidth(): number; | |
1452 | + | |
1453 | + /** | |
1454 | + * Sets the inner width on elements in the set of matched elements, including padding but not border. | |
1455 | + * | |
1456 | + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). | |
1457 | + */ | |
1458 | + innerWidth(width: number|string): JQuery; | |
1459 | + | |
1460 | + /** | |
1461 | + * Get the current coordinates of the first element in the set of matched elements, relative to the document. | |
1462 | + */ | |
1463 | + offset(): JQueryCoordinates; | |
1464 | + /** | |
1465 | + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. | |
1466 | + * | |
1467 | + * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. | |
1468 | + */ | |
1469 | + offset(coordinates: JQueryCoordinates): JQuery; | |
1470 | + /** | |
1471 | + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. | |
1472 | + * | |
1473 | + * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. | |
1474 | + */ | |
1475 | + offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery; | |
1476 | + | |
1477 | + /** | |
1478 | + * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. | |
1479 | + * | |
1480 | + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. | |
1481 | + */ | |
1482 | + outerHeight(includeMargin?: boolean): number; | |
1483 | + | |
1484 | + /** | |
1485 | + * Sets the outer height on elements in the set of matched elements, including padding and border. | |
1486 | + * | |
1487 | + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). | |
1488 | + */ | |
1489 | + outerHeight(height: number|string): JQuery; | |
1490 | + | |
1491 | + /** | |
1492 | + * Get the current computed width for the first element in the set of matched elements, including padding and border. | |
1493 | + * | |
1494 | + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. | |
1495 | + */ | |
1496 | + outerWidth(includeMargin?: boolean): number; | |
1497 | + | |
1498 | + /** | |
1499 | + * Sets the outer width on elements in the set of matched elements, including padding and border. | |
1500 | + * | |
1501 | + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). | |
1502 | + */ | |
1503 | + outerWidth(width: number|string): JQuery; | |
1504 | + | |
1505 | + /** | |
1506 | + * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. | |
1507 | + */ | |
1508 | + position(): JQueryCoordinates; | |
1509 | + | |
1510 | + /** | |
1511 | + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. | |
1512 | + */ | |
1513 | + scrollLeft(): number; | |
1514 | + /** | |
1515 | + * Set the current horizontal position of the scroll bar for each of the set of matched elements. | |
1516 | + * | |
1517 | + * @param value An integer indicating the new position to set the scroll bar to. | |
1518 | + */ | |
1519 | + scrollLeft(value: number): JQuery; | |
1520 | + | |
1521 | + /** | |
1522 | + * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. | |
1523 | + */ | |
1524 | + scrollTop(): number; | |
1525 | + /** | |
1526 | + * Set the current vertical position of the scroll bar for each of the set of matched elements. | |
1527 | + * | |
1528 | + * @param value An integer indicating the new position to set the scroll bar to. | |
1529 | + */ | |
1530 | + scrollTop(value: number): JQuery; | |
1531 | + | |
1532 | + /** | |
1533 | + * Get the current computed width for the first element in the set of matched elements. | |
1534 | + */ | |
1535 | + width(): number; | |
1536 | + /** | |
1537 | + * Set the CSS width of each element in the set of matched elements. | |
1538 | + * | |
1539 | + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). | |
1540 | + */ | |
1541 | + width(value: number|string): JQuery; | |
1542 | + /** | |
1543 | + * Set the CSS width of each element in the set of matched elements. | |
1544 | + * | |
1545 | + * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. | |
1546 | + */ | |
1547 | + width(func: (index: number, width: number) => number|string): JQuery; | |
1548 | + | |
1549 | + /** | |
1550 | + * Remove from the queue all items that have not yet been run. | |
1551 | + * | |
1552 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
1553 | + */ | |
1554 | + clearQueue(queueName?: string): JQuery; | |
1555 | + | |
1556 | + /** | |
1557 | + * Store arbitrary data associated with the matched elements. | |
1558 | + * | |
1559 | + * @param key A string naming the piece of data to set. | |
1560 | + * @param value The new data value; it can be any Javascript type including Array or Object. | |
1561 | + */ | |
1562 | + data(key: string, value: any): JQuery; | |
1563 | + /** | |
1564 | + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. | |
1565 | + * | |
1566 | + * @param key Name of the data stored. | |
1567 | + */ | |
1568 | + data(key: string): any; | |
1569 | + /** | |
1570 | + * Store arbitrary data associated with the matched elements. | |
1571 | + * | |
1572 | + * @param obj An object of key-value pairs of data to update. | |
1573 | + */ | |
1574 | + data(obj: { [key: string]: any; }): JQuery; | |
1575 | + /** | |
1576 | + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. | |
1577 | + */ | |
1578 | + data(): any; | |
1579 | + | |
1580 | + /** | |
1581 | + * Execute the next function on the queue for the matched elements. | |
1582 | + * | |
1583 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
1584 | + */ | |
1585 | + dequeue(queueName?: string): JQuery; | |
1586 | + | |
1587 | + /** | |
1588 | + * Remove a previously-stored piece of data. | |
1589 | + * | |
1590 | + * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. | |
1591 | + */ | |
1592 | + removeData(name: string): JQuery; | |
1593 | + /** | |
1594 | + * Remove a previously-stored piece of data. | |
1595 | + * | |
1596 | + * @param list An array of strings naming the pieces of data to delete. | |
1597 | + */ | |
1598 | + removeData(list: string[]): JQuery; | |
1599 | + /** | |
1600 | + * Remove all previously-stored piece of data. | |
1601 | + */ | |
1602 | + removeData(): JQuery; | |
1603 | + | |
1604 | + /** | |
1605 | + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. | |
1606 | + * | |
1607 | + * @param type The type of queue that needs to be observed. (default: fx) | |
1608 | + * @param target Object onto which the promise methods have to be attached | |
1609 | + */ | |
1610 | + promise(type?: string, target?: Object): JQueryPromise<any>; | |
1611 | + | |
1612 | + /** | |
1613 | + * Perform a custom animation of a set of CSS properties. | |
1614 | + * | |
1615 | + * @param properties An object of CSS properties and values that the animation will move toward. | |
1616 | + * @param duration A string or number determining how long the animation will run. | |
1617 | + * @param complete A function to call once the animation is complete. | |
1618 | + */ | |
1619 | + animate(properties: Object, duration?: string|number, complete?: Function): JQuery; | |
1620 | + /** | |
1621 | + * Perform a custom animation of a set of CSS properties. | |
1622 | + * | |
1623 | + * @param properties An object of CSS properties and values that the animation will move toward. | |
1624 | + * @param duration A string or number determining how long the animation will run. | |
1625 | + * @param easing A string indicating which easing function to use for the transition. (default: swing) | |
1626 | + * @param complete A function to call once the animation is complete. | |
1627 | + */ | |
1628 | + animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; | |
1629 | + /** | |
1630 | + * Perform a custom animation of a set of CSS properties. | |
1631 | + * | |
1632 | + * @param properties An object of CSS properties and values that the animation will move toward. | |
1633 | + * @param options A map of additional options to pass to the method. | |
1634 | + */ | |
1635 | + animate(properties: Object, options: JQueryAnimationOptions): JQuery; | |
1636 | + | |
1637 | + /** | |
1638 | + * Set a timer to delay execution of subsequent items in the queue. | |
1639 | + * | |
1640 | + * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. | |
1641 | + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. | |
1642 | + */ | |
1643 | + delay(duration: number, queueName?: string): JQuery; | |
1644 | + | |
1645 | + /** | |
1646 | + * Display the matched elements by fading them to opaque. | |
1647 | + * | |
1648 | + * @param duration A string or number determining how long the animation will run. | |
1649 | + * @param complete A function to call once the animation is complete. | |
1650 | + */ | |
1651 | + fadeIn(duration?: number|string, complete?: Function): JQuery; | |
1652 | + /** | |
1653 | + * Display the matched elements by fading them to opaque. | |
1654 | + * | |
1655 | + * @param duration A string or number determining how long the animation will run. | |
1656 | + * @param easing A string indicating which easing function to use for the transition. | |
1657 | + * @param complete A function to call once the animation is complete. | |
1658 | + */ | |
1659 | + fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1660 | + /** | |
1661 | + * Display the matched elements by fading them to opaque. | |
1662 | + * | |
1663 | + * @param options A map of additional options to pass to the method. | |
1664 | + */ | |
1665 | + fadeIn(options: JQueryAnimationOptions): JQuery; | |
1666 | + | |
1667 | + /** | |
1668 | + * Hide the matched elements by fading them to transparent. | |
1669 | + * | |
1670 | + * @param duration A string or number determining how long the animation will run. | |
1671 | + * @param complete A function to call once the animation is complete. | |
1672 | + */ | |
1673 | + fadeOut(duration?: number|string, complete?: Function): JQuery; | |
1674 | + /** | |
1675 | + * Hide the matched elements by fading them to transparent. | |
1676 | + * | |
1677 | + * @param duration A string or number determining how long the animation will run. | |
1678 | + * @param easing A string indicating which easing function to use for the transition. | |
1679 | + * @param complete A function to call once the animation is complete. | |
1680 | + */ | |
1681 | + fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1682 | + /** | |
1683 | + * Hide the matched elements by fading them to transparent. | |
1684 | + * | |
1685 | + * @param options A map of additional options to pass to the method. | |
1686 | + */ | |
1687 | + fadeOut(options: JQueryAnimationOptions): JQuery; | |
1688 | + | |
1689 | + /** | |
1690 | + * Adjust the opacity of the matched elements. | |
1691 | + * | |
1692 | + * @param duration A string or number determining how long the animation will run. | |
1693 | + * @param opacity A number between 0 and 1 denoting the target opacity. | |
1694 | + * @param complete A function to call once the animation is complete. | |
1695 | + */ | |
1696 | + fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; | |
1697 | + /** | |
1698 | + * Adjust the opacity of the matched elements. | |
1699 | + * | |
1700 | + * @param duration A string or number determining how long the animation will run. | |
1701 | + * @param opacity A number between 0 and 1 denoting the target opacity. | |
1702 | + * @param easing A string indicating which easing function to use for the transition. | |
1703 | + * @param complete A function to call once the animation is complete. | |
1704 | + */ | |
1705 | + fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; | |
1706 | + | |
1707 | + /** | |
1708 | + * Display or hide the matched elements by animating their opacity. | |
1709 | + * | |
1710 | + * @param duration A string or number determining how long the animation will run. | |
1711 | + * @param complete A function to call once the animation is complete. | |
1712 | + */ | |
1713 | + fadeToggle(duration?: number|string, complete?: Function): JQuery; | |
1714 | + /** | |
1715 | + * Display or hide the matched elements by animating their opacity. | |
1716 | + * | |
1717 | + * @param duration A string or number determining how long the animation will run. | |
1718 | + * @param easing A string indicating which easing function to use for the transition. | |
1719 | + * @param complete A function to call once the animation is complete. | |
1720 | + */ | |
1721 | + fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1722 | + /** | |
1723 | + * Display or hide the matched elements by animating their opacity. | |
1724 | + * | |
1725 | + * @param options A map of additional options to pass to the method. | |
1726 | + */ | |
1727 | + fadeToggle(options: JQueryAnimationOptions): JQuery; | |
1728 | + | |
1729 | + /** | |
1730 | + * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. | |
1731 | + * | |
1732 | + * @param queue The name of the queue in which to stop animations. | |
1733 | + */ | |
1734 | + finish(queue?: string): JQuery; | |
1735 | + | |
1736 | + /** | |
1737 | + * Hide the matched elements. | |
1738 | + * | |
1739 | + * @param duration A string or number determining how long the animation will run. | |
1740 | + * @param complete A function to call once the animation is complete. | |
1741 | + */ | |
1742 | + hide(duration?: number|string, complete?: Function): JQuery; | |
1743 | + /** | |
1744 | + * Hide the matched elements. | |
1745 | + * | |
1746 | + * @param duration A string or number determining how long the animation will run. | |
1747 | + * @param easing A string indicating which easing function to use for the transition. | |
1748 | + * @param complete A function to call once the animation is complete. | |
1749 | + */ | |
1750 | + hide(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1751 | + /** | |
1752 | + * Hide the matched elements. | |
1753 | + * | |
1754 | + * @param options A map of additional options to pass to the method. | |
1755 | + */ | |
1756 | + hide(options: JQueryAnimationOptions): JQuery; | |
1757 | + | |
1758 | + /** | |
1759 | + * Display the matched elements. | |
1760 | + * | |
1761 | + * @param duration A string or number determining how long the animation will run. | |
1762 | + * @param complete A function to call once the animation is complete. | |
1763 | + */ | |
1764 | + show(duration?: number|string, complete?: Function): JQuery; | |
1765 | + /** | |
1766 | + * Display the matched elements. | |
1767 | + * | |
1768 | + * @param duration A string or number determining how long the animation will run. | |
1769 | + * @param easing A string indicating which easing function to use for the transition. | |
1770 | + * @param complete A function to call once the animation is complete. | |
1771 | + */ | |
1772 | + show(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1773 | + /** | |
1774 | + * Display the matched elements. | |
1775 | + * | |
1776 | + * @param options A map of additional options to pass to the method. | |
1777 | + */ | |
1778 | + show(options: JQueryAnimationOptions): JQuery; | |
1779 | + | |
1780 | + /** | |
1781 | + * Display the matched elements with a sliding motion. | |
1782 | + * | |
1783 | + * @param duration A string or number determining how long the animation will run. | |
1784 | + * @param complete A function to call once the animation is complete. | |
1785 | + */ | |
1786 | + slideDown(duration?: number|string, complete?: Function): JQuery; | |
1787 | + /** | |
1788 | + * Display the matched elements with a sliding motion. | |
1789 | + * | |
1790 | + * @param duration A string or number determining how long the animation will run. | |
1791 | + * @param easing A string indicating which easing function to use for the transition. | |
1792 | + * @param complete A function to call once the animation is complete. | |
1793 | + */ | |
1794 | + slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1795 | + /** | |
1796 | + * Display the matched elements with a sliding motion. | |
1797 | + * | |
1798 | + * @param options A map of additional options to pass to the method. | |
1799 | + */ | |
1800 | + slideDown(options: JQueryAnimationOptions): JQuery; | |
1801 | + | |
1802 | + /** | |
1803 | + * Display or hide the matched elements with a sliding motion. | |
1804 | + * | |
1805 | + * @param duration A string or number determining how long the animation will run. | |
1806 | + * @param complete A function to call once the animation is complete. | |
1807 | + */ | |
1808 | + slideToggle(duration?: number|string, complete?: Function): JQuery; | |
1809 | + /** | |
1810 | + * Display or hide the matched elements with a sliding motion. | |
1811 | + * | |
1812 | + * @param duration A string or number determining how long the animation will run. | |
1813 | + * @param easing A string indicating which easing function to use for the transition. | |
1814 | + * @param complete A function to call once the animation is complete. | |
1815 | + */ | |
1816 | + slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1817 | + /** | |
1818 | + * Display or hide the matched elements with a sliding motion. | |
1819 | + * | |
1820 | + * @param options A map of additional options to pass to the method. | |
1821 | + */ | |
1822 | + slideToggle(options: JQueryAnimationOptions): JQuery; | |
1823 | + | |
1824 | + /** | |
1825 | + * Hide the matched elements with a sliding motion. | |
1826 | + * | |
1827 | + * @param duration A string or number determining how long the animation will run. | |
1828 | + * @param complete A function to call once the animation is complete. | |
1829 | + */ | |
1830 | + slideUp(duration?: number|string, complete?: Function): JQuery; | |
1831 | + /** | |
1832 | + * Hide the matched elements with a sliding motion. | |
1833 | + * | |
1834 | + * @param duration A string or number determining how long the animation will run. | |
1835 | + * @param easing A string indicating which easing function to use for the transition. | |
1836 | + * @param complete A function to call once the animation is complete. | |
1837 | + */ | |
1838 | + slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1839 | + /** | |
1840 | + * Hide the matched elements with a sliding motion. | |
1841 | + * | |
1842 | + * @param options A map of additional options to pass to the method. | |
1843 | + */ | |
1844 | + slideUp(options: JQueryAnimationOptions): JQuery; | |
1845 | + | |
1846 | + /** | |
1847 | + * Stop the currently-running animation on the matched elements. | |
1848 | + * | |
1849 | + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. | |
1850 | + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. | |
1851 | + */ | |
1852 | + stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; | |
1853 | + /** | |
1854 | + * Stop the currently-running animation on the matched elements. | |
1855 | + * | |
1856 | + * @param queue The name of the queue in which to stop animations. | |
1857 | + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. | |
1858 | + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. | |
1859 | + */ | |
1860 | + stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; | |
1861 | + | |
1862 | + /** | |
1863 | + * Display or hide the matched elements. | |
1864 | + * | |
1865 | + * @param duration A string or number determining how long the animation will run. | |
1866 | + * @param complete A function to call once the animation is complete. | |
1867 | + */ | |
1868 | + toggle(duration?: number|string, complete?: Function): JQuery; | |
1869 | + /** | |
1870 | + * Display or hide the matched elements. | |
1871 | + * | |
1872 | + * @param duration A string or number determining how long the animation will run. | |
1873 | + * @param easing A string indicating which easing function to use for the transition. | |
1874 | + * @param complete A function to call once the animation is complete. | |
1875 | + */ | |
1876 | + toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; | |
1877 | + /** | |
1878 | + * Display or hide the matched elements. | |
1879 | + * | |
1880 | + * @param options A map of additional options to pass to the method. | |
1881 | + */ | |
1882 | + toggle(options: JQueryAnimationOptions): JQuery; | |
1883 | + /** | |
1884 | + * Display or hide the matched elements. | |
1885 | + * | |
1886 | + * @param showOrHide A Boolean indicating whether to show or hide the elements. | |
1887 | + */ | |
1888 | + toggle(showOrHide: boolean): JQuery; | |
1889 | + | |
1890 | + /** | |
1891 | + * Attach a handler to an event for the elements. | |
1892 | + * | |
1893 | + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. | |
1894 | + * @param eventData An object containing data that will be passed to the event handler. | |
1895 | + * @param handler A function to execute each time the event is triggered. | |
1896 | + */ | |
1897 | + bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; | |
1898 | + /** | |
1899 | + * Attach a handler to an event for the elements. | |
1900 | + * | |
1901 | + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. | |
1902 | + * @param handler A function to execute each time the event is triggered. | |
1903 | + */ | |
1904 | + bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; | |
1905 | + /** | |
1906 | + * Attach a handler to an event for the elements. | |
1907 | + * | |
1908 | + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. | |
1909 | + * @param eventData An object containing data that will be passed to the event handler. | |
1910 | + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. | |
1911 | + */ | |
1912 | + bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; | |
1913 | + /** | |
1914 | + * Attach a handler to an event for the elements. | |
1915 | + * | |
1916 | + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. | |
1917 | + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. | |
1918 | + */ | |
1919 | + bind(eventType: string, preventBubble: boolean): JQuery; | |
1920 | + /** | |
1921 | + * Attach a handler to an event for the elements. | |
1922 | + * | |
1923 | + * @param events An object containing one or more DOM event types and functions to execute for them. | |
1924 | + */ | |
1925 | + bind(events: any): JQuery; | |
1926 | + | |
1927 | + /** | |
1928 | + * Trigger the "blur" event on an element | |
1929 | + */ | |
1930 | + blur(): JQuery; | |
1931 | + /** | |
1932 | + * Bind an event handler to the "blur" JavaScript event | |
1933 | + * | |
1934 | + * @param handler A function to execute each time the event is triggered. | |
1935 | + */ | |
1936 | + blur(handler: (eventObject: JQueryEventObject) => any): JQuery; | |
1937 | + /** | |
1938 | + * Bind an event handler to the "blur" JavaScript event | |
1939 | + * | |
1940 | + * @param eventData An object containing data that will be passed to the event handler. | |
1941 | + * @param handler A function to execute each time the event is triggered. | |
1942 | + */ | |
1943 | + blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; | |
1944 | + | |
1945 | + /** | |
1946 | + * Trigger the "change" event on an element. | |
1947 | + */ | |
1948 | + change(): JQuery; | |
1949 | + /** | |
1950 | + * Bind an event handler to the "change" JavaScript event | |
1951 | + * | |
1952 | + * @param handler A function to execute each time the event is triggered. | |
1953 | + */ | |
1954 | + change(handler: (eventObject: JQueryEventObject) => any): JQuery; | |
1955 | + /** | |
1956 | + * Bind an event handler to the "change" JavaScript event | |
1957 | + * | |
1958 | + * @param eventData An object containing data that will be passed to the event handler. | |
1959 | + * @param handler A function to execute each time the event is triggered. | |
1960 | + */ | |
1961 | + change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; | |
1962 | + | |
1963 | + /** | |
1964 | + * Trigger the "click" event on an element. | |
1965 | + */ | |
1966 | + click(): JQuery; | |
1967 | + /** | |
1968 | + * Bind an event handler to the "click" JavaScript event | |
1969 | + * | |
1970 | + * @param eventData An object containing data that will be passed to the event handler. | |
1971 | + */ | |
1972 | + click(handler: (eventObject: JQueryEventObject) => any): JQuery; | |
1973 | + /** | |
1974 | + * Bind an event handler to the "click" JavaScript event | |
1975 | + * | |
1976 | + * @param eventData An object containing data that will be passed to the event handler. | |
1977 | + * @param handler A function to execute each time the event is triggered. | |
1978 | + */ | |
1979 | + click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; | |
1980 | + | |
1981 | + /** | |
1982 | + * Trigger the "dblclick" event on an element. | |
1983 | + */ | |
1984 | + dblclick(): JQuery; | |
1985 | + /** | |
1986 | + * Bind an event handler to the "dblclick" JavaScript event | |
1987 | + * | |
1988 | + * @param handler A function to execute each time the event is triggered. | |
1989 | + */ | |
1990 | + dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; | |
1991 | + /** | |
1992 | + * Bind an event handler to the "dblclick" JavaScript event | |
1993 | + * | |
1994 | + * @param eventData An object containing data that will be passed to the event handler. | |
1995 | + * @param handler A function to execute each time the event is triggered. | |
1996 | + */ | |
1997 | + dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; | |
1998 | + | |
1999 | + delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; | |
2000 | + delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; | |
2001 | + | |
2002 | + /** | |
2003 | + * Trigger the "focus" event on an element. | |
2004 | + */ | |
2005 | + focus(): JQuery; | |
2006 | + /** | |
2007 | + * Bind an event handler to the "focus" JavaScript event | |
2008 | + * | |
2009 | + * @param handler A function to execute each time the event is triggered. | |
2010 | + */ | |
2011 | + focus(handler: (eventObject: JQueryEventObject) => any): JQuery; | |
2012 | + /** | |
2013 | + * Bind an event handler to the "focus" JavaScript event | |
2014 | + * | |
2015 | + * @param eventData An object containing data that will be passed to the event handler. | |
2016 | + * @param handler A function to execute each time the event is triggered. | |
2017 | + */ | |
2018 | + focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; | |
2019 | + | |
2020 | + /** | |
2021 | + * Trigger the "focusin" event on an element. | |
2022 | + */ | |
2023 | + focusin(): JQuery; | |
2024 | + /** | |
2025 | + * Bind an event handler to the "focusin" JavaScript event | |
2026 | + * | |
2027 |