[Fixed Position] Free up resources

Free up resources when a fixed position view is destroyed,
WTD-889.
This commit is contained in:
Victor Woeltjen 2015-02-17 08:35:32 -08:00
parent 71a132d374
commit c2b1775d75

View File

@ -124,6 +124,14 @@ define(
}
}
// Free up subscription to telemetry
function releaseSubscription() {
if (subscription) {
subscription.unsubscribe();
subscription = undefined;
}
}
// Subscribe to telemetry updates for this domain object
function subscribe(domainObject) {
// Clear any old values
@ -145,6 +153,9 @@ define(
// Subscribe to telemetry when an object is available
$scope.$watch("domainObject", subscribe);
// Free up subscription on destroy
$scope.$on("$destroy", releaseSubscription);
// Initialize styles (position etc.) for cells
refreshCellStyles();