wyrihaximus/recoil-promise-coroutine-wrapper

围绕 WyriHaximus/recoil-queue-caller(-pool) 的简单 API

1.0.0 2019-05-24 15:19 UTC

This package is auto-updated.

Last update: 2024-09-03 19:17:53 UTC


README

Build Status Latest Stable Version Total Downloads Code Coverage License PHP 7 ready

安装

要通过 Composer 安装,请使用以下命令,它将自动检测最新版本并将其绑定到 ^

composer require WyriHaximus/recoil-promise-coroutine-wrapper

用法

// Have the event loop ready
$loop = Factory::create();

// Create the wrapper from the event loop, internally this will set up all the required comonents
$wrapper = PromiseCoroutineWrapper::createFromLoop($loop);

// Execute a coroutine and get the result through a promise (the irony)
$result = $wrapper->call(function (LoopInterface $loop, int $wait) {
    yield timedPromise($loop, $wait);
    
    return $wait;
}, $loop, $wait)

许可证

MIT 许可证 (MIT)

版权 (c) 2019 Cees-Jan Kiewiet

以下是对任何获得此软件及其相关文档副本(“软件”)的人的免费许可,允许在不限制的情况下处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许向提供软件的人提供这样做,前提是遵守以下条件

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

软件按“原样”提供,不提供任何类型的保证,明示或暗示的,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任负责,无论这些责任是基于合同、侵权或其他原因,是否与软件或其使用或其他方式有关。