Skip to content

Commit 924ebaf

Browse files
committed
Remove unused template request watcher
1 parent 76b96aa commit 924ebaf

File tree

3 files changed

+3
-40
lines changed

3 files changed

+3
-40
lines changed

@types/animations/queue/animate-queue.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export class AnimateQueueProvider {
1212
$rootScope: ng.RootScopeService,
1313
$injector: ng.InjectorService,
1414
$$animation: any,
15-
$templateRequest: ng.TemplateRequestService,
1615
) => import("../queue/interface.ts").AnimateQueueService)
1716
)[];
1817
}

src/animations/queue/animate-queue.js

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,18 @@ export function AnimateQueueProvider($animateProvider) {
159159
$t.$rootScope,
160160
$t.$injector,
161161
$t.$$animation,
162-
$t.$templateRequest,
163162
/**
164163
*
165164
* @param {ng.RootScopeService} $rootScope
166165
* @param {ng.InjectorService} $injector
167166
* @param {*} $$animation
168-
* @param {ng.TemplateRequestService} $templateRequest
169167
* @returns {import("../queue/interface.ts").AnimateQueueService}
170168
*/
171-
function ($rootScope, $injector, $$animation, $templateRequest) {
169+
function ($rootScope, $injector, $$animation) {
172170
const activeAnimationsLookup = new Map();
173171

174172
const disabledElementsLookup = new Map();
175173

176-
let animationsEnabled = null;
177-
178174
function postDigestTaskFactory() {
179175
let postDigestCalled = false;
180176

@@ -194,38 +190,6 @@ export function AnimateQueueProvider($animateProvider) {
194190
};
195191
}
196192

197-
// Wait until all directive and route-related templates are downloaded and
198-
// compiled. The $templateRequest.totalPendingRequests variable keeps track of
199-
// all of the remote templates being currently downloaded. If there are no
200-
// templates currently downloading then the watcher will still fire anyway.
201-
$rootScope.templateRequest = $templateRequest;
202-
const deregisterWatch = $rootScope.$watch(
203-
"$templateRequest.totalPendingRequests",
204-
(val) => {
205-
if (val === 0) {
206-
deregisterWatch();
207-
$rootScope.$templateRequest = undefined;
208-
// Now that all templates have been downloaded, $animate will wait until
209-
// the post digest queue is empty before enabling animations. By having two
210-
// calls to $postDigest calls we can ensure that the flag is enabled at the
211-
// very end of the post digest queue. Since all of the animations in $animate
212-
// use $postDigest, it's important that the code below executes at the end.
213-
// This basically means that the page is fully downloaded and compiled before
214-
// any animations are triggered.
215-
$rootScope.$postUpdate(() => {
216-
$rootScope.$postUpdate(() => {
217-
// we check for null directly in the event that the application already called
218-
// .enabled() with whatever arguments that it provided it with
219-
if (animationsEnabled === null) {
220-
animationsEnabled = true;
221-
}
222-
});
223-
});
224-
}
225-
},
226-
true,
227-
);
228-
229193
const callbackRegistry = Object.create(null);
230194

231195
// remember that the `customFilter`/`classNameFilter` are set during the

src/core/compile/compile.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ describe("$compile", () => {
17561756
const el = $("<div my-directive></div>");
17571757
$compile(el)($rootScope);
17581758
await wait();
1759-
expect($rootScope.$handler.watchers.size).toEqual(1);
1759+
expect($rootScope.$handler.watchers.size).toEqual(0);
17601760
});
17611761

17621762
it("allows assigning to two-way scope expressions", async () => {
@@ -1945,7 +1945,7 @@ describe("$compile", () => {
19451945
const el = $("<div my-directive></div>");
19461946
$compile(el)($rootScope);
19471947
await wait();
1948-
expect($rootScope.$handler.watchers.size).toEqual(1);
1948+
expect($rootScope.$handler.watchers.size).toEqual(0);
19491949
});
19501950
});
19511951

0 commit comments

Comments
 (0)