2017 © Pedro Peláez
 

library react-adapter

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

image

icicleio/react-adapter

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  • Monday, December 7, 2015
  • by Trowski
  • Repository
  • 3 Watchers
  • 8 Stars
  • 249 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

React Adapter for Icicle

@icicleio on Twitter Build Status Coverage Status Semantic Version MIT License, (*1)

This library facilitates interoperability between components built for React and Icicle. This library provides an adapter between the differing event loop and promise implementations of the two libraries., (*2)

Requirements
  • PHP 5.5+
Installation

The recommended way to install is with the Composer package manager. (See the Composer installation guide for information on installing and using Composer.), (*3)

Run the following command to use this library in your project:, (*4)

composer require icicleio/react-adapter

You can also manually edit composer.json to add this library as a project requirement., (*5)

// composer.json
{
    "require": {
        "icicleio/react-adapter": "^0.4"
    }
}

ReactLoop

Icicle\ReactAdapter\Loop\ReactLoop is as a direct replacement for the React event loop. It communicates with the active Icicle event loop to provide the same functionality. The class implements React\EventLoop\LoopInterface, so it can be used with any component that requires a React event loop., (*6)

use Icicle\ReactAdapter\Loop\ReactLoop;
use Predis\Async\Client;

// Create the loop adapter.
$loop = new ReactLoop();

// $loop can be used anywhere an instance of React\EventLoop\LoopInterface is required.
$client = new Client('tcp://127.0.0.1:6379', $loop);

ReactPromise

Icicle\ReactAdapter\Promise\ReactPromise creates a promise implementing React\Promise\ExtendedPromiseInterface and React\Promise\ExtendedPromiseInterface from an Icicle awaitable that implements Icicle\Awaitable\Awaitable. This allows awaitables created from Icicle to be used in any component requiring a React promise., (*7)

$iciclePromise = new \Icicle\Awaitable\Promise(function ($resolve, $reject) {
    // Resolver
});

$reactPromise = new \Icicle\ReactAdapter\Promise\ReactPromise($iciclePromise);

Awaitable\adapt()

The Icicle\Awaitable namespace defines a function adapt() that can transform any object with a then(callable $onFulfilled, callable $onRejected) method into an awaitable implementing Icicle\Awaitable\Awaitable. This function can be used to convert a React promise to an Icicle awaitable., (*8)

$reactPromise = new \React\Promise\Promise(function ($resolve, $reject) {
    // Resolver
});

$awaitable = \Icicle\Awaitable\adapt($reactPromise);

See the Awaitable API documentation for more information on Icicle\Awaitable\adapt()., (*9)

The Versions

07/12 2015

dev-master

9999999-dev http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

loop adapter promise

07/12 2015

v0.4.0

0.4.0.0 http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

loop adapter promise

28/08 2015

v0.3.1

0.3.1.0 http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Aaron Piotrowski

loop adapter promise

10/06 2015

v0.3.0

0.3.0.0 http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Aaron Piotrowski

loop adapter promise

31/05 2015

v0.2.0

0.2.0.0 http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Aaron Piotrowski

loop promise adaptor

07/05 2015

v0.1.1

0.1.1.0 http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Aaron Piotrowski

loop promise adaptor

02/04 2015

v0.1.0

0.1.0.0 http://icicle.io

Adapts the event loop and promises of Icicle to interfaces compatible with components built for React.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Aaron Piotrowski

loop promise adaptor