Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit 9edd1b8

Browse files
Update contrib folder to 20160517 version
1 parent 5f65bd1 commit 9edd1b8

21 files changed

+2079
-47
lines changed

contrib/externs/angular-1.4.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*
2020
* TODO: Remaining Services:
2121
* $cookieStore
22-
* $document
2322
* $httpBackend
2423
* $locale
2524
* $rootElement
@@ -776,7 +775,7 @@ angular.Module.prototype.requires;
776775
/** @constructor */
777776
angular.Scope = function() {};
778777

779-
/** @type {string} */
778+
/** @type {?string} */
780779
angular.Scope.prototype.$$phase;
781780

782781
/**
@@ -926,7 +925,7 @@ angular.version.codeName = '';
926925
*****************************************************************************/
927926

928927
/**
929-
* @typedef {function()}
928+
* @typedef {function(string=)}
930929
*/
931930
angular.$anchorScroll;
932931

@@ -2383,3 +2382,10 @@ angular.$timeout_.cancel = function(promise) {};
23832382

23842383
/** @typedef {!Window} */
23852384
angular.$window;
2385+
2386+
/******************************************************************************
2387+
* $document Service
2388+
*****************************************************************************/
2389+
2390+
/** @typedef {!Document} */
2391+
angular.$document;

contrib/externs/angular-1.5-mocks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ angular.mock.$interval = function() {};
233233
* @param {!angular.$q.Promise} promise
234234
* @return {boolean}
235235
*/
236-
angular.mock.$interval.cancel = function(promise) {};
236+
angular.mock.$interval.prototype.cancel = function(promise) {};
237237

238238
/**
239239
* @param {number=} opt_millis
240240
* @return {number}
241241
*/
242-
angular.mock.$interval.flush = function(opt_millis) {};
242+
angular.mock.$interval.prototype.flush = function(opt_millis) {};
243243

244244
/** @constructor */
245245
angular.mock.$TimeoutDecorator = function() {};
Lines changed: 337 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,337 @@
1+
/*
2+
* Copyright 2012 The Closure Compiler Authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* @fileoverview Externs for Angular 1 ngResource.
19+
*
20+
* @see http://angularjs.org/
21+
* @externs
22+
*/
23+
24+
25+
/**
26+
* The $resource service is a factory for creating a resource class.
27+
*
28+
* @typedef {function(string, !Object=,
29+
* !Object.<string, angular.ResourceAction>=):angular.Resource}
30+
*/
31+
angular.$resource;
32+
33+
34+
35+
/**
36+
* A hash declaring a custom action that can extend the default set of resource
37+
* actions. Defined as an interface so Closure doesn't rename the properties.
38+
* @interface
39+
*/
40+
angular.ResourceAction = function() {};
41+
42+
43+
/**
44+
* HTTP request method. Valid methods are: GET, POST, PUT, DELETE, and JSONP
45+
* @type {string}
46+
*/
47+
angular.ResourceAction.prototype.method;
48+
49+
50+
/**
51+
* Optional set of pre-bound parameters for this action. If any of the
52+
* parameter value is a function, it will be executed every time when a param
53+
* value needs to be obtained for a request (unless the param was overridden).
54+
* @type {Object|undefined}
55+
*/
56+
angular.ResourceAction.prototype.params;
57+
58+
59+
/**
60+
* action specific url override. The url templating is supported just like for
61+
* the resource-level urls.
62+
* @type {string|undefined}
63+
*/
64+
angular.ResourceAction.prototype.url;
65+
66+
67+
/**
68+
* If true then the returned object for this action is an array, see returns
69+
* section.
70+
* @type {boolean|undefined}
71+
*/
72+
angular.ResourceAction.prototype.isArray;
73+
74+
75+
/**
76+
* transform function or an array of such functions. The transform function
77+
* takes the http request body and headers and returns its transformed
78+
* (typically serialized) version.
79+
* @type {function(Object, Object)|Array.<function(Object, Object)>|undefined}
80+
*/
81+
angular.ResourceAction.prototype.transformRequest;
82+
83+
84+
/**
85+
* transform function or an array of such functions. The transform function
86+
* takes the http response body and headers and returns its transformed
87+
* (typically deserialized) version.
88+
* @type {function(Object, Object)|Array.<function(Object, Object)>|undefined}
89+
*/
90+
angular.ResourceAction.prototype.transformResponse;
91+
92+
93+
/**
94+
* If true, a default $http cache will be used to cache the GET request,
95+
* otherwise if a cache instance built with $cacheFactory, this cache will be
96+
* used for caching.
97+
* @type {boolean|angular.$cacheFactory.Cache|undefined}
98+
*/
99+
angular.ResourceAction.prototype.cache;
100+
101+
102+
/**
103+
* timeout in milliseconds, or promise that should abort the request when
104+
* resolved.
105+
* @type {number|!angular.$q.Promise|undefined}
106+
*/
107+
angular.ResourceAction.prototype.timeout;
108+
109+
110+
/**
111+
* whether to set the withCredentials flag on the XHR object. See requests with
112+
* credentials for more information.
113+
* @type {boolean|undefined}
114+
*/
115+
angular.ResourceAction.prototype.withCredentials;
116+
117+
118+
/**
119+
* see requestType.
120+
* @type {string|undefined}
121+
*/
122+
angular.ResourceAction.prototype.responseType;
123+
124+
125+
/**
126+
* The interceptor object has two optional methods - response and
127+
* responseError. Both response and responseError interceptors get called
128+
* with http response object. See $http interceptors.
129+
* @type {Object|undefined}
130+
*/
131+
angular.ResourceAction.prototype.interceptor;
132+
133+
134+
/**
135+
* A Resource can be used as a constructor to create a ResourceInstance. It also
136+
* has other functions for getting or querying for instances. Example usage:
137+
*
138+
* var Pony = $resource('/ponies');
139+
* var pony = new Pony({name: 'Duke'});
140+
*
141+
* @typedef {function(new:angular.ResourceInstance, Object=)}
142+
*/
143+
angular.Resource;
144+
145+
146+
/**
147+
* Re-open the Resource type definition via an artificial target -- Resource_.
148+
* This lets us define functions on function objects, which is what Resource is.
149+
*
150+
* @type {angular.Resource}
151+
*/
152+
angular.Resource_;
153+
154+
155+
/**
156+
* Usage: resourceClass.get([parameters], [success], [error])
157+
*
158+
* @param {angular.Resource.ParamsOrCallback=} opt_paramsOrCallback
159+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
160+
* @param {angular.Resource.Errback=} opt_errback
161+
* @return {!angular.ResourceInstance} Empty resource instance.
162+
*/
163+
angular.Resource_.prototype.get = function(
164+
opt_paramsOrCallback,
165+
opt_callbackOrErrback,
166+
opt_errback) {};
167+
168+
169+
/**
170+
* Usage: resourceClass.query([parameters], [success], [error])
171+
*
172+
* @param {angular.Resource.ParamsOrCallback=} opt_paramsOrCallback
173+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
174+
* @param {angular.Resource.Errback=} opt_errback
175+
* @return {!Array.<!angular.ResourceInstance>} Empty array of instances.
176+
*/
177+
angular.Resource_.prototype.query = function(
178+
opt_paramsOrCallback,
179+
opt_callbackOrErrback,
180+
opt_errback) {};
181+
182+
183+
/**
184+
* Usage: resourceClass.save([parameters], postData, [success], [error])
185+
*
186+
* @param {!angular.Resource.ParamsDataOrCallback} paramsOrCallbackOrData
187+
* @param {angular.Resource.DataCallbackOrErrback=} opt_dataOrCallbackOrErrback
188+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
189+
* @param {angular.Resource.Errback=} opt_errback
190+
*/
191+
angular.Resource_.prototype.save = function(
192+
paramsOrCallbackOrData,
193+
opt_dataOrCallbackOrErrback,
194+
opt_callbackOrErrback,
195+
opt_errback) {};
196+
197+
198+
/**
199+
* Usage: resourceClass.remove([parameters], postData, [success], [error])
200+
*
201+
* @param {!angular.Resource.ParamsDataOrCallback} paramsOrCallbackOrData
202+
* @param {angular.Resource.DataCallbackOrErrback=} opt_dataOrCallbackOrErrback
203+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
204+
* @param {angular.Resource.Errback=} opt_errback
205+
*/
206+
angular.Resource_.prototype.remove = function(
207+
paramsOrCallbackOrData,
208+
opt_dataOrCallbackOrErrback,
209+
opt_callbackOrErrback,
210+
opt_errback) {};
211+
212+
213+
/**
214+
* Usage: resourceClass['delete']([parameters], postData, [success], [error])
215+
*
216+
* @param {!angular.Resource.ParamsDataOrCallback} paramsOrCallbackOrData
217+
* @param {angular.Resource.DataCallbackOrErrback=} opt_dataOrCallbackOrErrback
218+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
219+
* @param {angular.Resource.Errback=} opt_errback
220+
*/
221+
angular.Resource_.prototype['delete'] = function(
222+
paramsOrCallbackOrData,
223+
opt_dataOrCallbackOrErrback,
224+
opt_callbackOrErrback,
225+
opt_errback) {};
226+
227+
228+
/**
229+
* Data you want to send along with a POST xhr.
230+
* @typedef {Object|Array|angular.ResourceInstance}
231+
*/
232+
angular.Resource.PostData;
233+
234+
235+
/**
236+
* Callback when the resource is fetched. The first argument is the resource
237+
* instance or an array of resource instances.
238+
*
239+
* TODO(bourey): This can be cleaned up. The second argument is the header
240+
* getter function, which should really be defined in AngularJS externs.js.
241+
*
242+
* @typedef {function(!angular.ResourceInstanceOrCollection,
243+
* function(string=): (string|Object|null))}
244+
*/
245+
angular.Resource.Callback;
246+
247+
248+
/**
249+
* Errback when fetching resource failed. It is given the entire http response
250+
* object to play with.
251+
*
252+
* @typedef {function(!angular.$http.Response)}
253+
*/
254+
angular.Resource.Errback;
255+
256+
257+
/** @typedef {Object|angular.Resource.Callback} */
258+
angular.Resource.ParamsOrCallback;
259+
260+
261+
/** @typedef {angular.Resource.ParamsOrCallback|angular.Resource.PostData} */
262+
angular.Resource.ParamsDataOrCallback;
263+
264+
265+
/** @typedef {angular.Resource.PostData|angular.Resource.CallbackOrErrback} */
266+
angular.Resource.DataCallbackOrErrback;
267+
268+
269+
/** @typedef {angular.Resource.Callback|angular.Resource.Errback} */
270+
angular.Resource.CallbackOrErrback;
271+
272+
273+
/** @typedef {!angular.ResourceInstance|!Array.<!angular.ResourceInstance>} */
274+
angular.ResourceInstanceOrCollection;
275+
276+
277+
278+
/** @constructor */
279+
angular.ResourceInstance = function() {};
280+
281+
282+
/**
283+
* @type {!angular.$q.Promise}
284+
*/
285+
angular.ResourceInstance.prototype.$promise;
286+
287+
288+
/**
289+
* Usage: resource.$get([parameters], [success], [error])
290+
*
291+
* @param {angular.Resource.ParamsOrCallback=} opt_paramsOrCallback
292+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
293+
* @param {angular.Resource.Errback=} opt_errback
294+
*/
295+
angular.ResourceInstance.prototype.$get = function(
296+
opt_paramsOrCallback,
297+
opt_callbackOrErrback,
298+
opt_errback) {};
299+
300+
301+
/**
302+
* Usage: resource.$save([parameters], [success], [error])
303+
*
304+
* @param {angular.Resource.ParamsOrCallback=} opt_paramsOrCallback
305+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
306+
* @param {angular.Resource.Errback=} opt_errback
307+
*/
308+
angular.ResourceInstance.prototype.$save = function(
309+
opt_paramsOrCallback,
310+
opt_callbackOrErrback,
311+
opt_errback) {};
312+
313+
314+
/**
315+
* Usage: resource.$remove([parameters], [success], [error])
316+
*
317+
* @param {angular.Resource.ParamsOrCallback=} opt_paramsOrCallback
318+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
319+
* @param {angular.Resource.Errback=} opt_errback
320+
*/
321+
angular.ResourceInstance.prototype.$remove = function(
322+
opt_paramsOrCallback,
323+
opt_callbackOrErrback,
324+
opt_errback) {};
325+
326+
327+
/**
328+
* Usage: resource.$delete([parameters], [success], [error])
329+
*
330+
* @param {angular.Resource.ParamsOrCallback=} opt_paramsOrCallback
331+
* @param {angular.Resource.CallbackOrErrback=} opt_callbackOrErrback
332+
* @param {angular.Resource.Errback=} opt_errback
333+
*/
334+
angular.ResourceInstance.prototype.$delete = function(
335+
opt_paramsOrCallback,
336+
opt_callbackOrErrback,
337+
opt_errback) {};

0 commit comments

Comments
 (0)