meteor-astronomy
meteor-astronomy copied to clipboard
Open the API to plugins registrations (description transform)
[Proposed in #440]
It would be sensibly different from modules which allows to extend the description with new fields. Meanwhile, behaviors address a different need of Class customization. A plugin would apply to all Classes of a project, and add features in a homogeneous way.
Snippet
import { registerPlugin } from 'meteor/jagi:astronomy'
import { descriptionTransform } from 'somelib/descriptionTransform'
registerPlugin(descriptionTransform)
registerPlugin function
registerPlugin's first argument (a method) which signature is (description) : description will be applyed to anycreate, extend or inherit first argument (description).
I'm rather against adding new terminology to the package. I would rather introduce new hook to modules system that would allow attaching to create, extend and inherit methods. However, class definition of each of these methods goes through event hooks, so it can be easily modified/improved with any extra functionality.