jeudi 16 novembre 2017

Is it possible to build in-repo addon structure that optionally extends a base addon but the app remains unaware of that?

I'm trying to make a base in-repo addon that provides functionality through namespace like platform/services/whatever.

In addition to that I want if another addon isEnabled() that extends or reopens that same service (in some way) I want it to all be merged together without having to call the second addon's service by name like platform-second/services/whatever

I just want a nice clean abstraction. The reason I'm doing it this way is because based on an ENV variable, I need to build / inject different stuff into index.html and different app.imports.

and I want it to be completely separated into separate little in-repo addons to keep it clean.

I want the app to not need to know the platform but just be able to utilize methods of the general platform addon.

So for example platform.services.whatever.myMethod() might be a noOp by default, but if the second addon extends that and implements that, it'll fire that version instead automatically.

Wonder if I'm making any sense at all LOL

If you have any tips or advice on how one might implement this setup, please let me know.

I currently have the in-repo addons built but ideally I'd have the base platform addon be the one that actually has the app folder contents and the other addons that "extend" or "override" the methods / properties of that addon's objects would just be isEnabled() based on that ENV variable.

I should add that I can't simply do merge tree and override the original file because I need the base functionality of those files.

So if I extend one method of the base platform.services.whatever.myMethod() then I still need the rest of that services methods and properties as well.




Aucun commentaire:

Enregistrer un commentaire