Documentation and cleanup
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
## Text Editing Example
|
||||
Here, I will give a short overview on how to enable collaborative text editing with the
|
||||
[PeerJs](http://peerjs.com/) Connector and the TextYatta Framework.
|
||||
[PeerJs](http://peerjs.com/) Connector and the TextFramework Framework.
|
||||
|
||||
PeerJs is a Framework that enables you to connect to other peers. You just need the
|
||||
user-id of the peer (browser/client). And then you can connect to it. In this example we will encode
|
||||
the client-id to which this client shall connect, in the url.
|
||||
It should look like this: http://../index.html?user_id
|
||||
|
||||
First you have to include the following libraries in your html file:
|
||||
```
|
||||
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
||||
<script src="../../build/browser/Frameworks/TextYatta.js"></script>
|
||||
<script src="../../build/browser/Frameworks/TextFramework.js"></script>
|
||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
```
|
||||
@@ -27,12 +33,12 @@ Here, we use the PeerJs connector. Its first parameter is the API key that you n
|
||||
```
|
||||
|
||||
|
||||
TextYatta is a shared text object. If you change something on this object,
|
||||
TextFramework is a shared text object. If you change something on this object,
|
||||
it will be instantaneously shared with all the other collaborators.
|
||||
|
||||
|
||||
```js
|
||||
yatta = new Y.TextYatta(user_id, Connector);
|
||||
yatta = new Y.TextFramework(user_id, Connector);
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset=utf-8 />
|
||||
<title>PeerJs Json Example</title>
|
||||
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
||||
<script src="../../build/browser/Frameworks/TextYatta.js"></script>
|
||||
<script src="../../build/browser/Frameworks/TextFramework.js"></script>
|
||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
</head>
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
/**
|
||||
## Text Editing Example
|
||||
Here, I will give a short overview on how to enable collaborative text editing with the
|
||||
[PeerJs](http://peerjs.com/) Connector and the TextYatta Framework.
|
||||
[PeerJs](http://peerjs.com/) Connector and the TextFramework Framework.
|
||||
|
||||
PeerJs is a Framework that enables you to connect to other peers. You just need the
|
||||
user-id of the peer (browser/client). And then you can connect to it. In this example we will encode
|
||||
the client-id to which this client shall connect, in the url.
|
||||
It should look like this: http://../index.html?user_id
|
||||
|
||||
First you have to include the following libraries in your html file:
|
||||
```
|
||||
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
||||
<script src="../../build/browser/Frameworks/TextYatta.js"></script>
|
||||
<script src="../../build/browser/Frameworks/TextFramework.js"></script>
|
||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
```
|
||||
@@ -21,10 +27,10 @@ function init(){
|
||||
*/
|
||||
Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
|
||||
/**
|
||||
TextYatta is a shared text object. If you change something on this object,
|
||||
TextFramework is a shared text object. If you change something on this object,
|
||||
it will be instantaneously shared with all the other collaborators.
|
||||
*/
|
||||
yatta = new Y.TextYatta(user_id, Connector);
|
||||
yatta = new Y.TextFramework(user_id, Connector);
|
||||
|
||||
/**
|
||||
Get the url of this frame. If it has a url-encoded parameter
|
||||
|
||||
Reference in New Issue
Block a user