-
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
v3: controller, element, scale, plugin and defaults registration #7403
Comments
in my plugins I used a different approach: not a central register method but each element had a register method. The advantages were that I could add some custom logic in each method. like registering other components or elements or compute the defaults on the fly for better tree shaking. Moreover, why not a flat register method instead of a static property? |
I don't have any objection to adding a |
Catching up on all the conversation around this. I don't know that having a single I could imagine something like this Chart.registry.addScale(scale);
Chart.registry.addController();
Chart.registry.addPlugin(..); One thing that might be nice in a debug build using this system (if we can statically compile it out) would be to verify that the registered objects match the expected prototype). |
Date adapters don't have to be registered because they're not looked up by id. There's only a single instance of a data adapter. We could make them extend The thing I don't like about registering independently is it's verbose and you'll have to do it for every project
Compared to:
We could have the typed register methods ( |
I started creating a simple registry for controllers in #7407 |
Closing this since we have a registry now |
Originally posted by @sgratzl in #7371 (comment)
There was a PR already in January: #7009
scaleService
withregistry
(insert better name here), that would handle all of these registrations.It would be used like:
This
register
would store the constructor bytype
in a map, set defaults etc.The type (controller/element/plugin) would be determined from the prototype.
The text was updated successfully, but these errors were encountered: