| 1 |
/** |
| 2 |
* @typedef { import('./core.controller.js').default } Chart |
| 3 |
* @typedef { import('../types/index.js').ChartEvent } ChartEvent |
| 4 |
* @typedef { import('../plugins/plugin.tooltip.js').default } Tooltip |
| 5 |
*/ |
| 6 |
/** |
| 7 |
* @callback filterCallback |
| 8 |
* @param {{plugin: object, options: object}} value |
| 9 |
* @param {number} [index] |
| 10 |
* @param {array} [array] |
| 11 |
* @param {object} [thisArg] |
| 12 |
* @return {boolean} |
| 13 |
*/ |
| 14 |
export default class PluginService { |
| 15 |
_init: { |
| 16 |
plugin: any; |
| 17 |
options: any; |
| 18 |
}[]; |
| 19 |
/** |
| 20 |
* Calls enabled plugins for `chart` on the specified hook and with the given args. |
| 21 |
* This method immediately returns as soon as a plugin explicitly returns false. The |
| 22 |
* returned value can be used, for instance, to interrupt the current action. |
| 23 |
* @param {Chart} chart - The chart instance for which plugins should be called. |
| 24 |
* @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate'). |
| 25 |
* @param {object} [args] - Extra arguments to apply to the hook call. |
| 26 |
* @param {filterCallback} [filter] - Filtering function for limiting which plugins are notified |
| 27 |
* @returns {boolean} false if any of the plugins return false, else returns true. |
| 28 |
*/ |
| 29 |
notify(chart: Chart, hook: string, args?: object, filter?: filterCallback): boolean; |
| 30 |
/** |
| 31 |
* @private |
| 32 |
*/ |
| 33 |
private _notify; |
| 34 |
invalidate(): void; |
| 35 |
_oldCache: { |
| 36 |
plugin: any; |
| 37 |
options: any; |
| 38 |
}[]; |
| 39 |
_cache: { |
| 40 |
plugin: any; |
| 41 |
options: any; |
| 42 |
}[]; |
| 43 |
/** |
| 44 |
* @param {Chart} chart |
| 45 |
* @private |
| 46 |
*/ |
| 47 |
private _descriptors; |
| 48 |
_createDescriptors(chart: any, all: any): { |
| 49 |
plugin: any; |
| 50 |
options: any; |
| 51 |
}[]; |
| 52 |
/** |
| 53 |
* @param {Chart} chart |
| 54 |
* @private |
| 55 |
*/ |
| 56 |
private _notifyStateChanges; |
| 57 |
} |
| 58 |
export type Chart = import('./core.controller.js').default; |
| 59 |
export type ChartEvent = import('../types/index.js').ChartEvent; |
| 60 |
export type Tooltip = any; |
| 61 |
export type filterCallback = (value: { |
| 62 |
plugin: object; |
| 63 |
options: object; |
| 64 |
}, index?: number, array?: any[], thisArg?: object) => boolean; |