[Performance] Release interval from mct-chart

Stop checking for size changes after scope is destroyed
in mct-chart; part of ongoing resolution of resource leaks
which may contribute to WTD-717.
This commit is contained in:
Victor Woeltjen 2015-01-26 17:56:52 -08:00
parent a9f7cc9658
commit 5ee872713f

View File

@ -46,6 +46,7 @@ define(
function linkChart(scope, element) { function linkChart(scope, element) {
var canvas = element.find("canvas")[0], var canvas = element.find("canvas")[0],
releaseInterval,
chart; chart;
// Try to initialize GLChart, which allows drawing using WebGL. // Try to initialize GLChart, which allows drawing using WebGL.
@ -111,11 +112,14 @@ define(
} }
// Check for resize, on a timer // Check for resize, on a timer
$interval(drawIfResized, 1000); releaseInterval = $interval(drawIfResized, 1000);
// Watch "draw" for external changes to the set of // Watch "draw" for external changes to the set of
// things to be drawn. // things to be drawn.
scope.$watchCollection("draw", doDraw); scope.$watchCollection("draw", doDraw);
// Stop checking for resize when scope is destroyed
scope.$on("$destroy", releaseInterval);
} }
return { return {