Rename plugins
See original GitHub issueThe mechanism for plugins has proven a generally useful way to separate the concerns of your app into separate modules.
If for example, you are writing an admin interface for a blogging platform, you might want to separate your code into auth
, posts
, comments
, et c modules, containing the state, actions, events relevant to each respective topic.
By exposing each module’s state, actions, events as a plugin, it becomes very convenient to bring them together in a single app using app({ ... plugins: [auth, posts, comments], ...})
However, the word “plugins” implies it is only meant for more general, reusable things. Not as a way to structure your app. Therefore, I move that the name “plugins” be changed to something else. The question is what?
Either, we find a suitable noun, such as “modules” (except “modules” might cause some confusion), or, perhaps we don’t hard-code a name into hyperapp, and instead declare the plugins with a verb, such as: app({ ... compose: [auth, posts, comments] ...})
. Other options, besides “compose”, might be “include” or “merge”.
If we go the “verb” route, we’ll still need a noun to use instead of “plugins”, for docs and discussions. But we’re more free to use a longer, descriptive name, like “hyperapp-modules” for example.
At the moment, I think my vote is on: app({ ... include: [foo, bar] ...})
and calling the includees “hyperapp-modules” in the docs
Issue Analytics
- State:
- Created 6 years ago
- Comments:28 (27 by maintainers)
I take it back. プラグイン appears to be 15 bytes, so that’s a big penalty compared to “plugins” or “mixins”.
I would prefer
mixins
for this 😄