From abe2dad5214f5259af8ecaba8e6571091b018f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 1 Dec 2021 19:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- function.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/function.php b/function.php index 7d28cc55..3b2ae4c3 100644 --- a/function.php +++ b/function.php @@ -3,8 +3,6 @@ defined('APP_PATH') or define('APP_PATH', realpath(__DIR__ . '/../../')); -use Note\Note; -use Note\Route\Route; use Http\Handler\Router; use JetBrains\PhpStorm\Pure; use Kiri\Abstracts\Config; @@ -16,6 +14,8 @@ use Kiri\Events\EventDispatch; use Kiri\Events\EventProvider; use Kiri\Exception\ConfigException; use Kiri\Kiri; +use Note\Note; +use Note\Route\Route; use Psr\Log\LoggerInterface; use Swoole\Process; use Swoole\WebSocket\Server; @@ -900,6 +900,27 @@ if (!function_exists('di')) { } + +if (!function_exists('interval')) { + + + /** + * @param callable $callback + * @param int $interval + * @param bool $is + */ + function interval(callable $callback, int $interval = 1000, bool $is = false) + { + usleep($interval * 1000); + + $callback(); + + interval($callback, $interval, $is); + } + +} + + if (!function_exists('duplicate')) {