Chris noccy

noccylabs/react-utilities (0.1.0)

Published 2025-08-10 13:35:07 +00:00 by noccy in noccy/react-utilities

Installation

{
	"repositories": [{
			"type": "composer",
			"url": ""
		}
	]
}
composer require noccylabs/react-utilities:0.1.0

About this package

Some quality of life utilities for ReactPHP

ReactPHP Utilities

Installing

$ composer set repositories.noccylabs \
  '{"type":"composer","url":"https://dev.noccylabs.info/api/packages/noccylabs/composer"}'
$ composer require noccylabs/react-utilities

Functions

NoccyLabs\React\Utilities\defer(callable $cb)

This function is an alias for Loop::futureTick.

NoccyLabs\React\Utilities\enqueue(callable $cb)

This function is a concurrency-friendly alternative to defer. If there is already a callback in the futureTick queue, this callback will be pushed to the end of an internal queue. Whenever an enqueued() callback is evaluated, if there is another callback in the queue, the next callback will be moved to the futureTick queue.

If you add 10 callbacks with defer() (or Loop::futureTick()) they will be enqueued and evaluated one after another, effectively immediately. This will block any yielding, and any other code-path that makes use of defer() will have to wait until the previous 10 callbacks have been evaluated.

Dependencies

Dependencies

ID Version
react/event-loop ^1.5
Details
Composer
2025-08-10 13:35:07 +00:00
2
Christopher Vagnetoft
GPL-2.0-or-later
9.8 KiB
Assets (1)
Versions (2) View all
0.1.1 2025-08-10
0.1.0 2025-08-10