Promise.Then(function onFulfill, function onRejected = nil)
Associate handlers to called when promise if fulfilled or rejected. Note that the promise invokes the associated handlers in the main game thread; therefore, every API can be used safely within handlers.
Parameters:
Name | Type | Description |
---|---|---|
onFulfill | function | Handler to be called when the promise fulfilled. The result of the promised passed as parameter to this function. |
onRejected | function | The handler to be called when the promise is rejected. |
Returns:
type | Description |
---|---|
Promise | itself. |
Usage
---@type Promise
local promise;
---@type function
local onFulfill;
---@type function
local onRejected;
local val0 = promise.Then(onFulfill, onRejected)