Rename in readme
This commit is contained in:
parent
9965f1e1c7
commit
ce2c22676b
40
README.md
40
README.md
@ -64,7 +64,7 @@ int t = inter1.ticks();
|
|||||||
bool stoped = inter1.stoped();
|
bool stoped = inter1.stoped();
|
||||||
|
|
||||||
// start delayed
|
// start delayed
|
||||||
delayed time1 ( [] () {
|
Delayed time1 ( [] () {
|
||||||
cout << "Timeout 1 " << endl;
|
cout << "Timeout 1 " << endl;
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
@ -77,28 +77,6 @@ int t = time1.expired();
|
|||||||
// is it stopped
|
// is it stopped
|
||||||
bool stoped = time1.stoped();
|
bool stoped = time1.stoped();
|
||||||
|
|
||||||
// If you don't want to save in a variable, but you want to start a timer, use these functions
|
|
||||||
// And you can also save them, they are only of the shared pointer type
|
|
||||||
|
|
||||||
auto d = Delayed( [](){
|
|
||||||
cout << "Delayed" << endl;
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
auto p = Periodic( [](){
|
|
||||||
cout << "Periodic" << endl;
|
|
||||||
}, 700);
|
|
||||||
|
|
||||||
Periodic( [&] (){
|
|
||||||
cout << "Delayed expire " << d->expired() << endl;
|
|
||||||
cout << "Periodic ticks " << p->ticks() << endl;
|
|
||||||
cout << "Delayed stoped " << d->stoped() << endl;
|
|
||||||
cout << "Periodic stoped " << p->stoped() << endl;
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
Delayed( [&](){
|
|
||||||
p->stop();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
```
|
```
|
||||||
Make functions asynchronous
|
Make functions asynchronous
|
||||||
|
|
||||||
@ -265,9 +243,9 @@ Events
|
|||||||
* initialization of typed events
|
* initialization of typed events
|
||||||
*/
|
*/
|
||||||
|
|
||||||
trigger<int, int> ev2int;
|
Trigger<int, int> ev2int;
|
||||||
trigger<int, string> evintString;
|
Trigger<int, string> evintString;
|
||||||
trigger<> evoid;
|
Trigger<> evoid;
|
||||||
|
|
||||||
ev2int.on("sum", [](int a, int b) {
|
ev2int.on("sum", [](int a, int b) {
|
||||||
cout << "Sum " << a+b << endl;
|
cout << "Sum " << a+b << endl;
|
||||||
@ -312,14 +290,14 @@ evoid.tick("void"); // nothing is happening
|
|||||||
Extend own class whit events
|
Extend own class whit events
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
class myOwnClass : public trigger<int> {
|
class myOwnClass : public Trigger<int> {
|
||||||
public:
|
public:
|
||||||
myOwnClass() : trigger() {};
|
myOwnClass() : Trigger() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
myOwnClass myclass;
|
myOwnClass myclass;
|
||||||
|
|
||||||
delayed t( [&] {
|
Delayed t( [&] {
|
||||||
myclass.tick("constructed", 1);
|
myclass.tick("constructed", 1);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
@ -334,8 +312,8 @@ Implementing a class with multiple triggers of different types
|
|||||||
```c++
|
```c++
|
||||||
|
|
||||||
class ClassWithTriggers {
|
class ClassWithTriggers {
|
||||||
trigger<int> emitter1;
|
Trigger<int> emitter1;
|
||||||
trigger<string> emitter2;
|
Trigger<string> emitter2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user