Promises, but without error handling as this screws with stack traces, using Roblox signals

See: https://promisesaplus.com/

Members

Functions

Returns Functions Description
Promise Promise.new ( value ) Construct a new promise
Promise Promise.First ( Array(Promise) promises ) Returns the value of the first promise resolved
Promise Promise.All ( promises ) Executes all promises.

Methods

Returns Methods Description
bool IsPending ( ) Returns whether or not the promise is pending
Wait ( ) Yield until the promise is complete
Resolve ( ... ) Resolves a promise
Fulfill ( ... ) Fulfills the promise with the value
Reject ( ... ) Rejects the promise with the value given
Promise Then ( function onFulfilled = nil function onRejected = nil ) Handlers when promise is fulfilled/rejected
Promise Catch ( func ) Catch errors from the promise
nil Destroy ( ) Rejects the current promise.

Functions Descriptions

Promise Promise.new ( value )

Construct a new promise Promise.new()

Parameters

  • value:, default nil

Returns

Promise Promise.First ( Array(Promise) promises )

Returns the value of the first promise resolved First

Parameters

Returns

  • Promise: Promise that resolves with first result

Promise Promise.All ( promises )

Executes all promises. If any fails, the result will be rejected. However, it yields until every promise is completeFirst

Parameters

  • promises

Returns

Methods Descriptions

bool Promise:IsPending ( )

Returns whether or not the promise is pending

Returns

  • bool: True if pending, false otherwise

Promise:Wait ( )

Yield until the promise is complete

Promise:Resolve ( ... )

Resolves a promise

Parameters

  • ...

Returns

  • self

Promise:Fulfill ( ... )

Fulfills the promise with the value

Parameters

  • ...: Params to fulfill with

Returns

  • self

Promise:Reject ( ... )

Rejects the promise with the value given

Parameters

  • ...: Params to reject with

Returns

  • self

Promise Promise:Then ( function onFulfilled = nil function onRejected = nil )

Handlers when promise is fulfilled/rejected

Parameters

  • function onFulfilled = nil: Called when fulfilled with parameters
  • function onRejected = nil: Called when rejected with parameters

Returns

Promise Promise:Catch ( func )

Catch errors from the promise

Parameters

  • func

Returns

nil Promise:Destroy ( )

Rejects the current promise. Utility left for Maid task

Returns