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