GameMaker (2.3)

Promises - Wait async functions with elegance

Emmanuel Di Iorio

You must be logged in to obtain assets


A Promise represents the result of an operation that hasn't been completed yet, but will at some undetermined point in the future. An example of such an operation is a network request. When we fetch data from some source, for example an API, there is no way for us to absolutely determine when the response will be received.

Without Promises, we would have to use callbacks to deal with actions that need to happen in sequence. This isn't necessarily a problem if we only have one asynchronous action. But if we need to complete multiple asynchronous steps in sequence, callbacks become unmanageable and result in the infamous callback hell.

Example usage:

doSomething() // This returns a Promise

Create a promise by calling:

var myPromise = new Promise(function() {
   // your async code here

End User Licence Agreement (EULA).

Age Rating: 4+


GMS2.3 - Version 1.0.0. Published January 21, 2022

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait