more example

This commit is contained in:
Kevin Jahns
2014-08-20 17:13:12 +02:00
parent 9e6c238870
commit 974d2ba0de
16 changed files with 80 additions and 23 deletions

View File

@@ -22,6 +22,14 @@ Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
```
You can also specify your own user_id with peerjs. But you have to make sure that no other client has this user_id.
```js
// Y.createPeerJsConnector("unique_id", {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.
@@ -147,7 +155,7 @@ Does not fire for nested properties.
```js
yatta.val('q').val('z', 8); // No output!
yatta.val('new').val('z', 8); // No output!
```
@@ -168,7 +176,7 @@ Apply 'insert' and 'delete' - listeners to Words.
yatta.deleteListener('addProperty', addProperty);
yatta.deleteListener('change', change);
yatta.deleteListener('insert_delete', insert_delete);
yatta.val('mutable_string').deleteListener('insert_delete', insert_delete);
```

View File

@@ -19,6 +19,13 @@ Therefore, you may also specify the server/port here, if you have set up your ow
*/
var yatta, yattaHandler;
Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
/**
You can also specify your own user_id with peerjs. But you have to make sure that no other client has this user_id.
*/
// Y.createPeerJsConnector("unique_id", {key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
/**
### Yatta
yatta is the shared json object. If you change something on this object,
@@ -110,7 +117,7 @@ Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
/**
Does not fire for nested properties.
*/
yatta.val('q').val('z', 8); // No output!
yatta.val('new').val('z', 8); // No output!
/**
Apply 'insert' and 'delete' - listeners to Words.
@@ -128,7 +135,7 @@ Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
yatta.deleteListener('addProperty', addProperty);
yatta.deleteListener('change', change);
yatta.deleteListener('insert_delete', insert_delete);
yatta.val('mutable_string').deleteListener('insert_delete', insert_delete);
/**