Skip to content

ppissanetzky/AndThen

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

AndThen

Lua Promises library inspired by the brilliant Q.

Offers a lot of the same functionality, all you have to do is to supply a function that executes another function after a given amount of milliseconds, which can be zero. Something akin to setTimeout.

You can construct a new Promise using:

Promise(<some value>)

Where < some value > will be the result of the promise. If < some value > is a function, it will be called during construction of the promise with a handler that has resolve and reject methods.

After that, you can chain functions to the promise:

:and_then(resolved callback, rejected callback)

:catch(rejected callback)

:fail(rejected callback)

:finally(snapshot callback)

:done()

:print()

:delay(ms)

:timeout(ms, optional rejection value)

:then_resolve(value)

:then_reject(value)

:all()

:all_settled()

If you want to understand Promises, take a look at Q's documentation

About

Lua Promises library inspired by Q

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages