aboutsummaryrefslogtreecommitdiffstats
path: root/util/promise.lua
Commit message (Collapse)AuthorAgeFilesLines
* util: Prefix module imports with prosody namespaceKim Alvefur2023-03-171-1/+1
|
* util.promise: Remove line that was supposed to be removed in eb9814372c54Matthew Wild2022-10-071-1/+0
|
* util.promise: Remove some redundant checks, add tests confirming redundancyMatthew Wild2022-10-071-4/+0
| | | | | | | | | This lines don't appear to do anything useful, and all tests pass when they are removed. Discovered via mutation testing. I added extra tests to exercise this code, because I wasn't certain that there were no side-effects caused by removal. Everything appears to be fine, thanks to the "pending" check at the start of promise_settle().
* compat: Remove handling of Lua 5.1 location of 'unpack' functionKim Alvefur2022-07-111-1/+1
|
* util.promise: Support delayed promise executionKim Alvefur2019-01-051-5/+12
|
* util.promise: Switch order of parameters to join()Matthew Wild2021-03-251-4/+2
| | | | | This saves awkward fiddlery with varargs and also echoes the signature of pcall/xpcall.
* util.promise: all()/all_settled() pass through non-promise valuesMatthew Wild2021-03-251-22/+30
|
* util.promise: Add join() convenience methodMatthew Wild2021-03-251-0/+11
| | | | | | Usage: promise.join(p1, p2, function (result1, result2) [...] end)
* util.promise: Add support for arbitrary keys in all()/all_settled()Matthew Wild2021-03-251-15/+27
|
* Merge 0.11->trunkMatthew Wild2020-11-231-1/+1
|\
| * util.promise: Use xpcall() for promise function to preserve tracebacksMatthew Wild2020-11-231-1/+1
| |
* | util.promise: Add all_settled, which follows semantics of allSettled from ES2020Matthew Wild2020-06-081-0/+22
| |
* | util.promise: Remove references to callbacks after settling promiseKim Alvefur2018-12-301-0/+3
|/ | | | This is to help the garbage collector.
* Many things: switch from hacky multi-arg xpcall implementations to a ↵Matthew Wild2018-10-261-0/+2
| | | | standard util.xpcall
* util.promise: Switch from pcall to xpcall to get tracebacks on exceptionsMatthew Wild2018-10-261-1/+1
|
* util.promise: Remove the non-standard ability to pass a promise to reject()Matthew Wild2018-10-261-3/+1
|
* util.promise: Fix missing parametersMatthew Wild2018-10-251-2/+2
|
* util.promise: Ensure chained promises always receive a value/rejection even ↵Matthew Wild2018-10-251-22/+23
| | | | if an intermediate promise has no handlers
* util.promise: Export is_promise()Matthew Wild2018-10-251-0/+1
|
* util.promise: Remove debug print and assertMatthew Wild2018-10-251-1/+0
|
* util.promise: Add promise.try()Matthew Wild2018-10-181-0/+6
|
* util.promise: Add a string representationKim Alvefur2018-10-181-0/+4
|
* util.promise: Add promise:finally()Matthew Wild2018-10-181-0/+6
|
* util.promise: Some code relocationMatthew Wild2018-10-181-23/+23
|
* util.promise: Also support automatic resolution by returning a promise from ↵Matthew Wild2018-10-181-1/+3
| | | | | | | an on_reject handler Originally unimplemented because it wasn't clear to me what the correct behaviour was, but the A+ spec is clear that both onFulfilled and onRejected may return a promise.
* util.promise: Fix promise.reject() to return a rejected promise, and fix ↵Matthew Wild2018-10-181-1/+1
| | | | buggy test for it
* util.promise: ES6-like API for promisesMatthew Wild2018-10-101-0/+133