1. Go to this page and download the library: Download colinhdev/libasyncevent library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
colinhdev / libasyncevent example snippets
use pocketmine\event\Event;
use pocketmine\event\Cancellable;
class MyEvent extends Event implements Cancellable {}
use ColinHDev\libAsyncEvent\AsyncEvent;
use ColinHDev\libAsyncEvent\SomeEventHandlerExecutionTrait;
use pocketmine\event\Event;
use pocketmine\event\Cancellable;
class MyEvent extends Event implements AsyncEvent, Cancellable {
use SomeEventHandlerExecutionTrait;
}
$event = new MyEvent();
$event->call();
$event = new MyEvent();
$event->setCallback(
function (MyEvent $event) : void {
if ($event->isCancelled()) {
// do something
} else {
// do something else
}
}
);
$event->call();
public function onMyEvent(MyEvent $event) : void {
// do something
}
public function onMyEvent(MyEvent $event) : void {
// some synchronous logic here
$event->block();
// some asynchronous logic here
$event->release();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.