Skip to content
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

Expose nanobus #536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

trygve-lie
Copy link

Not sure if this is a wanted feature, but here we go.

Currenty bel is exposed so one can import it by choo/html. This expoes nanobus in the same way on choo/ee.

Main reason for this is that there are many places one would benefit from using an event emitter to do stuff in an application where the code is not directly bound to choo but the code lives among choo (example of such code can be code doing operations on a map).

If one have such, its desirable to be able to use the same event emitter, and version, as bundeled in choo to reduce the final bundle size. By being able to get hold of the event emitter in choo like this one will be a bit more safeguarded on this.

@bcomnes
Copy link
Collaborator

bcomnes commented Jul 25, 2017

I was also thinking about exposing nanocomorph. There might be value in ensuring a consistent module version of some of the ingredients like bel, nanobus and nanomnorph.

@toddself
Copy link
Contributor

Perhaps naïvely i just rely on npm to resolve this for me. we use nanobus in a lot of our friend end and since npm 3 > dedupes on install we just install it along side.

Also a lot of our components don't rely on choo directly. we install bel and nanobus since those are the components being used.

I'm not against this pr though

@yoshuawuyts
Copy link
Member

yoshuawuyts commented Jul 25, 2017 via email

@bcomnes
Copy link
Collaborator

bcomnes commented Jul 25, 2017

I don't have strong feelings either way.

@ungoldman
Copy link
Member

ungoldman commented Feb 23, 2018

Hello! I have three thoughts on this:

  1. There's been discussion about possibly removing bel as a dependency to avoid the choo/? require pattern and reduce dependencies (see Build for UMD #617). I'd argue it's probably best to reduce the number of require endpoints dependent on file organization (preferably to zero), rather than create another one.

  2. The instance of nanobus used by choo is currently exposed as choo.emitter -- while I understand the motivation to want to use the same nanobus module for other tasks to reduce bundle sizes, complicating choo's API might not be a price worth paying. Ensuring the nanobus version you're using is same as choo's and relying on npm to dedupe seems like a better strategy to me.

  3. If it seems like a good idea to expose some of choo's tools to users, I would prefer to expose them via module.exports, as it makes it less easy to introduce a breaking change by reorganizing or renaming files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants