meteor-astronomy icon indicating copy to clipboard operation
meteor-astronomy copied to clipboard

Open the API to plugins registrations (description transform)

Open jsamr opened this issue 9 years ago • 1 comments

[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).

jsamr avatar Aug 07 '16 17:08 jsamr

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.

lukejagodzinski avatar Aug 08 '16 09:08 lukejagodzinski