mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-15 03:25:01 -05:00
rename Task::then to Task::listen
This commit is contained in:
parent
1c40a63e33
commit
eb7c4d9803
1 changed files with 6 additions and 6 deletions
|
@ -676,7 +676,7 @@ namespace geode {
|
||||||
* on some node still existing when the task completes, use an event listener instead.
|
* on some node still existing when the task completes, use an event listener instead.
|
||||||
*/
|
*/
|
||||||
template <class OnResult, class OnProgress, class OnCancelled>
|
template <class OnResult, class OnProgress, class OnCancelled>
|
||||||
void then(OnResult&& onResult, OnProgress&& onProgress, OnCancelled&& onCancelled) const {
|
void listen(OnResult&& onResult, OnProgress&& onProgress, OnCancelled&& onCancelled) const {
|
||||||
// use a raw pointer to avoid cyclic references,
|
// use a raw pointer to avoid cyclic references,
|
||||||
// we destroy it manually later on
|
// we destroy it manually later on
|
||||||
auto* listener = new EventListener<Task>(*this);
|
auto* listener = new EventListener<Task>(*this);
|
||||||
|
@ -721,13 +721,13 @@ namespace geode {
|
||||||
* on some node still existing when the task completes, use an event listener instead.
|
* on some node still existing when the task completes, use an event listener instead.
|
||||||
*/
|
*/
|
||||||
template <class OnResult, class OnProgress>
|
template <class OnResult, class OnProgress>
|
||||||
void then(OnResult&& onResult, OnProgress&& onProgress) const {
|
void listen(OnResult&& onResult, OnProgress&& onProgress) const {
|
||||||
this->then(std::move(onResult), std::move(onProgress), [] {});
|
this->listen(std::move(onResult), std::move(onProgress), [] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an implicit event listener for this Task that will call the
|
* Creates an implicit event listener for this Task that will call the
|
||||||
* provided functions when the Task finishes.
|
* provided function when the Task finishes.
|
||||||
* The listener will automatically be destroyed after the Task has finished.
|
* The listener will automatically be destroyed after the Task has finished.
|
||||||
* @param onResult Function to call when the Task finishes. The function
|
* @param onResult Function to call when the Task finishes. The function
|
||||||
* is given a pointer to the finished value, `T*`.
|
* is given a pointer to the finished value, `T*`.
|
||||||
|
@ -736,8 +736,8 @@ namespace geode {
|
||||||
* on some node still existing when the task completes, use an event listener instead.
|
* on some node still existing when the task completes, use an event listener instead.
|
||||||
*/
|
*/
|
||||||
template <class OnResult, class OnProgress>
|
template <class OnResult, class OnProgress>
|
||||||
void then(OnResult&& onResult) const {
|
void listen(OnResult&& onResult) const {
|
||||||
this->then(std::move(onResult), [](auto const&) {}, [] {});
|
this->listen(std::move(onResult), [](auto const&) {}, [] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
ListenerResult handle(utils::MiniFunction<Callback> fn, Event* e) {
|
ListenerResult handle(utils::MiniFunction<Callback> fn, Event* e) {
|
||||||
|
|
Loading…
Reference in a new issue