Skip to content

Promise#

Promise was created by evaera and used by Volt. The GitHub for it can be found here.

Examples#

local Volt = require(game.ReplicatedStorage.Volt)
local Promise = Volt.import('Libraries/Utilities/Promise')

local myPromise = Promise.new(function(resolve, reject)
    coroutine.wrap(function()
        ...
        resolve('Some code ran successfully!')
    end)()
end)

myPromise:andThen(function(text)
    print(text) --> Outputs: Some code ran successfully!
end):catch(function(textError)
    error('Promise failed to run due to: ' .. textError)
end)

Documentation#