added possability to set a Method to call in your class
This commit is contained in:
parent
28f60a1ddb
commit
dcfb3fb9ec
@ -52,6 +52,20 @@ class InvokeScriptCallback implements CallbackListener, UsageInformationAble {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* You can set a Method in your Class to be called with this Variant
|
||||
*
|
||||
* @param \ManiaControl\Callbacks\CallbackListener $callbackListener
|
||||
* @param $methodName
|
||||
*/
|
||||
public function setCallableMethod(CallbackListener $callbackListener, $methodName) {
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener($this->callbackName, $this, function (BaseResponseStructure $callBackData) use (&$callbackListener, &$methodName) {
|
||||
if ($callBackData->getResponseId() == $this->responseId) {
|
||||
call_user_func_array(array($callbackListener, $methodName), array($callBackData));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Generated ResponseId
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user