From 9d871adb001285944654d99ee8545d31fe3f9f25 Mon Sep 17 00:00:00 2001
From: Kevin Jahns
Date: Tue, 19 Aug 2014 21:51:23 +0200
Subject: [PATCH] more examples
---
.../{IwcDemo/IwcJson.xml => Iwc/IwcYatta.xml} | 0
examples/Iwc/README.md | 38 +++++++++++++++++--
examples/{IwcDemo => Iwc}/index.js | 12 +++++-
examples/IwcDemo/README.md | 38 ++-----------------
examples/{Iwc => IwcDemo}/index1.js | 0
examples/{Iwc => IwcDemo}/index2.js | 0
examples/{Iwc => IwcDemo}/test1.xml | 0
examples/{Iwc => IwcDemo}/test2.xml | 0
examples/PeerJs-Json/index.html | 2 +-
9 files changed, 49 insertions(+), 41 deletions(-)
rename examples/{IwcDemo/IwcJson.xml => Iwc/IwcYatta.xml} (100%)
rename examples/{IwcDemo => Iwc}/index.js (83%)
rename examples/{Iwc => IwcDemo}/index1.js (100%)
rename examples/{Iwc => IwcDemo}/index2.js (100%)
rename examples/{Iwc => IwcDemo}/test1.xml (100%)
rename examples/{Iwc => IwcDemo}/test2.xml (100%)
diff --git a/examples/IwcDemo/IwcJson.xml b/examples/Iwc/IwcYatta.xml
similarity index 100%
rename from examples/IwcDemo/IwcJson.xml
rename to examples/Iwc/IwcYatta.xml
diff --git a/examples/Iwc/README.md b/examples/Iwc/README.md
index 0e0814cb..1855213e 100644
--- a/examples/Iwc/README.md
+++ b/examples/Iwc/README.md
@@ -18,12 +18,44 @@ function init(){
```
-You don't have to use the proposed user_id.
+yatta is the shared json object. If you change something on this object,
+it will be instantly shared with all the other collaborators.
```js
- console.log("me is number 2")
- yatta = new Y.JsonYatta(2, Connector);
+ yatta = new Y.JsonYatta(user_id, Connector);
+```
+
+
+Add a integer-property like this
+
+
+```js
+ yatta.val('x', 7);
+```
+
+
+Get the value of property x like this
+
+
+```js
+ console.log(yatta.val('x') === 7); // true
+```
+
+
+A string property can be either mutable or immutable.
+
+
+```js
+ yatta.val('mutable_string', "text", "mutable");
+ yatta.val('immutable_string', "text", "immutable");
+
+ console.log(yatta.val('immutable_string') === "text"); // true
+ yatta.val('mutable_string').insertText(2,"XXX"); // position, string
+ yatta.val('mutable_string').deleteText(0,1); // position, deletion length
+ console.log(yatta.val('mutable_string').val() === "eXXXxt"); // true
+
+
})
}
diff --git a/examples/IwcDemo/index.js b/examples/Iwc/index.js
similarity index 83%
rename from examples/IwcDemo/index.js
rename to examples/Iwc/index.js
index 3fac3c57..46e16fdd 100644
--- a/examples/IwcDemo/index.js
+++ b/examples/Iwc/index.js
@@ -21,6 +21,16 @@ function init(){
*/
yatta = new Y.JsonYatta(user_id, Connector);
+ /**
+ You may want to get the created DUI client (you must not create two DUI/IWC clients!!),
+ or set an IwcHandler.
+ */
+ var duiclient = yatta.getConnector().duiclient;
+ function iwcHandler (intent) {
+ console.log("Received intent: "+JSON.stringify(intent));
+ }
+ yatta.getConnector().setIwcHandler(iwcHandler);
+
/**
Add a integer-property like this
*/
@@ -42,8 +52,6 @@ function init(){
yatta.val('mutable_string').deleteText(0,1); // position, deletion length
console.log(yatta.val('mutable_string').val() === "eXXXxt"); // true
-
-
})
}
window.onload = init
diff --git a/examples/IwcDemo/README.md b/examples/IwcDemo/README.md
index 1855213e..0e0814cb 100644
--- a/examples/IwcDemo/README.md
+++ b/examples/IwcDemo/README.md
@@ -18,44 +18,12 @@ function init(){
```
-yatta is the shared json object. If you change something on this object,
-it will be instantly shared with all the other collaborators.
+You don't have to use the proposed user_id.
```js
- yatta = new Y.JsonYatta(user_id, Connector);
-```
-
-
-Add a integer-property like this
-
-
-```js
- yatta.val('x', 7);
-```
-
-
-Get the value of property x like this
-
-
-```js
- console.log(yatta.val('x') === 7); // true
-```
-
-
-A string property can be either mutable or immutable.
-
-
-```js
- yatta.val('mutable_string', "text", "mutable");
- yatta.val('immutable_string', "text", "immutable");
-
- console.log(yatta.val('immutable_string') === "text"); // true
- yatta.val('mutable_string').insertText(2,"XXX"); // position, string
- yatta.val('mutable_string').deleteText(0,1); // position, deletion length
- console.log(yatta.val('mutable_string').val() === "eXXXxt"); // true
-
-
+ console.log("me is number 2")
+ yatta = new Y.JsonYatta(2, Connector);
})
}
diff --git a/examples/Iwc/index1.js b/examples/IwcDemo/index1.js
similarity index 100%
rename from examples/Iwc/index1.js
rename to examples/IwcDemo/index1.js
diff --git a/examples/Iwc/index2.js b/examples/IwcDemo/index2.js
similarity index 100%
rename from examples/Iwc/index2.js
rename to examples/IwcDemo/index2.js
diff --git a/examples/Iwc/test1.xml b/examples/IwcDemo/test1.xml
similarity index 100%
rename from examples/Iwc/test1.xml
rename to examples/IwcDemo/test1.xml
diff --git a/examples/Iwc/test2.xml b/examples/IwcDemo/test2.xml
similarity index 100%
rename from examples/Iwc/test2.xml
rename to examples/IwcDemo/test2.xml
diff --git a/examples/PeerJs-Json/index.html b/examples/PeerJs-Json/index.html
index d7f06a78..7e036015 100644
--- a/examples/PeerJs-Json/index.html
+++ b/examples/PeerJs-Json/index.html
@@ -11,7 +11,7 @@
Text Editing Demo
Collaborative text editing with Yatta
-and PeerJs (WebRTC). Open this link in other browsers: Drop me
+and PeerJs (WebRTC).
Yatta is a Framework for Real-Time collaboration on arbitrary data structures.