MCPcopy Create free account
hub / github.com/Tracktion/choc / setTimeout

Method setTimeout

choc/javascript/choc_javascript_Timer.h:78–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 int64_t nextTimerID = 0;
77
78 int64_t setTimeout (uint32_t interval)
79 {
80 auto timerID = ++nextTimerID;
81
82 activeTimers[timerID] = choc::messageloop::Timer (interval, [this, timerID]
83 {
84 auto timeIDCopy = timerID; // local copy as this lambda will get deleted..
85 activeTimers.erase (timeIDCopy);
86
87 try
88 {
89 context.invoke ("_choc_invokeTimeout", timeIDCopy);
90 }
91 catch (const choc::javascript::Error& e)
92 {
93 std::cerr << e.what() << std::endl;
94 }
95
96 return false;
97 });
98
99 return timerID;
100 }
101
102 int64_t setInterval (uint32_t interval)
103 {

Callers 1

registerTimerFunctionsFunction · 0.80

Calls 4

TimerClass · 0.85
eraseMethod · 0.80
invokeMethod · 0.80
whatMethod · 0.80

Tested by

no test coverage detected