sendCommand() public method

Send a command
public sendCommand ( string $method, array $params, callable $callback ) : void
$method string the method name
$params array the method params
$callback callable the callback
return void
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function on($eventName, callable $eventHandler)
 {
     $eventName = 'on' . $eventName;
     $this->application->sendCommand('setObjectEventListener', [$this->lazarusObjectId, $eventName], function ($result) {
         // Ok, the event listener created
     });
     if (!array_key_exists($eventName, $this->eventHandlers)) {
         $this->eventHandlers[$eventName] = [];
     }
     $this->eventHandlers[$eventName][] = $eventHandler;
 }