-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Using promises in API operations #3058
Comments
I've created an internal incident 2070435570. The status of the issue will be updated here in GitHub. |
Yeah, in 2021 it's a time to use |
Hi @uxkjaer thanks for this suggestion and your contribution. I understand your point, but unfortunately, I must tell you that this idea wouldn’t be compatible to the behavior of the V2 ODataModel. A returned promise would change the function usage, which is also incompatible. For example, the ODataModel#read method specifies the return value as “an object which has an abort function to abort the current request”. If we would return a promise, this functionality wouldn’t work anymore as specified in the API. This is why it is currently not planned to adopt such a functionality within the V2 ODataModel. Best regards, |
OpenUI5 version: *
Browser/version (+device/version): All except IE
Any other tested browsers/devices(OK/FAIL):
I recently checked https://www.w3schools.com/browsers/browsers_explorer.asp for IE stats and it's sitting at 0.6 overall usage. I was hoping it might be time to consider using promises in the odata model instead of callback functions.
Pascal Wasem wrote a good blog on how to user a wrapper to promisify it, I've had a look at the source code and manage to use promises for read, remove, update, create, submitchanges and call function, just by adding and returning the promise.
Check out commit uxkjaer@49777ed.
Currently it's been hacked and slashed a bit, but I'd be happy to tidy it up, if you think there is a future in this.
The text was updated successfully, but these errors were encountered: