From 5ee872713f32aafc883c03bbc7510c0dda719feb Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 26 Jan 2015 17:56:52 -0800 Subject: [PATCH] [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. --- platform/features/plot/src/MCTChart.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/features/plot/src/MCTChart.js b/platform/features/plot/src/MCTChart.js index 5c01bc6efc..586d581fc7 100644 --- a/platform/features/plot/src/MCTChart.js +++ b/platform/features/plot/src/MCTChart.js @@ -46,6 +46,7 @@ define( function linkChart(scope, element) { var canvas = element.find("canvas")[0], + releaseInterval, chart; // Try to initialize GLChart, which allows drawing using WebGL. @@ -111,11 +112,14 @@ define( } // Check for resize, on a timer - $interval(drawIfResized, 1000); + releaseInterval = $interval(drawIfResized, 1000); // Watch "draw" for external changes to the set of // things to be drawn. scope.$watchCollection("draw", doDraw); + + // Stop checking for resize when scope is destroyed + scope.$on("$destroy", releaseInterval); } return {