Skip to content

Commit

Permalink
Update for latest version of Icicle
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Aug 28, 2015
1 parent 053eaea commit 4cda6e8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Changelog

### v0.3.1

- Updates for the latest version of Icicle.

---

### v0.3.0

- Changed named to ReactAdapter.

---

### v0.2.0

- Changes
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# React Adapter for Icicle

[![@icicleio on Twitter](https://img.shields.io/badge/twitter-%40icicleio-5189c7.svg?style=flat-square)](https://twitter.com/icicleio)
[![Build Status](https://img.shields.io/travis/icicleio/ReactAdapter/master.svg?style=flat-square)](https://travis-ci.org/icicleio/ReactAdapter)
[![Coverage Status](https://img.shields.io/coveralls/icicleio/ReactAdapter.svg?style=flat-square)](https://coveralls.io/r/icicleio/ReactAdapter)
[![Semantic Version](https://img.shields.io/github/release/icicleio/ReactAdapter.svg?style=flat-square)](http://semver.org)
[![Build Status](https://img.shields.io/travis/icicleio/react-adapter/master.svg?style=flat-square)](https://travis-ci.org/icicleio/react-adapter)
[![Coverage Status](https://img.shields.io/coveralls/icicleio/react-adapter.svg?style=flat-square)](https://coveralls.io/r/icicleio/react-adapter)
[![Semantic Version](https://img.shields.io/github/release/icicleio/react-adapter.svg?style=flat-square)](http://semver.org)
[![Apache 2 License](https://img.shields.io/packagist/l/icicleio/react-adapter.svg?style=flat-square)](LICENSE)

[![Join the chat at https://gitter.im/icicleio/Icicle](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/icicleio/Icicle)

This library facilitates interoperability between components built for [React](http://reactphp.org) and [Icicle](http://icicle.io). This library provides an adapter between the differing event loop and promise implementations of the two libraries.

##### Requirements
Expand Down Expand Up @@ -74,4 +72,4 @@ $reactPromise = new \React\Promise\Promise(function ($resolve, $reject) {
$iciclePromise = \Icicle\Promise\adapt($reactPromise);
```

See the [Promise API documentation](//github.com/icicleio/Icicle/wiki/Promises) for more information on `Icicle\Promise\adapt()`.
See the [Promise API documentation](//github.com/icicleio/icicle/wiki/Promises) for more information on `Icicle\Promise\adapt()`.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"icicleio/icicle": "^0.5",
"icicleio/icicle": "^0.8",
"react/event-loop": "^0.4",
"react/promise": "^2.2"
},
Expand Down
10 changes: 6 additions & 4 deletions src/Loop/ReactLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
namespace Icicle\ReactAdapter\Loop;

use Icicle\Loop;
use React\EventLoop\LoopInterface;
use React\EventLoop\Timer\TimerInterface;

/**
* Adapts Icicle's event loop to React's event loop interface so components requiring a React loop can be used.
*/
class ReactLoop implements \React\EventLoop\LoopInterface
class ReactLoop implements LoopInterface
{
/**
* @var \Icicle\Loop\Events\SocketEventInterface[]
Expand Down Expand Up @@ -127,7 +129,7 @@ public function addPeriodicTimer($interval, callable $callback)
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function cancelTimer(\React\EventLoop\Timer\TimerInterface $timer)
public function cancelTimer(TimerInterface $timer)
{
// No-op since the ReactTimer adapter class will not call this method.
}
Expand All @@ -136,7 +138,7 @@ public function cancelTimer(\React\EventLoop\Timer\TimerInterface $timer)
* {@inheritdoc}
* @codeCoverageIgnore
*/
public function isTimerActive(\React\EventLoop\Timer\TimerInterface $timer)
public function isTimerActive(TimerInterface $timer)
{
// No-op since the ReactTimer adapter class will not call this method.
}
Expand All @@ -146,7 +148,7 @@ public function isTimerActive(\React\EventLoop\Timer\TimerInterface $timer)
*/
public function nextTick(callable $listener)
{
Loop\schedule($listener, $this);
Loop\queue($listener, $this);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Promise/ReactPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
namespace Icicle\ReactAdapter\Promise;

use Icicle\Promise\PromiseInterface;
use React\Promise\LazyPromise;

class ReactPromise extends \React\Promise\LazyPromise
class ReactPromise extends LazyPromise
{
/**
* @param \Icicle\Promise\PromiseInterface $promise
Expand Down
4 changes: 2 additions & 2 deletions tests/Promise/ReactPromiseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testConstructWithPendingThatFulfills()
$value = 1;

$promise = new Promise\Promise(function ($resolve, $reject) use ($value) {
Loop\schedule($resolve, $value);
Loop\queue($resolve, $value);
});

$promise = new ReactPromise($promise);
Expand All @@ -72,7 +72,7 @@ public function testConstructWithPendingThatRejects()
$exception = new Exception();

$promise = new Promise\Promise(function ($resolve, $reject) use ($exception) {
Loop\schedule($reject, $exception);
Loop\queue($reject, $exception);
});

$promise = new ReactPromise($promise);
Expand Down

0 comments on commit 4cda6e8

Please sign in to comment.