Bug 1636924 - Remove unnecessary isTopLevel and type properties from onTargetAvailable/onTargetDestroyed callback parameter. r=ochameau.

Since targetFronts now have isTopLevel and targetType properties, we can directly use
those, as the targetFront is included in the callback parameter.
This patch remove those properties and refactor consumer code.

Differential Revision: https://phabricator.services.mozilla.com/D74651
This commit is contained in:
Nicolas Chevobbe
2020-05-15 09:09:28 +00:00
parent 31b72364ad
commit 13622df2d9
29 changed files with 157 additions and 207 deletions

View File

@@ -126,26 +126,26 @@ class ChangesView {
changesFront.off("clear-changes", this.onClearChanges);
}
async onTargetAvailable({ type, targetFront, isTopLevel }) {
async onTargetAvailable({ targetFront }) {
targetFront.watchFronts(
"changes",
this.onChangesFrontAvailable,
this.onChangesFrontDestroyed
);
if (isTopLevel) {
if (targetFront.isTopLevel) {
targetFront.on("will-navigate", this.onClearChanges);
}
}
async onTargetDestroyed({ type, targetFront, isTopLevel }) {
async onTargetDestroyed({ targetFront }) {
targetFront.unwatchFronts(
"changes",
this.onChangesFrontAvailable,
this.onChangesFrontDestroyed
);
if (isTopLevel) {
if (targetFront.isTopLevel) {
targetFront.off("will-navigate", this.onClearChanges);
}
}