Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add beforeDestroy hook #9933

Merged
merged 5 commits into from Dec 5, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/core.controller.js
Expand Up @@ -891,6 +891,7 @@ class Chart {
}

destroy() {
this.notifyPlugins('beforeDestroy');
const {canvas, ctx} = this;

this._stop();
Expand Down
7 changes: 7 additions & 0 deletions types/index.esm.d.ts
Expand Up @@ -1053,6 +1053,13 @@ export interface Plugin<TType extends ChartType = ChartType, O = AnyObject> exte
* @param {object} options - The plugin options.
*/
resize?(chart: Chart, args: { size: { width: number, height: number } }, options: O): void;
/**
* Called before the chart is being destroyed.
* @param {Chart} chart - The chart instance.
* @param {object} args - The call arguments.
* @param {object} options - The plugin options.
*/
beforeDestroy?(chart: Chart, args: EmptyObject, options: O): void;
/**
* Called after the chart has been destroyed.
* @param {Chart} chart - The chart instance.
Expand Down