FastLED 3.9.15
|
Implementation class for promise - holds the actual state and logic.
#include <promise.h>
Public Member Functions | |
PromiseImpl () | |
const Error & | error () const |
Get error (only valid if rejected) | |
bool | is_completed () const |
Check if promise is completed. | |
bool | is_rejected () const |
Check if promise is rejected. | |
bool | is_resolved () const |
Check if promise is resolved. | |
bool | reject (const Error &error) |
Reject promise with error. | |
bool | resolve (const T &value) |
Resolve promise with value. | |
bool | resolve (T &&value) |
void | set_catch_callback (fl::function< void(const Error &)> callback) |
Set error callback. | |
void | set_then_callback (fl::function< void(const T &)> callback) |
Set success callback. | |
void | update () |
Update promise state - processes callbacks if needed. | |
const T & | value () const |
Get value (only valid if resolved) | |
Private Member Functions | |
void | process_callbacks () |
Process pending callbacks. | |
Private Attributes | |
bool | mCallbacksProcessed |
fl::function< void(const Error &)> | mCatchCallback |
Error | mError |
PromiseState_t | mState |
fl::function< void(const T &)> | mThenCallback |
T | mValue |