Molybden API
|
Delegates allow you to make decisions that affect the application behavior. More...
#include <delegate.hpp>
Public Types | |
using | Signature = void(const Args &args, Action action) |
The callback's signature. | |
Public Member Functions | |
Delegate & | operator= (std::function< Signature > callback) |
Registers a callback to be invoked by this delegate. | |
void | reset () |
Resets the callback registered for this delegate. | |
Friends | |
class | ObservableOwner |
Delegates allow you to make decisions that affect the application behavior.
Every time when Molybden reaches a point when the client decision is required, it invokes the corresponding delegate. If there is no delegate registered, Molybden performs the default action described in the delegate's documentation.
Delegates are usually blocking. It means that the calling thread in the underlying Chromium engine is blocked until you decide how to proceed using the action
parameter passed to the delegate.
Args | the type of the callback arguments. |
Action | the action passed to the callback. |
Delegate< Args, Action > & molybden::Delegate< Args, Action >::operator= | ( | std::function< Signature > | callback | ) |
Registers a callback to be invoked by this delegate.
Use the following approach to register a callback:
In order to unregister the callback, use the reset()
method: