-
Notifications
You must be signed in to change notification settings - Fork 759
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
Promises supported? #344
Comments
Promises are not supported. |
Can you maybe integrate it? I did a polyfill and it was not so much work. |
I'll treat this as a feature request, but I don't think we can support promises for as long as we support Android 4.4, not without a polyfill library anyway. I can't guarantee when this will be done as Cordova is a bunch of volunteers with limited time. You are however welcome to make a PR. |
Thank you, for treating it as a feature request. |
I believe Cordova supports |
Ok, it's not that hard to add a polyfill. I will see, what i can do. |
Now all hope is on 1 man, the GitToTheHub |
;) |
I would actually favor using some kind of Promise-like utility such as https://github.com/joelnet/XPromise rather than an actual polyfill for multiple reasons, major is unpredictability of behavior and interference with other modules & packages. Some nice arguments here: https://ponyfoo.com/articles/polyfills-or-ponyfills |
I Disagree. The arguments in that article is mostly for language syntax features such as arrow functions (Which you can't really polyfill properly anyway, as stated in the article). Using a promise-like utility is just another piece of software that will need to be kept up-to-date. Using a polyfill is something that can be activated for older browsers that don't support a particular feature and can be safely removed in the future without refactoring anything, as the codebase is already using the same interface as the browser API. Additionally, using I've used es6-promise to support IE, older versions of Safari, as well as android 4.1+ in my projects. It has consistent behaviour native-browser Also, https://github.com/joelnet/XPromise is not a production library. It's built as a challenge to create usable/tangible library without the use of variables for fun.
|
@breautek Really good explained. For the majority, we don't even need a polyfill. iOS has support since iOS 8 and Android since 4.4.3. What i don't understand is, that there are so many Promise polyfill solutions. When i'm searching for a polyfill, the first entry i found is Maybe a lot ot this persons wanted to understand the techniques behind the scenes and published there experiences. But i think the api is not that hard and it should be not a great thing which polyfill to choose or which is better then the others. |
This might be a stupid question but why do you even need promises? |
You'll likely always find multiple people building their own solution for a problem.
This is true, but we also do support 4.4.x, including the patch versions prior to 4.4.3. Additionally the
It's not really a need, but a nice to have feature. Chaining promises is much better than trying to chain callbacks. Makes the code much cleaner in my opinion. |
It's really a weired question for me. It's for doing your code much more cleaner and simpler (e.g. for getting rid of the callback hell). And Promises are the necessary step to use the async/await command in your JavaScript, so you can simply write
|
@GitToTheHub Since you have -already- done the work, can you share it to make a first review possible? |
Hi, sorry, I didn't found time currently to make a PR. I only made a promise polyfill for the plugin but didn't add it directly in the plugin code. I only could share the polyfill currently. |
Hi I won't implement the promises in this plugin, because I don't find time for this and have other projects to do. I hope someone else could do it :) |
Hi, does this API supports Promises, so that i can do
resolveLocalFileSystemURL(url).then(...)
or must i wrap every api call in Promises?
Thanks for responding!
The text was updated successfully, but these errors were encountered: