mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-07 00:36:50 +01:00
Remove destroy hook (#10549)
* remove destroy hook * revert package-lock.json changes * update test * add migration guide note * fix karma failing test * change way of importing package.json
This commit is contained in:
committed by
GitHub
parent
29395d9013
commit
3df687a87c
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@ A number of changes were made to the configuration options passed to the `Chart`
|
||||
#### Specific changes
|
||||
|
||||
* The radialLinear grid indexable and scriptable options don't decrease the index of the specified grid line anymore.
|
||||
* The `destroy` plugin hook has been removed and replaced with `afterDestroy`.
|
||||
* Ticks callback on time scale now receives timestamp instead of a formatted label.
|
||||
|
||||
#### Type changes
|
||||
|
||||
@@ -3,10 +3,11 @@ const commonjs = require('@rollup/plugin-commonjs');
|
||||
const istanbul = require('rollup-plugin-istanbul');
|
||||
const json = require('@rollup/plugin-json');
|
||||
const resolve = require('@rollup/plugin-node-resolve').default;
|
||||
const builds = require('./rollup.config.cjs');
|
||||
const yargs = require('yargs');
|
||||
|
||||
module.exports = function(karma) {
|
||||
module.exports = async function(karma) {
|
||||
const builds = (await import('./rollup.config.js')).default;
|
||||
|
||||
const args = yargs
|
||||
.option('verbose', {default: false})
|
||||
.argv;
|
||||
|
||||
@@ -2,7 +2,9 @@ import cleanup from 'rollup-plugin-cleanup';
|
||||
import json from '@rollup/plugin-json';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import {terser} from 'rollup-plugin-terser';
|
||||
import {version, homepage} from './package.json';
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
const {version, homepage} = JSON.parse(readFileSync('./package.json'));
|
||||
|
||||
const banner = `/*!
|
||||
* Chart.js v${version}
|
||||
|
||||
@@ -955,9 +955,6 @@ class Chart {
|
||||
this.ctx = null;
|
||||
}
|
||||
|
||||
// TODO V4: delete destroy hook and reference to it in plugin flowchart
|
||||
this.notifyPlugins('destroy');
|
||||
|
||||
delete instances[this.id];
|
||||
|
||||
this.notifyPlugins('afterDestroy');
|
||||
|
||||
@@ -1806,7 +1806,8 @@ describe('Chart', function() {
|
||||
'resize'
|
||||
],
|
||||
destroy: [
|
||||
'destroy'
|
||||
'beforeDestroy',
|
||||
'afterDestroy'
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
8
types/index.d.ts
vendored
8
types/index.d.ts
vendored
@@ -1083,14 +1083,6 @@ export interface Plugin<TType extends ChartType = ChartType, O = AnyObject> exte
|
||||
* @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.
|
||||
* @param {object} args - The call arguments.
|
||||
* @param {object} options - The plugin options.
|
||||
* @deprecated since version 3.7.0 in favour of afterDestroy
|
||||
*/
|
||||
destroy?(chart: Chart, args: EmptyObject, options: O): void;
|
||||
/**
|
||||
* Called after the chart has been destroyed.
|
||||
* @param {Chart} chart - The chart instance.
|
||||
|
||||
Reference in New Issue
Block a user