This commit is contained in:
2021-08-24 18:10:07 +08:00
parent 2db271dab3
commit 575f4b8520
80 changed files with 6 additions and 6 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace Kiri;
use Exception;
use Http\IInterface\Task;
use ReflectionException;
use Kiri\Abstracts\Component;
use Server\ServerManager;
use Server\SInterface\TaskExecute;
/**
* Class Async
* @package Kiri
*/
class Async extends Component
{
private static array $_absences = [];
/**
* @param string $name
* @param string $handler
*/
public function addAsync(string $name, string $handler)
{
static::$_absences[$name] = $handler;
}
/**
* @param string $name
* @param array $params
* @throws Exception
*/
public function dispatch(string $name, array $params = [])
{
$context = di(ServerManager::class);
$context->task(static::$_absences[$name], $params);
}
}