jsynchronous 0.9.2 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Jsynchronous.js
2
2
 
3
- Get your (rapidly changing) data from Node.js->Browser with ease.
3
+ Synchronize your rapidly changing app state with all connected browsers.
4
4
 
5
- Jsynchronous is a real-time data synchronization library. Fast enough for games, flexible enough for science, and tested to precision. Can also handle server->server sync or browser->server sync.
5
+ Jsynchronous ensures all clients see the same data as what’s on your server - even as it changes. Fast enough for games, flexible enough for graph applications, and tested to precision.
6
6
 
7
- Create an array or object in Node.js. Jsynchronous will create an identical variable in connected browsers:
7
+ Register an ordinary javascript array or object with jsynchronous on your Node.js server and an identical copy will become available on connected browsers:
8
8
 
9
9
  ```javascript
10
10
  // Server side
@@ -47,9 +47,13 @@ data.circular.a.b.c = data.circular;
47
47
 
48
48
  const $ynced = jsynchronous(data);
49
49
  ```
50
+
51
+ Jsynchronous can also handle server->server sync, or (experimentally) browser->server sync.
50
52
 
51
53
  # Setting up
52
54
 
55
+ Follow the [example code snippets](https://github.com/siriusastrebe/jsynchronous/tree/master/examples) for easy integration.
56
+
53
57
  Jsynchronous does not lock you into a transportation medium you use whether it be [socket.io](https://socket.io/) [ws](https://www.npmjs.com/package/ws) [Primus](https://www.npmjs.com/package/primus), [EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource), or [webRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API). Any protocol with eventual in-order delivery works. We will be using [ws](https://www.npmjs.com/package/ws) in this example.
54
58
 
55
59
  The server side setup consists of 3 required steps:
@@ -169,7 +173,7 @@ const ws = new WebSocket('ws://localhost:8080');
169
173
  ws.onmessage = (data) => jsynchronous.onmessage(data.data);
170
174
  jsynchronous.send = (data) => ws.send(data);
171
175
 
172
- $ynced = jsynchronous('object');
176
+ const $ynchronized = jsynchronous('object');
173
177
  ```
174
178
 
175
179
  Setting up client->server communication makes your synchronized variables resistant to data loss and desynchronization. By default the client will give you a warning if you don't provide .send on client or .onmessage on server and will halt if messages are missed and no re-synchronization is possible.
@@ -62,7 +62,7 @@ function jsynchronousSetup() {
62
62
  if (jsynchronous.send) {
63
63
  var uniqueId = 'initial' + name;
64
64
  communicateWithBackoff(uniqueId, ['initial', name], function () {
65
- console.log('Unknown jsynchronous variable, requesting initial' + name);
65
+ console.log('Unknown jsynchronous variable, requesting initial' + name);
66
66
  return jsyncs[name] === undefined;
67
67
  }, 2000);
68
68
  } else {
@@ -666,11 +666,6 @@ console.log('Unknown jsynchronous variable, requesting initial' + name);
666
666
 
667
667
  function addSynchronizedVariableMethods(jsync, targetVariable, reservedWords) {
668
668
  // targetVariable will be details.variable if it's synced. Otherwise it should be a stand-in variable
669
- for (var key in clientReservedWords) {
670
- if (typeof targetVariable[key] === 'function') {
671
- delete targetVariable[key];
672
- }
673
- }
674
669
  if (reservedWords === undefined) reservedWords = {}
675
670
  for (var key in clientReservedWords) {
676
671
  if (!reservedWords[key]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsynchronous",
3
- "version": "0.9.2",
3
+ "version": "0.9.5",
4
4
  "author": "Sirius Strebe <siriusastrebe@gmail.com> (http://asksiri.us)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,12 +26,7 @@
26
26
  "homepage": "https://github.com/siriusastrebe/jsynchronous#readme",
27
27
  "main": "jsynchronous.js",
28
28
  "directories": {
29
- "example": "examples",
30
- "test": "tests"
31
- },
32
- "dependencies": {
33
- "express": "^4.17.1",
34
- "socket.io": "^4.1.3",
35
- "socketio": "^1.0.0"
29
+ "examples": "examples",
30
+ "tests": "tests"
36
31
  }
37
32
  }