Skip to content

Commit

Permalink
Merge pull request #43 from moberemk/patch-1
Browse files Browse the repository at this point in the history
Fix memory leaks
  • Loading branch information
Steven Edouard authored Jan 10, 2018
2 parents 99db87d + a6d5710 commit 0e3ae87
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ChartjsNode extends EventEmitter {
}

this._disableDynamicChartjsSettings(configuration);
this._canvas = BbPromise.promisifyAll(window.document.getElementById('myChart'));
this._canvas = window.document.getElementById('myChart');
this._ctx = this._canvas.getContext('2d');

this._chart = new Chartjs(this._ctx, configuration);
Expand Down Expand Up @@ -186,6 +186,9 @@ class ChartjsNode extends EventEmitter {
* Destroys the virtual DOM and canvas -- releasing any native resources
*/
destroy() {
if (this._chart) {
this._chart.destroy();
}

if (this._windowPropertiesToDestroy) {
this._windowPropertiesToDestroy.forEach((prop) => {
Expand Down

0 comments on commit 0e3ae87

Please sign in to comment.