2.0.5 • Published 2 years ago

@turing6/promise v2.0.5

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
2 years ago

Promise

A promise, you already know what it does.

Installation

npm install @turing6/promise

Usage

Create a promise:

local promise = Promise.new(function(resolve, reject, onCancel)
    task.wait(5)
    resolve(60, "hi!")
end)

Handle a promise:

-- the given function is run when the resolve function is called and gets the arguments passed to -- the resolve function.
promise:AndThen(function(num, string)
    print(num, string)
end)