refactor(ivy): remove unused code related to listeners clanup (#29725)

PR Close #29725
This commit is contained in:
Pawel Kozlowski 2019-04-05 15:30:04 +02:00 committed by Igor Minar
parent 902a53a4f6
commit 38a3a5a1f1
2 changed files with 2 additions and 11 deletions

View File

@ -539,11 +539,6 @@ export interface TView {
* `useCaptureOrIndx >= 0` `removeListener = LView[CLEANUP][useCaptureOrIndx]` * `useCaptureOrIndx >= 0` `removeListener = LView[CLEANUP][useCaptureOrIndx]`
* `useCaptureOrIndx < 0` `subscription = LView[CLEANUP][-useCaptureOrIndx]` * `useCaptureOrIndx < 0` `subscription = LView[CLEANUP][-useCaptureOrIndx]`
* *
* If it's a renderer2 style listener or ViewRef destroy hook being stored:
* 1st index is: index of the cleanup function in LView.cleanupInstances[]
* 2nd index is: `null`
* `lView[CLEANUP][tView.cleanup[i+0]]()`
*
* If it's an output subscription or query list destroy hook: * If it's an output subscription or query list destroy hook:
* 1st index is: output unsubscribe function / query list destroy function * 1st index is: output unsubscribe function / query list destroy function
* 2nd index is: index of function context in LView.cleanupInstances[] * 2nd index is: index of function context in LView.cleanupInstances[]

View File

@ -488,7 +488,7 @@ function removeListeners(lView: LView): void {
const lCleanup = lView[CLEANUP] !; const lCleanup = lView[CLEANUP] !;
for (let i = 0; i < tCleanup.length - 1; i += 2) { for (let i = 0; i < tCleanup.length - 1; i += 2) {
if (typeof tCleanup[i] === 'string') { if (typeof tCleanup[i] === 'string') {
// This is a listener with the native renderer // This is a native DOM listener
const idxOrTargetGetter = tCleanup[i + 1]; const idxOrTargetGetter = tCleanup[i + 1];
const target = typeof idxOrTargetGetter === 'function' ? const target = typeof idxOrTargetGetter === 'function' ?
idxOrTargetGetter(lView) : idxOrTargetGetter(lView) :
@ -496,7 +496,7 @@ function removeListeners(lView: LView): void {
const listener = lCleanup[tCleanup[i + 2]]; const listener = lCleanup[tCleanup[i + 2]];
const useCaptureOrSubIdx = tCleanup[i + 3]; const useCaptureOrSubIdx = tCleanup[i + 3];
if (typeof useCaptureOrSubIdx === 'boolean') { if (typeof useCaptureOrSubIdx === 'boolean') {
// DOM listener // native DOM listener registered with Renderer3
target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx); target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx);
} else { } else {
if (useCaptureOrSubIdx >= 0) { if (useCaptureOrSubIdx >= 0) {
@ -508,10 +508,6 @@ function removeListeners(lView: LView): void {
} }
} }
i += 2; i += 2;
} else if (typeof tCleanup[i] === 'number') {
// This is a listener with renderer2 (cleanup fn can be found by index)
const cleanupFn = lCleanup[tCleanup[i]];
cleanupFn();
} else { } else {
// This is a cleanup function that is grouped with the index of its context // This is a cleanup function that is grouped with the index of its context
const context = lCleanup[tCleanup[i + 1]]; const context = lCleanup[tCleanup[i + 1]];