Made the code more robust.
Extended functionality with helper functions.
This commit is contained in:
29
src/functions.php
Normal file
29
src/functions.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Joop\Asynchronous;
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
if (!function_exists('async_run')) {
|
||||
|
||||
/**
|
||||
* @param callable $function
|
||||
* @param mixed ...$parameters
|
||||
* @return Promise|null
|
||||
*/
|
||||
function async(callable $function, ...$parameters)
|
||||
{
|
||||
return Asynchronous::run($function, ...$parameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('async_cleanup')) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function async_cleanup()
|
||||
{
|
||||
Asynchronous::cleanup();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user