-
Notifications
You must be signed in to change notification settings - Fork 12k
Plugin hooks and jsdoc enhancements #3819
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
Conversation
etimberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice anything major but I still need to run this code
src/core/core.controller.js
Outdated
| me.clear(); | ||
|
|
||
| Chart.plugins.notify(me, 'beforeDraw', [easingDecimal]); | ||
| plugins.notify(me, 'beforeDraw', [easingDecimal]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this can't be cancelled like the other plugins?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
| * Plugin extension methods. | ||
| * @interface Chart.PluginBase | ||
| * Plugin extension hooks. | ||
| * @interface IPlugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention IPlugin#onEvent as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
etimberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested out these changes. I tried all chart types using the sample files and did not notice any issues. I also tested using all of the chartjs-plugin-annotation and chartjs-plugin-zoom samples. No issues were observed.
|
Looks like there is a test failure regarding plugins |
|
Will need to change https://github.com/chartjs/Chart.js/blob/master/src/core/core.legend.js#L529 otherwise legend click handling stops working |
Make all `before` hooks cancellable (except `beforeInit`), meaning that if any plugin return explicitly `false`, the current action is not performed. Ensure that `init` hooks are called before `update` hooks and add associated calling order unit tests. Deprecate `Chart.PluginBase` in favor of `IPlugin` (no more an inheritable class) and document plugin hooks (also rename `extension` by `hook`).
67e8ed3 to
60aa596
Compare
|
Looks good, the legend is working again :) |
Make all
beforehooks cancellable (exceptbeforeInit), meaning that if any plugin return explicitlyfalse, the current action is not performed. Ensure thatinithooks are called beforeupdatehooks and add associated calling order unit tests. DeprecateChart.PluginBasein favor ofIPlugin(no more an inheritable class) and document plugin hooks (also renameextensionbyhook).Depends on #3818