Commit graph

8 commits

Author SHA1 Message Date
Timothy Flynn
1c2c9a859a LibCore: Do not require rvalue references to resolve/reject promises
The way these methods were previously defined, we would have to `move`
values into these functions. This was pretty awkward for plain types.
For example, doing a `move` here really doesn't make sense:

    int resolution = 123;
    promise->resolve(move(resolution));

Let's declare these methods in a manner that allows callers to choose
whether values are moved or copied, using perfect forwarding.
2025-11-12 09:06:21 -05:00
Zaggy1024
592be4ecad LibCore: Allow Promise to be resolved if it has a non-Error error type 2025-10-02 14:50:04 +02:00
Andreas Kling
134fd8e413 LibCore: Don't have Promise inherit from EventReceiver
This was only used for parenting promises to each other, but we can do
that with a simple vector of children.
2025-08-11 16:55:25 +02:00
Andreas Kling
4d285d6dce LibCore: Remove an unused Promise constructor 2025-08-11 16:55:25 +02:00
Ali Mohammad Pur
e47b1cc1a2 LibCore: Accept any Promise<T> in Promise::after() 2025-06-25 08:20:40 +02:00
Ali Mohammad Pur
59b6293182 LibCore: Add a Promise::after(promises) API
This is equivalent to Promise.all() in js, more or less.
2025-06-11 18:16:29 +02:00
Timothy Flynn
0f05aac290 LibCore: Mark the lambda in Promise::when_resolved as mutable
This allows the handler passed into this function to also be mutable.
2025-03-09 11:14:20 -04:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibCore/Promise.h (Browse further)