fixed twice-running one-time timer listening
This commit is contained in:
parent
55cc74ec84
commit
6fbeab1cd6
@ -32,6 +32,9 @@ class TimerListening extends Listening {
|
|||||||
|
|
||||||
$this->deltaTime = $milliSeconds / 1000.;
|
$this->deltaTime = $milliSeconds / 1000.;
|
||||||
$this->oneTime = (bool)$oneTime;
|
$this->oneTime = (bool)$oneTime;
|
||||||
|
if ($this->oneTime) {
|
||||||
|
$this->lastTrigger = time(true);
|
||||||
|
}
|
||||||
$this->instantCall = (bool)$instantCall;
|
$this->instantCall = (bool)$instantCall;
|
||||||
if (!$this->instantCall) {
|
if (!$this->instantCall) {
|
||||||
$this->lastTrigger = microtime(true);
|
$this->lastTrigger = microtime(true);
|
||||||
|
@ -55,11 +55,20 @@ class TimerManager {
|
|||||||
|
|
||||||
// Build Timer Listening
|
// Build Timer Listening
|
||||||
$listening = new TimerListening($listener, $method, $milliSeconds, $oneTime);
|
$listening = new TimerListening($listener, $method, $milliSeconds, $oneTime);
|
||||||
array_push($this->timerListenings, $listening);
|
$this->addTimerListening($listening);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a Listening to the current List of managed Timers
|
||||||
|
*
|
||||||
|
* @param TimerListening $timerListening
|
||||||
|
*/
|
||||||
|
public function addTimerListening(TimerListening $timerListening) {
|
||||||
|
array_push($this->timerListenings, $timerListening);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregister a Timer Listening
|
* Unregister a Timer Listening
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user