diff --git a/examples/PeerJs-Json/README.md b/examples/PeerJs-Json/README.md index 233aafee..dc3cce8e 100644 --- a/examples/PeerJs-Json/README.md +++ b/examples/PeerJs-Json/README.md @@ -11,6 +11,11 @@ First you have to include the following libraries in your html file: ``` A working widget implementation is [IwcJson.xml](./IwcJson.xml) and the js-file is [index.js](./index.js) +### Create Connector + +The PeerJs Framework requires an API key, or you need to set up your own PeerJs server. +Get an API key from the Website. +The first parameter of `createPeerJsConnector` is the options object in PeerJs. ```js @@ -19,13 +24,13 @@ Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){ ``` +### Yatta yatta is the shared json object. If you change something on this object, it will be instantly shared with all the other collaborators. ```js - yattaHandler = new Y.JsonYatta(user_id, Connector); - yatta = yattaHandler.getSharedObject(); + yatta = new Y.JsonYatta(user_id, Connector); ``` @@ -156,6 +161,7 @@ Apply 'insert' and 'delete' - listeners to Words. ``` +### Experimental method But there is a much more convenient way! diff --git a/examples/PeerJs-Json/index.js b/examples/PeerJs-Json/index.js index bc6e2def..fb64d9c4 100644 --- a/examples/PeerJs-Json/index.js +++ b/examples/PeerJs-Json/index.js @@ -13,15 +13,20 @@ ``` A working widget implementation is [IwcJson.xml](./IwcJson.xml) and the js-file is [index.js](./index.js) +### Create Connector + +The PeerJs Framework requires an API key, or you need to set up your own PeerJs server. +Get an API key from the Website. +The first parameter of `createPeerJsConnector` is the options object in PeerJs. */ var yatta, yattaHandler; Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){ /** + ### Yatta yatta is the shared json object. If you change something on this object, it will be instantly shared with all the other collaborators. */ - yattaHandler = new Y.JsonYatta(user_id, Connector); - yatta = yattaHandler.getSharedObject(); + yatta = new Y.JsonYatta(user_id, Connector); /** Add a integer-property like this @@ -119,6 +124,7 @@ Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){ /** + ### Experimental method But there is a much more convenient way! */ console.log(yatta.value.list[2] === 3) // true