Skip to content

Commit

Permalink
use a less bloated signals library for React Native compatibility (an…
Browse files Browse the repository at this point in the history
…droid)
  • Loading branch information
endel committed May 1, 2018
1 parent 306bf17 commit b7fe828
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -119,12 +119,10 @@ dependencies for compatibility and assign `window.localStorage` to
`AsyncStorage`.

- Install `react-native-browser-polyfill` (`npm install react-native-browser-polyfill`)
- Install and follow [`rn-nodeify`](https://github.com/tradle/rn-nodeify) installation instructions (`npm install rn-nodeify`)

```
// App.js
import 'react-native-browser-polyfill';
import './shim';
import { AsyncStorage } from 'react-native';
window.localStorage = AsyncStorage;
```
Expand Down
2 changes: 1 addition & 1 deletion dist/colyseus.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/index.html
Expand Up @@ -23,7 +23,7 @@

<script>
var host = window.document.location.host.replace(/:.*/, '');
var client = new Colyseus.Client('ws://' + host + ':8080');
var client = new Colyseus.Client('ws://' + host + ':2567');
var room;

function request () {
Expand Down Expand Up @@ -56,6 +56,10 @@
console.log('joined!');
})

room.onMessage.add(function(message) {
console.log(room.sessionId, message);
});

room.onLeave.add(function() {
console.log("LEFT ROOM", arguments);
});
Expand Down
6 changes: 3 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "colyseus.js",
"version": "0.9.1",
"version": "0.9.2",
"description": "Multiplayer Game Client for the Browser",
"keywords": [
"multiplayer",
Expand Down Expand Up @@ -29,11 +29,11 @@
},
"dependencies": {
"@gamestdio/clock": "^1.1.0",
"@gamestdio/signals": "^1.0.0",
"@gamestdio/state-listener": "^3.0.0",
"@gamestdio/websocket": "^0.2.5",
"fossil-delta": "^1.0.0",
"notepack.io": "^2.1.2",
"signals.js": "^1.0.0"
"notepack.io": "^2.1.2"
},
"devDependencies": {
"@types/chai": "^3.4.34",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.ts
@@ -1,5 +1,5 @@
import * as msgpack from 'notepack.io';
import { Signal } from 'signals.js';
import { Signal } from '@gamestdio/signals';

import { Connection } from './Connection';
import { Protocol } from './Protocol';
Expand Down
2 changes: 1 addition & 1 deletion src/Room.ts
@@ -1,5 +1,5 @@
import Clock = require('@gamestdio/clock');
import { Signal } from 'signals.js';
import { Signal } from '@gamestdio/signals';

import { StateContainer } from '@gamestdio/state-listener';
import * as fossilDelta from 'fossil-delta';
Expand Down

0 comments on commit b7fe828

Please sign in to comment.