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

Consider replacing q dependency with native promise #290

Closed
fred-wang opened this issue Nov 16, 2016 · 2 comments
Closed

Consider replacing q dependency with native promise #290

fred-wang opened this issue Nov 16, 2016 · 2 comments

Comments

@fred-wang
Copy link
Contributor

It seems that the q dependency is only used in the core matrix-js-sdk/lib/ files. Modern web engines have native support for promises:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#Browser_compatibility

I think it would be great to provide an option to use native promise in place of q, similar to what is done for "request". That will allow to reduce a bit the dep tree, see #244

@kegsay
Copy link
Member

kegsay commented Nov 16, 2016

I like this idea.

I would love to swap over to Bluebird coroutines whilst we wait for async/await to be supported in more browsers (or in my case, Node).

However, it's unlikely to make much of an impact on the dep tree: package.json will still need to refer to some Promise implementation since we cannot assume that they are supported natively. We can clobber at runtime, but the bundle will still have Q's code inside since webpack/browserify won't be able to statically determine that it is dead code.

@richvdh
Copy link
Member

richvdh commented Jul 13, 2017

We have now switched the promise implementation to #490, so I'm closing this.

As @kegsay said, we can't do much to reduce the dependency tree this way because (a) we need to support platforms without a native Promise implementation, and (b) we use a bunch of features from bluebird other than the raw Promise support (eg Promise.all, and (for now at least) Promise.done for backwards compatibility with q).

@richvdh richvdh closed this as completed Jul 13, 2017
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

3 participants