-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Add inline plugin support to charts. #3363
Conversation
* @returns {Boolean} false if any of the plugins return false, else returns true. | ||
*/ | ||
notify: function(extension, args) { | ||
var plugins = this._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.
I think this would have been easier and shorter:
var options = (chart && chart.options) || {};
var plugins = [].concat(this._plugins, options.plugins || []);
// ... previous code ...
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 call. I will update that and fix the merge conflict
You guys rock! |
19bdfdc
to
a026696
Compare
@etimberg I pushed the new implementation per our Slack discussions: it doesn't contain user documentation but once we switch to the new docs, I will move most of the proposal content into it. |
}); | ||
var res = Chart.plugins.notify('check'); | ||
expect(res).toBeTruthy(); | ||
}); | ||
|
||
it('should return FALSE if no plugin explicitly returns FALSE', function() { |
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.
This was already existing but I think it should be 'should return FALSE if any plugin explicitly returns FALSE'
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.
Nice catch! I will change it, rebase the branch and fix conflicts.
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.
perfect! then I think we can merge this if you feel its ready
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 would wait until we have the doc written and merge everything in one commit.
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.
ok, sounds like a good plan to me
a026696
to
e3d0e24
Compare
Plugins can now be declared in the chart `config.plugins` array and will only be applied to the associated chart(s), after the globally registered plugins. Plugin specific options are now scoped under the `config.options.plugins` options. Hooks now receive the chart instance as first argument and the plugin options as last argument.
e3d0e24
to
ff57293
Compare
@etimberg I rebased the branch on master, so should be ready to be merged. Since we can't get the new doc ready soon, maybe we should consider to merge it now and write doc later? |
Sure, that's ok by me. We should just make sure we don't release without the docs. |
Implementation of this plugins proposal.
Fixed #3335