1234567891011121314151617181920212223242526 |
- #include "DoLaterHandler.h"
- DoLaterHandler::DoLaterHandler()
- {
- action = []() {};
- }
- DoLaterHandler::~DoLaterHandler()
- {
- action();
- }
- void DoLaterHandler::addTodo(std::function<void()> newAction)
- {
- std::function<void()> oldAction = action;
- this->action = [oldAction, newAction]() {
- oldAction();
- newAction();
- };
- }
- void DoLaterHandler::execute()
- {
- action();
- action = []() {};
- }
|