MCPcopy
hub / github.com/chartjs/Chart.js / notify

Method notify

src/core/core.plugins.js:35–54  ·  view source on GitHub ↗

* 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 wh

(chart, hook, args, filter)

Source from the content-addressed store, hash-verified

33 * @returns {boolean} false if any of the plugins return false, else returns true.
34 */
35 notify(chart, hook, args, filter) {
36 if (hook === 'beforeInit') {
37 this._init = this._createDescriptors(chart, true);
38 this._notify(this._init, chart, 'install');
39 }
40
41 if (this._init === undefined) { // Do not trigger events before install
42 return;
43 }
44
45 const descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);
46 const result = this._notify(descriptors, chart, hook, args);
47
48 if (hook === 'afterDestroy') {
49 this._notify(descriptors, chart, 'stop');
50 this._notify(this._init, chart, 'uninstall');
51 this._init = undefined; // Do not trigger events after uninstall
52 }
53 return result;
54 }
55
56 /**
57 * @private

Callers 1

notifyPluginsMethod · 0.80

Calls 3

_createDescriptorsMethod · 0.95
_notifyMethod · 0.95
_descriptorsMethod · 0.95

Tested by

no test coverage detected