PHP Interface Kraken\Loop\LoopInterface

Afficher le fichier Open project: kraken-php/framework Interface Usage Examples

Méthodes publiques

Méthode Description
addPeriodicTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface Enqueue a callback to be invoked repeatedly after the given interval.
addReadStream ( resource $stream, callable $listener ) Register a listener to be notified when a stream is ready to read.
addTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface Enqueue a callback to be invoked once after the given interval.
addWriteStream ( resource $stream, callable $listener ) Register a listener to be notified when a stream is ready to write.
cancelTimer ( Kraken\Loop\Timer\TimerInterface $timer ) Cancel a pending timer.
isRunning ( ) : boolean Check if loop is currently running.
isTimerActive ( Kraken\Loop\Timer\TimerInterface $timer ) : boolean Check if a given timer is active.
onAfterTick ( callable $listener ) Schedule a callback to be invoked on a future tick of the event loop.
onBeforeTick ( callable $listener ) Schedule a callback to be invoked on the next tick of the event loop.
onStart ( callable $listener ) Schedule a callback to be invoked on the start tick of event loop.
onStop ( callable $listener ) Schedule a callback to be invoked on the stop tick of event loop.
onTick ( callable $listener ) Schedule a callback to be invoked on a future tick of the event loop.
removeReadStream ( resource $stream ) Remove the read event listener for the given stream.
removeStream ( resource $stream ) Remove all listeners for the given stream.
removeWriteStream ( resource $stream ) Remove the write event listener for the given stream.

Method Details

addPeriodicTimer() public méthode

The execution order of timers scheduled to execute at the same time is not guaranteed.
public addPeriodicTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface
$interval float
$callback callable
Résultat Kraken\Loop\Timer\TimerInterface

addReadStream() public méthode

Register a listener to be notified when a stream is ready to read.
public addReadStream ( resource $stream, callable $listener )
$stream resource
$listener callable

addTimer() public méthode

The execution order of timers scheduled to execute at the same time is not guaranteed.
public addTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface
$interval float
$callback callable
Résultat Kraken\Loop\Timer\TimerInterface

addWriteStream() public méthode

Register a listener to be notified when a stream is ready to write.
public addWriteStream ( resource $stream, callable $listener )
$stream resource
$listener callable

cancelTimer() public méthode

Cancel a pending timer.
public cancelTimer ( Kraken\Loop\Timer\TimerInterface $timer )
$timer Kraken\Loop\Timer\TimerInterface

isRunning() public méthode

Check if loop is currently running.
public isRunning ( ) : boolean
Résultat boolean

isTimerActive() public méthode

Check if a given timer is active.
public isTimerActive ( Kraken\Loop\Timer\TimerInterface $timer ) : boolean
$timer Kraken\Loop\Timer\TimerInterface
Résultat boolean

onAfterTick() public méthode

Callbacks are guaranteed to be executed in the order they are enqueued.
public onAfterTick ( callable $listener )
$listener callable

onBeforeTick() public méthode

Callbacks are guaranteed to be executed in the order they are enqueued, before any timer or stream events.
public onBeforeTick ( callable $listener )
$listener callable

onStart() public méthode

Callbacks are guarenteed to be executed in the order they are enqueued, before anything else.
public onStart ( callable $listener )
$listener callable

onStop() public méthode

Callbacks are guarenteed to be executed in the order they are enqueued.
public onStop ( callable $listener )
$listener callable

onTick() public méthode

Callbacks are guaranteed to be executed in the order they are enqueued. This method is an alias for onAfterTick() method.
public onTick ( callable $listener )
$listener callable

removeReadStream() public méthode

Remove the read event listener for the given stream.
public removeReadStream ( resource $stream )
$stream resource

removeStream() public méthode

Remove all listeners for the given stream.
public removeStream ( resource $stream )
$stream resource

removeWriteStream() public méthode

Remove the write event listener for the given stream.
public removeWriteStream ( resource $stream )
$stream resource