What are promises?
Here is a very good definition of it from Mozilla:
How to use promises in OutSystems?
Here is a simple example of how we could use promises in the platform. In this case, we are creating a promise and making it "wait" until it gets resolved by another button to click. I added the above piece of code to my OnReady: The BtnId comes from a button that is on my screen and does nothing, so its click's action is empty:
So when I publish and test it, this is what happens:
The article's example demonstrates how Promises can be used to resolve the code only when a button is clicked. Until the Promise is fulfilled or rejected, the code remains idle. While this is a simple example, it shows the potential of Promises, particularly in front-end development. However, it's important to keep in mind that overuse of Promises can impact the client's performance. In conclusion, Promises are a useful tool for asynchronous programming in front-end development and can improve the user experience without requiring the user to wait for the promise to be resolved. But, as with any tool, they should be used with caution to maintain optimal performance.