@angular-wave/angular.ts 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/package.json +1 -1
- package/src/core/root-scope.js +81 -36
- package/src/core/timeout.js +1 -1
- package/src/directive/input.js +1 -1
- package/src/router/services.js +0 -1
- package/src/services/browser.js +3 -3
- package/test/core/parse.spec.js +13 -0
- package/test/core/scope.spec.js +8 -8
- package/test/core/timeout.spec.js +1 -1
- package/types/index.d.ts +57 -45
- package/types/router/index.d.ts +0 -1
- package/types/router/interface.d.ts +0 -1
- package/types/router/legacy/resolveService.d.ts +0 -1
- package/types/router/legacy/stateEvents.d.ts +2 -1
- package/types/router/stateFilters.d.ts +0 -1
- package/types/router/stateProvider.d.ts +0 -1
- package/types/router/statebuilders/onEnterExitRetain.d.ts +0 -1
- package/types/router/locationServices.d.ts +0 -50
package/package.json
CHANGED
package/src/core/root-scope.js
CHANGED
|
@@ -21,6 +21,13 @@ export const ScopePhase = {
|
|
|
21
21
|
DIGEST: 2,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {Object} AsyncQueueTask
|
|
26
|
+
* @property {Scope} scope
|
|
27
|
+
* @property {Function} fn
|
|
28
|
+
* @property {Object} locals
|
|
29
|
+
*/
|
|
30
|
+
|
|
24
31
|
/**
|
|
25
32
|
*
|
|
26
33
|
* The default number of `$digest` iterations the scope should attempt to execute before giving up and
|
|
@@ -34,6 +41,8 @@ export const ScopePhase = {
|
|
|
34
41
|
export const TTL = 10;
|
|
35
42
|
|
|
36
43
|
const $rootScopeMinErr = minErr("$rootScope");
|
|
44
|
+
|
|
45
|
+
/** @type {AsyncQueueTask[]} */
|
|
37
46
|
const $$asyncQueue = [];
|
|
38
47
|
const $$postDigestQueue = [];
|
|
39
48
|
const $$applyAsyncQueue = [];
|
|
@@ -122,9 +131,9 @@ export function getQueues() {
|
|
|
122
131
|
};
|
|
123
132
|
}
|
|
124
133
|
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
// /**
|
|
135
|
+
// * @type {angular.Scope}
|
|
136
|
+
// */
|
|
128
137
|
class Scope {
|
|
129
138
|
constructor() {
|
|
130
139
|
/**
|
|
@@ -136,35 +145,68 @@ class Scope {
|
|
|
136
145
|
this.$$phase = ScopePhase.NONE;
|
|
137
146
|
|
|
138
147
|
/**
|
|
139
|
-
* @type {?
|
|
148
|
+
* @type {?Scope} Reference to the parent scope.
|
|
140
149
|
*/
|
|
141
150
|
this.$parent = null;
|
|
142
151
|
|
|
143
152
|
/**
|
|
144
|
-
* @type {?
|
|
153
|
+
* @type {?Scope}
|
|
145
154
|
*/
|
|
146
155
|
this.$root = this;
|
|
147
156
|
|
|
148
|
-
|
|
157
|
+
/** @type {Array} */
|
|
158
|
+
this.$$watchers = [];
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @type {number}
|
|
162
|
+
*/
|
|
163
|
+
this.$$digestWatchIndex = -1;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @type {?Scope}
|
|
167
|
+
*/
|
|
149
168
|
this.$$nextSibling = null;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @type {?Scope}
|
|
172
|
+
*/
|
|
150
173
|
this.$$prevSibling = null;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @type {?Scope}
|
|
177
|
+
*/
|
|
151
178
|
this.$$childHead = null;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @type {?Scope}
|
|
182
|
+
*/
|
|
152
183
|
this.$$childTail = null;
|
|
184
|
+
|
|
185
|
+
/** @type {boolean} */
|
|
153
186
|
this.$$destroyed = false;
|
|
187
|
+
|
|
188
|
+
// TODO use maps
|
|
189
|
+
/** @type {boolean} */
|
|
154
190
|
this.$$suspended = false;
|
|
191
|
+
|
|
192
|
+
// TODO use maps
|
|
193
|
+
/** @type {object} */
|
|
155
194
|
this.$$listeners = {};
|
|
195
|
+
|
|
196
|
+
/** @type {object} */
|
|
156
197
|
this.$$listenerCount = {};
|
|
198
|
+
|
|
199
|
+
/** @type {number} */
|
|
157
200
|
this.$$watchersCount = 0;
|
|
158
201
|
this.$$isolateBindings = null;
|
|
159
202
|
|
|
160
203
|
/**
|
|
161
|
-
* @type {Scope}
|
|
204
|
+
* @type {?Scope}
|
|
162
205
|
*/
|
|
163
206
|
this.$$ChildScope = null;
|
|
164
207
|
}
|
|
165
208
|
|
|
166
209
|
/**
|
|
167
|
-
* @description
|
|
168
210
|
* Creates a new child {@link Scope}.
|
|
169
211
|
*
|
|
170
212
|
* The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.
|
|
@@ -179,24 +221,25 @@ class Scope {
|
|
|
179
221
|
* When creating widgets, it is useful for the widget to not accidentally read parent
|
|
180
222
|
* state.
|
|
181
223
|
*
|
|
182
|
-
* @param {?
|
|
224
|
+
* @param {?Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
|
|
183
225
|
* of the newly created scope. Defaults to `this` scope if not provided.
|
|
184
226
|
* This is used when creating a transclude scope to correctly place it
|
|
185
227
|
* in the scope hierarchy while maintaining the correct prototypical
|
|
186
228
|
* inheritance.
|
|
187
229
|
*
|
|
188
|
-
* @returns {
|
|
230
|
+
* @returns {Scope} The newly created child scope.
|
|
189
231
|
*
|
|
190
232
|
*/
|
|
191
233
|
$new(isolate, parent) {
|
|
234
|
+
/** @type {Scope} */
|
|
192
235
|
let child;
|
|
193
236
|
if (isolate) {
|
|
194
237
|
child = new Scope();
|
|
195
|
-
child.$root =
|
|
238
|
+
child.$root = rootScope;
|
|
196
239
|
} else {
|
|
197
240
|
child = Object.create(this);
|
|
198
241
|
child.$id = nextUid();
|
|
199
|
-
child.$$watchers =
|
|
242
|
+
child.$$watchers = [];
|
|
200
243
|
child.$$nextSibling = null;
|
|
201
244
|
child.$$childHead = null;
|
|
202
245
|
child.$$childTail = null;
|
|
@@ -206,6 +249,7 @@ class Scope {
|
|
|
206
249
|
child.$$ChildScope = null;
|
|
207
250
|
child.$$suspended = false;
|
|
208
251
|
}
|
|
252
|
+
|
|
209
253
|
child.$parent = parent || this;
|
|
210
254
|
child.$$prevSibling = child.$parent.$$childTail;
|
|
211
255
|
if (child.$parent.$$childHead) {
|
|
@@ -222,9 +266,13 @@ class Scope {
|
|
|
222
266
|
// when the parent scope is destroyed.
|
|
223
267
|
// The listener needs to be added after the parent is set
|
|
224
268
|
if (isolate || parent !== this) {
|
|
225
|
-
child.$on(
|
|
226
|
-
$
|
|
227
|
-
|
|
269
|
+
child.$on(
|
|
270
|
+
"$destroy",
|
|
271
|
+
/** @param {angular.IAngularEvent} $event */
|
|
272
|
+
($event) => {
|
|
273
|
+
$event.currentScope.$$destroyed = true;
|
|
274
|
+
},
|
|
275
|
+
);
|
|
228
276
|
}
|
|
229
277
|
return child;
|
|
230
278
|
}
|
|
@@ -352,8 +400,7 @@ class Scope {
|
|
|
352
400
|
if (get.$$watchDelegate) {
|
|
353
401
|
return get.$$watchDelegate(this, fn, objectEquality, get, watchExp);
|
|
354
402
|
}
|
|
355
|
-
|
|
356
|
-
let array = scope.$$watchers;
|
|
403
|
+
|
|
357
404
|
const watcher = {
|
|
358
405
|
fn,
|
|
359
406
|
last: initWatchVal,
|
|
@@ -364,23 +411,21 @@ class Scope {
|
|
|
364
411
|
|
|
365
412
|
lastDirtyWatch = null;
|
|
366
413
|
|
|
367
|
-
if (
|
|
368
|
-
|
|
369
|
-
array.$$digestWatchIndex = -1;
|
|
414
|
+
if (this.$$watchers.length == 0) {
|
|
415
|
+
this.$$digestWatchIndex = -1;
|
|
370
416
|
}
|
|
371
417
|
// we use unshift since we use a while loop in $digest for speed.
|
|
372
418
|
// the while loop reads in reverse order.
|
|
373
|
-
|
|
374
|
-
|
|
419
|
+
this.$$watchers.unshift(watcher);
|
|
420
|
+
this.$$digestWatchIndex++;
|
|
375
421
|
this.incrementWatchersCount(1);
|
|
376
|
-
const self = this;
|
|
377
422
|
|
|
378
|
-
return
|
|
379
|
-
const index = arrayRemove(
|
|
423
|
+
return () => {
|
|
424
|
+
const index = arrayRemove(this.$$watchers, watcher);
|
|
380
425
|
if (index >= 0) {
|
|
381
|
-
|
|
382
|
-
if (index <
|
|
383
|
-
|
|
426
|
+
this.incrementWatchersCount(-1);
|
|
427
|
+
if (index < this.$$digestWatchIndex) {
|
|
428
|
+
this.$$digestWatchIndex--;
|
|
384
429
|
}
|
|
385
430
|
}
|
|
386
431
|
lastDirtyWatch = null;
|
|
@@ -715,7 +760,7 @@ class Scope {
|
|
|
715
760
|
let ttl = TTL;
|
|
716
761
|
let next;
|
|
717
762
|
/**
|
|
718
|
-
* @type {
|
|
763
|
+
* @type {Scope}
|
|
719
764
|
*/
|
|
720
765
|
let current;
|
|
721
766
|
const target = $$asyncQueue.length ? this.$root : this;
|
|
@@ -731,7 +776,7 @@ class Scope {
|
|
|
731
776
|
if (this === this.$root && applyAsyncId !== null) {
|
|
732
777
|
// If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then
|
|
733
778
|
// cancel the scheduled $apply and flush the queue of expressions to be evaluated.
|
|
734
|
-
$browser.
|
|
779
|
+
$browser.cancel(applyAsyncId);
|
|
735
780
|
flushApplyAsync();
|
|
736
781
|
applyAsyncId = null;
|
|
737
782
|
}
|
|
@@ -765,10 +810,10 @@ class Scope {
|
|
|
765
810
|
// "traverse the scopes" loop
|
|
766
811
|
if ((watchers = !current.$$suspended && current.$$watchers)) {
|
|
767
812
|
// process our watches
|
|
768
|
-
|
|
769
|
-
while (
|
|
813
|
+
current.$$digestWatchIndex = watchers.length;
|
|
814
|
+
while (current.$$digestWatchIndex--) {
|
|
770
815
|
try {
|
|
771
|
-
watch = watchers[
|
|
816
|
+
watch = watchers[current.$$digestWatchIndex];
|
|
772
817
|
// Most common watches are on primitives, in which case we can short
|
|
773
818
|
// circuit it with === operator, only when === fails do we use .equals
|
|
774
819
|
if (watch) {
|
|
@@ -1072,7 +1117,7 @@ class Scope {
|
|
|
1072
1117
|
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
|
|
1073
1118
|
* ```
|
|
1074
1119
|
*
|
|
1075
|
-
* @param {
|
|
1120
|
+
* @param {string|function(Scope): any} [expr] An AngularJS expression to be executed.
|
|
1076
1121
|
*
|
|
1077
1122
|
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
|
|
1078
1123
|
* - `function(scope)`: execute the function with the current `scope` parameter.
|
|
@@ -1180,7 +1225,7 @@ class Scope {
|
|
|
1180
1225
|
* expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
|
|
1181
1226
|
*
|
|
1182
1227
|
*
|
|
1183
|
-
* @param {
|
|
1228
|
+
* @param {string|function(Scope): any} [expr] An AngularJS expression to be executed.
|
|
1184
1229
|
*
|
|
1185
1230
|
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
|
|
1186
1231
|
* - `function(scope)`: execute the function with current `scope` parameter.
|
|
@@ -1261,7 +1306,7 @@ class Scope {
|
|
|
1261
1306
|
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
|
|
1262
1307
|
*
|
|
1263
1308
|
* @param {string} name Event name to listen on.
|
|
1264
|
-
* @param {function(
|
|
1309
|
+
* @param {function(angular.IAngularEvent): any} listener Function to call when the event is emitted.
|
|
1265
1310
|
* @returns {function()} Returns a deregistration function for this listener.
|
|
1266
1311
|
*/
|
|
1267
1312
|
$on(name, listener) {
|
package/src/core/timeout.js
CHANGED
package/src/directive/input.js
CHANGED
package/src/router/services.js
CHANGED
package/src/services/browser.js
CHANGED
|
@@ -243,7 +243,7 @@ export function Browser($log, $$taskTrackerFactory) {
|
|
|
243
243
|
* @param {function()} fn A function, who's execution should be deferred.
|
|
244
244
|
* @param {number=} [delay=0] Number of milliseconds to defer the function execution.
|
|
245
245
|
* @param {string=} [taskType=DEFAULT_TASK_TYPE] The type of task that is deferred.
|
|
246
|
-
* @returns {*} DeferId that can be used to cancel the task via `$browser.
|
|
246
|
+
* @returns {*} DeferId that can be used to cancel the task via `$browser.cancel()`.
|
|
247
247
|
*
|
|
248
248
|
* @description
|
|
249
249
|
* Executes a fn asynchronously via `setTimeout(fn, delay)`.
|
|
@@ -270,7 +270,7 @@ export function Browser($log, $$taskTrackerFactory) {
|
|
|
270
270
|
};
|
|
271
271
|
|
|
272
272
|
/**
|
|
273
|
-
* @name $browser#
|
|
273
|
+
* @name $browser#cancel
|
|
274
274
|
*
|
|
275
275
|
* @description
|
|
276
276
|
* Cancels a deferred task identified with `deferId`.
|
|
@@ -279,7 +279,7 @@ export function Browser($log, $$taskTrackerFactory) {
|
|
|
279
279
|
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
|
|
280
280
|
* canceled.
|
|
281
281
|
*/
|
|
282
|
-
self.
|
|
282
|
+
self.cancel = function (deferId) {
|
|
283
283
|
if (Object.prototype.hasOwnProperty.call(pendingDeferIds, deferId)) {
|
|
284
284
|
const taskType = pendingDeferIds[deferId];
|
|
285
285
|
delete pendingDeferIds[deferId];
|
package/test/core/parse.spec.js
CHANGED
|
@@ -3486,6 +3486,19 @@ describe("parser", () => {
|
|
|
3486
3486
|
});
|
|
3487
3487
|
|
|
3488
3488
|
describe("with primitive input", () => {
|
|
3489
|
+
beforeEach(() => {
|
|
3490
|
+
createInjector([
|
|
3491
|
+
"ng",
|
|
3492
|
+
function ($filterProvider) {
|
|
3493
|
+
filterProvider = $filterProvider;
|
|
3494
|
+
},
|
|
3495
|
+
]).invoke((_$rootScope_, _$parse_) => {
|
|
3496
|
+
scope = _$rootScope_;
|
|
3497
|
+
$parse = _$parse_;
|
|
3498
|
+
});
|
|
3499
|
+
logs = [];
|
|
3500
|
+
});
|
|
3501
|
+
|
|
3489
3502
|
it("should not be reevaluated when passed literals", () => {
|
|
3490
3503
|
let filterCalls = 0;
|
|
3491
3504
|
filterProvider.register(
|
package/test/core/scope.spec.js
CHANGED
|
@@ -2630,7 +2630,7 @@ describe("Scope", function () {
|
|
|
2630
2630
|
const scope = $rootScope.$new();
|
|
2631
2631
|
let id = scope.$applyAsync('x = "CODE ORANGE"');
|
|
2632
2632
|
|
|
2633
|
-
$browser.
|
|
2633
|
+
$browser.cancel(id);
|
|
2634
2634
|
setTimeout(() => {
|
|
2635
2635
|
expect(scope.x).toBe("CODE ORANGE");
|
|
2636
2636
|
expect($rootScope.x).toBeUndefined();
|
|
@@ -2644,8 +2644,8 @@ describe("Scope", function () {
|
|
|
2644
2644
|
let id1 = $rootScope.$applyAsync('x.push("expr1")');
|
|
2645
2645
|
let id2 = $rootScope.$applyAsync('x.push("expr2")');
|
|
2646
2646
|
|
|
2647
|
-
$browser.
|
|
2648
|
-
$browser.
|
|
2647
|
+
$browser.cancel(id1);
|
|
2648
|
+
$browser.cancel(id2);
|
|
2649
2649
|
setTimeout(() => {
|
|
2650
2650
|
expect($rootScope.x).toEqual(["expr1", "expr2"]);
|
|
2651
2651
|
});
|
|
@@ -2660,7 +2660,7 @@ describe("Scope", function () {
|
|
|
2660
2660
|
expect($browser.deferredFns.length).toBe(0);
|
|
2661
2661
|
});
|
|
2662
2662
|
|
|
2663
|
-
$browser.
|
|
2663
|
+
$browser.cancel(id);
|
|
2664
2664
|
setTimeout(() => {
|
|
2665
2665
|
expect($rootScope.x).toEqual(["expr1", "expr2"]);
|
|
2666
2666
|
});
|
|
@@ -2672,7 +2672,7 @@ describe("Scope", function () {
|
|
|
2672
2672
|
throw "OOPS";
|
|
2673
2673
|
});
|
|
2674
2674
|
|
|
2675
|
-
$browser.
|
|
2675
|
+
$browser.cancel(id);
|
|
2676
2676
|
expect(logs).toEqual([]);
|
|
2677
2677
|
setTimeout(() => expect(logs[0]).toEqual("OOPS"));
|
|
2678
2678
|
});
|
|
@@ -2683,14 +2683,14 @@ describe("Scope", function () {
|
|
|
2683
2683
|
});
|
|
2684
2684
|
let id2 = $rootScope.$applyAsync('x = "All good!"');
|
|
2685
2685
|
|
|
2686
|
-
$browser.
|
|
2687
|
-
$browser.
|
|
2686
|
+
$browser.cancel(id);
|
|
2687
|
+
$browser.cancel(id2);
|
|
2688
2688
|
setTimeout(() => expect($rootScope.x).toBe("All good!"));
|
|
2689
2689
|
expect($rootScope.x).toBeUndefined();
|
|
2690
2690
|
});
|
|
2691
2691
|
|
|
2692
2692
|
it("should be cancelled if a $rootScope digest occurs before the next tick", () => {
|
|
2693
|
-
const cancel = spyOn($browser
|
|
2693
|
+
const cancel = spyOn($browser, "cancel").and.callThrough();
|
|
2694
2694
|
const expression = jasmine.createSpy("expr");
|
|
2695
2695
|
|
|
2696
2696
|
$rootScope.$applyAsync(expression);
|
|
@@ -325,7 +325,7 @@ describe("$timeout", () => {
|
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
it("should forget references to relevant deferred", () => {
|
|
328
|
-
// $browser.
|
|
328
|
+
// $browser.cancel is only called on cancel if the deferred object is still referenced
|
|
329
329
|
const cancelSpy = spyOn($browser.defer, "cancel").and.callThrough();
|
|
330
330
|
|
|
331
331
|
const promise = $timeout(() => {}, 0, false);
|
package/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export as namespace ng;
|
|
|
16
16
|
export = angular;
|
|
17
17
|
|
|
18
18
|
import ng = angular;
|
|
19
|
+
import { Obj } from "./router";
|
|
19
20
|
|
|
20
21
|
///////////////////////////////////////////////////////////////////////////////
|
|
21
22
|
// ng module (angular.js)
|
|
@@ -104,7 +105,7 @@ declare namespace angular {
|
|
|
104
105
|
* @param directiveFactory An injectable directive factory function.
|
|
105
106
|
*/
|
|
106
107
|
directive<
|
|
107
|
-
TScope extends
|
|
108
|
+
TScope extends Scope = Scope,
|
|
108
109
|
TElement extends JQLite = JQLite,
|
|
109
110
|
TAttributes extends IAttributes = IAttributes,
|
|
110
111
|
TController extends IDirectiveController = IController,
|
|
@@ -115,7 +116,7 @@ declare namespace angular {
|
|
|
115
116
|
>,
|
|
116
117
|
): IModule;
|
|
117
118
|
directive<
|
|
118
|
-
TScope extends
|
|
119
|
+
TScope extends Scope = Scope,
|
|
119
120
|
TElement extends JQLite = JQLite,
|
|
120
121
|
TAttributes extends IAttributes = IAttributes,
|
|
121
122
|
TController extends IDirectiveController = IController,
|
|
@@ -380,14 +381,34 @@ declare namespace angular {
|
|
|
380
381
|
* $rootScope - $rootScopeProvider - service in module ng
|
|
381
382
|
* see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
|
|
382
383
|
*/
|
|
383
|
-
|
|
384
|
+
class Scope {
|
|
385
|
+
$id: number;
|
|
386
|
+
$parent: Scope | null;
|
|
387
|
+
$root: Scope | null;
|
|
388
|
+
$$destroyed: boolean;
|
|
389
|
+
$$isolateBindings: any;
|
|
390
|
+
$$phase: any;
|
|
391
|
+
|
|
392
|
+
private $$watches: Array<any>;
|
|
393
|
+
private $$nextSibling: Scope | null;
|
|
394
|
+
private $$prevSibling: Scope | null;
|
|
395
|
+
private $$childHead: Scope | null;
|
|
396
|
+
private $$childTail: Scope | null;
|
|
397
|
+
private $$ChildScope: Scope | null;
|
|
398
|
+
private $$watchersCount: number;
|
|
399
|
+
private $$digestWatchIndex: number;
|
|
400
|
+
private $$suspended: boolean;
|
|
401
|
+
|
|
402
|
+
private $$listeners: Object;
|
|
403
|
+
private $$listenerCount: Object;
|
|
404
|
+
|
|
384
405
|
$apply(): any;
|
|
385
|
-
$apply(
|
|
386
|
-
$apply(
|
|
406
|
+
$apply(expr: string): any;
|
|
407
|
+
$apply(expr: (scope: Scope) => any): any;
|
|
387
408
|
|
|
388
409
|
$applyAsync(): any;
|
|
389
410
|
$applyAsync(exp: string): any;
|
|
390
|
-
$applyAsync(exp: (scope:
|
|
411
|
+
$applyAsync(exp: (scope: Scope) => any): any;
|
|
391
412
|
|
|
392
413
|
/**
|
|
393
414
|
* Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners.
|
|
@@ -486,14 +507,14 @@ declare namespace angular {
|
|
|
486
507
|
|
|
487
508
|
$eval(): any;
|
|
488
509
|
$eval(expression: string, locals?: Object): any;
|
|
489
|
-
$eval(expression: (scope:
|
|
510
|
+
$eval(expression: (scope: Scope) => any, locals?: Object): any;
|
|
490
511
|
|
|
491
512
|
$evalAsync(): void;
|
|
492
513
|
$evalAsync(expression: string, locals?: Object): void;
|
|
493
|
-
$evalAsync(expression: (scope:
|
|
514
|
+
$evalAsync(expression: (scope: Scope) => void, locals?: Object): void;
|
|
494
515
|
|
|
495
516
|
// Defaults to false by the implementation checking strategy
|
|
496
|
-
$new(isolate?: boolean, parent?:
|
|
517
|
+
$new(isolate?: boolean, parent?: Scope): Scope;
|
|
497
518
|
|
|
498
519
|
/**
|
|
499
520
|
* Listens on events of a given type. See $emit for discussion of event life cycle.
|
|
@@ -515,55 +536,46 @@ declare namespace angular {
|
|
|
515
536
|
): () => void;
|
|
516
537
|
$watch<T>(
|
|
517
538
|
watchExpression: string,
|
|
518
|
-
listener?: (newValue: T, oldValue: T, scope:
|
|
539
|
+
listener?: (newValue: T, oldValue: T, scope: Scope) => any,
|
|
519
540
|
objectEquality?: boolean,
|
|
520
541
|
): () => void;
|
|
521
542
|
$watch(
|
|
522
|
-
watchExpression: (scope:
|
|
543
|
+
watchExpression: (scope: Scope) => any,
|
|
523
544
|
listener?: string,
|
|
524
545
|
objectEquality?: boolean,
|
|
525
546
|
): () => void;
|
|
526
547
|
$watch<T>(
|
|
527
|
-
watchExpression: (scope:
|
|
528
|
-
listener?: (newValue: T, oldValue: T, scope:
|
|
548
|
+
watchExpression: (scope: Scope) => T,
|
|
549
|
+
listener?: (newValue: T, oldValue: T, scope: Scope) => any,
|
|
529
550
|
objectEquality?: boolean,
|
|
530
551
|
): () => void;
|
|
531
552
|
|
|
532
553
|
$watchCollection<T>(
|
|
533
554
|
watchExpression: string,
|
|
534
|
-
listener: (newValue: T, oldValue: T, scope:
|
|
555
|
+
listener: (newValue: T, oldValue: T, scope: Scope) => any,
|
|
535
556
|
): () => void;
|
|
536
557
|
$watchCollection<T>(
|
|
537
|
-
watchExpression: (scope:
|
|
538
|
-
listener: (newValue: T, oldValue: T, scope:
|
|
558
|
+
watchExpression: (scope: Scope) => T,
|
|
559
|
+
listener: (newValue: T, oldValue: T, scope: Scope) => any,
|
|
539
560
|
): () => void;
|
|
540
561
|
|
|
541
562
|
$watchGroup(
|
|
542
563
|
watchExpressions: any[],
|
|
543
|
-
listener: (newValue: any, oldValue: any, scope:
|
|
564
|
+
listener: (newValue: any, oldValue: any, scope: Scope) => any,
|
|
544
565
|
): () => void;
|
|
545
566
|
$watchGroup(
|
|
546
|
-
watchExpressions: Array<{ (scope:
|
|
547
|
-
listener: (newValue: any, oldValue: any, scope:
|
|
567
|
+
watchExpressions: Array<{ (scope: Scope): any }>,
|
|
568
|
+
listener: (newValue: any, oldValue: any, scope: Scope) => any,
|
|
548
569
|
): () => void;
|
|
549
|
-
|
|
550
|
-
$parent: IScope;
|
|
551
|
-
$root: IScope;
|
|
552
|
-
$id: number;
|
|
553
|
-
|
|
554
|
-
// Hidden members
|
|
555
|
-
$$isolateBindings: any;
|
|
556
|
-
$$phase: any;
|
|
557
|
-
$$destroyed: boolean;
|
|
558
570
|
}
|
|
559
571
|
|
|
560
|
-
interface IRootScopeService extends
|
|
572
|
+
interface IRootScopeService extends Scope {}
|
|
561
573
|
|
|
562
574
|
/**
|
|
563
575
|
* $scope for ngRepeat directive.
|
|
564
576
|
* see https://docs.angularjs.org/api/ng/directive/ngRepeat
|
|
565
577
|
*/
|
|
566
|
-
interface IRepeatScope extends
|
|
578
|
+
interface IRepeatScope extends Scope {
|
|
567
579
|
/**
|
|
568
580
|
* iterator offset of the repeated element (0..length-1).
|
|
569
581
|
*/
|
|
@@ -599,11 +611,11 @@ declare namespace angular {
|
|
|
599
611
|
/**
|
|
600
612
|
* the scope on which the event was $emit-ed or $broadcast-ed.
|
|
601
613
|
*/
|
|
602
|
-
targetScope:
|
|
614
|
+
targetScope: Scope;
|
|
603
615
|
/**
|
|
604
616
|
* the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null.
|
|
605
617
|
*/
|
|
606
|
-
currentScope:
|
|
618
|
+
currentScope: Scope;
|
|
607
619
|
/**
|
|
608
620
|
* name of the event.
|
|
609
621
|
*/
|
|
@@ -913,8 +925,8 @@ declare namespace angular {
|
|
|
913
925
|
///////////////////////////////////////////////////////////////////////////
|
|
914
926
|
interface IParseService {
|
|
915
927
|
(
|
|
916
|
-
expression: string,
|
|
917
|
-
interceptorFn?: (value: any, scope:
|
|
928
|
+
expression: string | ((scope: Scope) => any),
|
|
929
|
+
interceptorFn?: (value: any, scope: Scope, locals: any) => any,
|
|
918
930
|
expensiveChecks?: boolean,
|
|
919
931
|
): ICompiledExpression;
|
|
920
932
|
}
|
|
@@ -1457,7 +1469,7 @@ declare namespace angular {
|
|
|
1457
1469
|
|
|
1458
1470
|
interface ICompileProvider extends IServiceProvider {
|
|
1459
1471
|
directive<
|
|
1460
|
-
TScope extends
|
|
1472
|
+
TScope extends Scope = Scope,
|
|
1461
1473
|
TElement extends JQLite = JQLite,
|
|
1462
1474
|
TAttributes extends IAttributes = IAttributes,
|
|
1463
1475
|
TController extends IDirectiveController = IController,
|
|
@@ -1468,7 +1480,7 @@ declare namespace angular {
|
|
|
1468
1480
|
>,
|
|
1469
1481
|
): ICompileProvider;
|
|
1470
1482
|
directive<
|
|
1471
|
-
TScope extends
|
|
1483
|
+
TScope extends Scope = Scope,
|
|
1472
1484
|
TElement extends JQLite = JQLite,
|
|
1473
1485
|
TAttributes extends IAttributes = IAttributes,
|
|
1474
1486
|
TController extends IDirectiveController = IController,
|
|
@@ -1543,13 +1555,13 @@ declare namespace angular {
|
|
|
1543
1555
|
|
|
1544
1556
|
interface ICloneAttachFunction {
|
|
1545
1557
|
// Let's hint but not force cloneAttachFn's signature
|
|
1546
|
-
(clonedElement?: JQLite, scope?:
|
|
1558
|
+
(clonedElement?: JQLite, scope?: Scope): any;
|
|
1547
1559
|
}
|
|
1548
1560
|
|
|
1549
1561
|
// This corresponds to the "publicLinkFn" returned by $compile.
|
|
1550
1562
|
interface ITemplateLinkingFunction {
|
|
1551
1563
|
(
|
|
1552
|
-
scope:
|
|
1564
|
+
scope: Scope,
|
|
1553
1565
|
cloneAttachFn?: ICloneAttachFunction,
|
|
1554
1566
|
options?: ITemplateLinkingFunctionOptions,
|
|
1555
1567
|
): JQLite;
|
|
@@ -1573,7 +1585,7 @@ declare namespace angular {
|
|
|
1573
1585
|
interface ITranscludeFunction {
|
|
1574
1586
|
// If the scope is provided, then the cloneAttachFn must be as well.
|
|
1575
1587
|
(
|
|
1576
|
-
scope:
|
|
1588
|
+
scope: Scope,
|
|
1577
1589
|
cloneAttachFn: ICloneAttachFunction,
|
|
1578
1590
|
futureParentElement?: JQLite,
|
|
1579
1591
|
slotName?: string,
|
|
@@ -1601,7 +1613,7 @@ declare namespace angular {
|
|
|
1601
1613
|
* The minimal local definitions required by $controller(ctrl, locals) calls.
|
|
1602
1614
|
*/
|
|
1603
1615
|
interface IControllerLocals {
|
|
1604
|
-
$scope: ng.
|
|
1616
|
+
$scope: ng.Scope;
|
|
1605
1617
|
$element: JQLite;
|
|
1606
1618
|
}
|
|
1607
1619
|
|
|
@@ -2268,7 +2280,7 @@ declare namespace angular {
|
|
|
2268
2280
|
| { [key: string]: IController };
|
|
2269
2281
|
|
|
2270
2282
|
interface IDirectiveFactory<
|
|
2271
|
-
TScope extends
|
|
2283
|
+
TScope extends Scope = Scope,
|
|
2272
2284
|
TElement extends JQLite = JQLite,
|
|
2273
2285
|
TAttributes extends IAttributes = IAttributes,
|
|
2274
2286
|
TController extends IDirectiveController = IController,
|
|
@@ -2281,7 +2293,7 @@ declare namespace angular {
|
|
|
2281
2293
|
}
|
|
2282
2294
|
|
|
2283
2295
|
interface IDirectiveLinkFn<
|
|
2284
|
-
TScope extends
|
|
2296
|
+
TScope extends Scope = Scope,
|
|
2285
2297
|
TElement extends JQLite = JQLite,
|
|
2286
2298
|
TAttributes extends IAttributes = IAttributes,
|
|
2287
2299
|
TController extends IDirectiveController = IController,
|
|
@@ -2296,7 +2308,7 @@ declare namespace angular {
|
|
|
2296
2308
|
}
|
|
2297
2309
|
|
|
2298
2310
|
interface IDirectivePrePost<
|
|
2299
|
-
TScope extends
|
|
2311
|
+
TScope extends Scope = Scope,
|
|
2300
2312
|
TElement extends JQLite = JQLite,
|
|
2301
2313
|
TAttributes extends IAttributes = IAttributes,
|
|
2302
2314
|
TController extends IDirectiveController = IController,
|
|
@@ -2310,7 +2322,7 @@ declare namespace angular {
|
|
|
2310
2322
|
}
|
|
2311
2323
|
|
|
2312
2324
|
interface IDirectiveCompileFn<
|
|
2313
|
-
TScope extends
|
|
2325
|
+
TScope extends Scope = Scope,
|
|
2314
2326
|
TElement extends JQLite = JQLite,
|
|
2315
2327
|
TAttributes extends IAttributes = IAttributes,
|
|
2316
2328
|
TController extends IDirectiveController = IController,
|
|
@@ -2332,7 +2344,7 @@ declare namespace angular {
|
|
|
2332
2344
|
}
|
|
2333
2345
|
|
|
2334
2346
|
interface IDirective<
|
|
2335
|
-
TScope extends
|
|
2347
|
+
TScope extends Scope = Scope,
|
|
2336
2348
|
TElement extends JQLite = JQLite,
|
|
2337
2349
|
TAttributes extends IAttributes = IAttributes,
|
|
2338
2350
|
TController extends IDirectiveController = IController,
|