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

Returning promises (optionally) #18

Closed
diffcunha opened this issue Feb 14, 2018 · 3 comments
Closed

Returning promises (optionally) #18

diffcunha opened this issue Feb 14, 2018 · 3 comments

Comments

@diffcunha
Copy link

I'm building a PWA with Choo using asynchronous components and given that I'm using promises to deal with those it would be interesting if split-require could return a promise rather that using callbacks only. Something like:

const splitRequire = require('split-require')

splitRequire('./SomeComponent').then(SomeComponent => { ... }) // promise
splitRequire('./SomeComponent', (err, SomeComponent) => { ... }) // callback
@goto-bus-stop
Copy link
Owner

yeah, this would be good--I think it might simplify the loader implementation a bit too, currently I'm jumping through a few hoops to combine callbacks but Promises already handle that. choo is also possibly going to be using Promises for async rendering soon™ so that would help with integration.

@goto-bus-stop
Copy link
Owner

Just remembered that Promises don't exist in IE11 which I would like to support, so I'll try to bolt them onto the old implementation instead

@goto-bus-stop
Copy link
Owner

finally released in 📦 3.1.0 :) thanks for the request!

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