Browse Source

Stop interval when destory() called - #668

pull/647/merge
Masayuki Tanaka 10 years ago
parent
commit
3b4e916a25
  1. 7
      c3.js
  2. 10
      c3.min.js
  3. 1
      src/api.chart.js
  4. 6
      src/core.js

7
c3.js

@ -138,6 +138,8 @@
$$.withoutFadeIn = {};
$$.intervalForObserveInserted = undefined;
$$.axes.subx = d3.selectAll([]); // needs when excluding subchart.js
};
@ -805,10 +807,10 @@
if (mutation.type === 'childList' && mutation.previousSibling) {
observer.disconnect();
// need to wait for completion of load because size calculation requires the actual sizes determined after that completion
var interval = window.setInterval(function () {
$$.intervalForObserveInserted = window.setInterval(function () {
// parentNode will NOT be null when completed
if (selection.node().parentNode) {
window.clearInterval(interval);
window.clearInterval($$.intervalForObserveInserted);
$$.updateDimension();
$$.config.oninit.call($$);
$$.redraw({
@ -6319,6 +6321,7 @@
$$.data.targets = undefined;
$$.data.xs = {};
$$.selectChart.classed('c3', false).html("");
window.clearInterval($$.intervalForObserveInserted);
window.onresize = null;
};

10
c3.min.js vendored

File diff suppressed because one or more lines are too long

1
src/api.chart.js

@ -15,5 +15,6 @@ c3_chart_fn.destroy = function () {
$$.data.targets = undefined;
$$.data.xs = {};
$$.selectChart.classed('c3', false).html("");
window.clearInterval($$.intervalForObserveInserted);
window.onresize = null;
};

6
src/core.js

@ -133,6 +133,8 @@ c3_chart_internal_fn.initParams = function () {
$$.withoutFadeIn = {};
$$.intervalForObserveInserted = undefined;
$$.axes.subx = d3.selectAll([]); // needs when excluding subchart.js
};
@ -800,10 +802,10 @@ c3_chart_internal_fn.observeInserted = function (selection) {
if (mutation.type === 'childList' && mutation.previousSibling) {
observer.disconnect();
// need to wait for completion of load because size calculation requires the actual sizes determined after that completion
var interval = window.setInterval(function () {
$$.intervalForObserveInserted = window.setInterval(function () {
// parentNode will NOT be null when completed
if (selection.node().parentNode) {
window.clearInterval(interval);
window.clearInterval($$.intervalForObserveInserted);
$$.updateDimension();
$$.config.oninit.call($$);
$$.redraw({

Loading…
Cancel
Save