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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user