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

Add named exports #277

Open
blikblum opened this issue Nov 27, 2017 · 1 comment
Open

Add named exports #277

blikblum opened this issue Nov 27, 2017 · 1 comment

Comments

@blikblum
Copy link
Contributor

Following es export ( #275 ) there's the possibility to use named exports instead of exporting the whole API in the default export.

As already cited there are some challenges doing so.

The bigger is that the most common usage pattern is

import Radio from 'backbone.radio'

Radio.channel('yy').request('xx')

Changing to named exports would require Radio users to convert code in a lot of places

Also there would need to reevaluate the API design a bit to allow current features (override log) or avoid confusion (channel vs Channel)

Here's a quick proposal of an API for implementing named exports

Keep same signature:
Channel
tuneIn
tuneOut
reset

Changes:
channel > getChannel
DEBUG > setDebug(Boolean)
debugLog > setDebugHandler(Function)

By now, in short term, i bias toward keeping only the default export, and evaluate the named exports for the future

@paulfalgout
Copy link
Member

Yeah I also lean towards only the default. We're not going to gain anything from treeshaking in the lib, so named exports only breaks and renames the API for little if any benefit.

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

No branches or pull requests

2 participants