12345678910111213141516171819202122232425262728 |
- #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 = []() {};
- }
|