question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: migration from callbacks towards asynchronous functions (await/async) in UI5-controllers

See original GitHub issue

Issue: Asynchronous functions (await/async) have been introduced to ECMAScript/JavaScript back in June 2016, since then await/async became a best practise for a writing an asynchronous code in JS, allowing to avoid a callback hell.

Unfortunately, UI5 stayed away from the trend and even in 2020 a typical UI5-controller from the very beginning contains at least two nested callback and looks likes:

sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function (Controller) {
	"use strict";

	return Controller.extend("ui5.tst.TST.controller.View1", {
		onInit: function () {
			/*…*/
		}
	});
});

Feature request: To make a «facelifting» to all UI5-controllers and to refactor the codebase, moving from multiple nested callbacks towards asynchronous functions (await/async), making code less nested and therefore easier-to-read.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
breliancommented, Mar 25, 2020

Totally agree with @pubmikeb . ES6/7 brings many conveniences to developers. If there is a plan to support it, I believe there will be many developers willing to participate, including me.

1reaction
pubmikebcommented, Mar 11, 2020

Yes, I realize the IE11-compatibility affects some modern standards adaptation. But what about providing two branches, let say, the modern and the legacy-one? For Chromium-based/Firefox browsers and for IE11 respectively. With an appropriate CI/CD infrastructure such task can be automated.

Anyway, the IE11 end-of-life is a matter of couple of next years, why not to let benefit from the modern standards out-of-box already today at least for those, who are not binded with the IE11 support?

P.S. Regardless the ES7 support, a TypeScript build of UI5 would be a prefect thing, especially due to its strong-typed nature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

From callbacks to async - await - A migration guide - LinkedIn
Therefore it made sense to take a function as an argument that would be called when the response is available, freeing the CPU...
Read more >
Understanding the Event Loop, Callbacks, Promises, and ...
To do this, you will first learn about the original way to ensure asynchronous code is handled correctly by the event loop: callback...
Read more >
Asynchronous programming: futures, async, await | Dart
This codelab teaches you how to write asynchronous code using futures and the async and await keywords. Using embedded DartPad editors, you can...
Read more >
Converting closure-based code into async/await in Swift
Swift provides a few methods we can use to convert callback-based ... If you wanted to start your async/await migration with this method, ......
Read more >
Migrating from Promise chains to Async/Await - AfterAcademy
Several functions used in Javascript are asynchronous in nature and return Promises and you might need to implement those with traditional ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found