定制 danog/async-construct 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

danog/async-construct

Composer 安装命令:

composer require danog/async-construct

包简介

Async class constructor and wakeup functions for AMPHP.

README 文档

README

Build status codecov License

danog/asyncConstruct provides async class constructor and wakeup functions for AMPHP.

Installation

composer require danog/async-construct

API

AsyncConstruct

Example

Simply use this trait in your class, and define a __construct_async async method.
The trait will automatically run the async method on construction, and expose a set of APIs to wait on the result of the constructor for initialization.

init()

Will blockingly wait for execution of the async constructor, returning its return value.

initAsynchronously()

Will return a promise that, when yielded, will wait for and return the return value of the constructor.

inited()

Returns a boolean, indicating whether the class was initialized or not.

BlockingConstruct

Example

Exactly like AsyncConstruct, except that the blocking init() function will be automatically called on construction.

AsyncWakeup

Example

Simply use this trait in your class, and define a __wakeup_async async method.
The trait will automatically run the async method on deserialization, and expose a set of APIs to wait on the result of the wakeup function for re-initialization.

wakeup()

Will blockingly wait for execution of the async wakeup function, returning its return value.

wakeupAsynchronously()

Will return a promise that, when yielded, will wait for and return the return value of the wakeup function.

wokenUp()

Returns a boolean, indicating whether the class was initialized or not.

BlockingWakeup

Example

Exactly like AsyncWakeup, except that the blocking wakeup() function will be automatically called on wakeup.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固