change name
This commit is contained in:
parent
bba92f6a73
commit
d5c7d51dc4
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Yatta",
|
||||
"version": "0.2.0",
|
||||
"name": "Y",
|
||||
"version": "0.2.3",
|
||||
"homepage": "https://github.com/DadaMonad/Yatta",
|
||||
"authors": [
|
||||
"Kevin Jahns <kevin.jahns@rwth-aachen.de>"
|
||||
|
21
examples/XMPP/index.html
Normal file
21
examples/XMPP/index.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=utf-8 />
|
||||
<title>PeerJs Json Example</title>
|
||||
<script src="../../../Yatta-Connectors/xmpp-connector/xmpp-connector.js"></script>
|
||||
<script src="../../build/browser/yatta.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 contentEditable> PeerJs + Json Tutorial</h1>
|
||||
<p> Collaborative Json editing with <a href="https://github.com/DadaMonad/Yatta/">Yatta</a>
|
||||
and <a href="http://peerjs.com/">PeerJs</a> (WebRTC). </p>
|
||||
|
||||
<textarea style="width:80%;" rows=40 id="textfield"></textarea>
|
||||
|
||||
<p> <a href="https://github.com/DadaMonad/Yatta/">Yatta</a> is a Framework for Real-Time collaboration on arbitrary data structures.
|
||||
You can find the code for this example <a href="https://github.com/DadaMonad/Yatta/tree/master/examples/PeerJs-Json">here</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
60
examples/XMPP/index.js
Normal file
60
examples/XMPP/index.js
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
/**
|
||||
## PeerJs + JSON Example
|
||||
Here, I will give a short overview on how to enable collaborative json with the
|
||||
[PeerJs](http://peerjs.com/) Connector and the Json Framework. Open
|
||||
[index.html](http://dadamonad.github.io/Yatta/examples/PeerJs-Json/index.html) in your Browser and
|
||||
use the console to explore Yatta!
|
||||
|
||||
[PeerJs](http://peerjs.com) 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.
|
||||
|
||||
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/JsonFramework.js"></script>
|
||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
```
|
||||
### 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](http://peerjs.com/peerserver).
|
||||
The first parameter of `createPeerJsConnector` is forwarded as the options object in PeerJs.
|
||||
Therefore, you may also specify the server/port here, if you have set up your own server.
|
||||
*/
|
||||
var yatta, yattaHandler;
|
||||
|
||||
/**
|
||||
This will connect to the server owned by the peerjs team.
|
||||
For now, you can use my API key.
|
||||
*/
|
||||
|
||||
connector = new XMPPConnector("testy-xmpp-json2");
|
||||
connector.debug = true
|
||||
/**
|
||||
### Yatta
|
||||
yatta is the shared json object. If you change something on this object,
|
||||
it will be instantly shared with all the other collaborators.
|
||||
*/
|
||||
yatta = new Yatta(connector);
|
||||
|
||||
window.onload = function(){
|
||||
var textbox = document.getElementById("textfield");
|
||||
yatta.observe(function(events){
|
||||
for(var i=0; i<events.length; i++){
|
||||
var event = events[i];
|
||||
if(event.name === "textfield" && event.type !== "delete"){
|
||||
yatta.val("textfield").bind(textbox);
|
||||
yatta.val("headline").bind(document.querySelector("h1"))
|
||||
}
|
||||
}
|
||||
});
|
||||
connector.whenSynced(function(){
|
||||
if(yatta.val("textfield") == null){
|
||||
yatta.val("headline","headline", "mutable");
|
||||
yatta.val("textfield","stuff", "mutable")
|
||||
}
|
||||
})
|
||||
|
||||
};
|
26
npm-debug.log
Normal file
26
npm-debug.log
Normal file
@ -0,0 +1,26 @@
|
||||
0 info it worked if it ends with ok
|
||||
1 verbose cli [ '/home/codio/.nvm/v0.10.33/bin/node',
|
||||
1 verbose cli '/home/codio/.nvm/v0.10.33/bin/npm',
|
||||
1 verbose cli 'adduser' ]
|
||||
2 info using npm@1.4.28
|
||||
3 info using node@v0.10.33
|
||||
4 error Error: canceled
|
||||
4 error at Interface.<anonymous> (/home/codio/.nvm/v0.10.33/lib/node_modules/npm/node_modules/read/lib/read.js:66:13)
|
||||
4 error at Interface.emit (events.js:92:17)
|
||||
4 error at Interface._ttyWrite (readline.js:620:16)
|
||||
4 error at ReadStream.onkeypress (readline.js:99:10)
|
||||
4 error at ReadStream.emit (events.js:98:17)
|
||||
4 error at emitKey (readline.js:1095:12)
|
||||
4 error at ReadStream.onData (readline.js:840:14)
|
||||
4 error at ReadStream.emit (events.js:95:17)
|
||||
4 error at ReadStream.<anonymous> (_stream_readable.js:764:14)
|
||||
4 error at ReadStream.emit (events.js:92:17)
|
||||
5 error If you need help, you may report this *entire* log,
|
||||
5 error including the npm and node versions, at:
|
||||
5 error <http://github.com/npm/npm/issues>
|
||||
6 error System Linux 3.16.0-23-generic
|
||||
7 error command "/home/codio/.nvm/v0.10.33/bin/node" "/home/codio/.nvm/v0.10.33/bin/npm" "adduser"
|
||||
8 error cwd /home/codio/workspace/Yatta
|
||||
9 error node -v v0.10.33
|
||||
10 error npm -v 1.4.28
|
||||
11 verbose exit [ 1, true ]
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yatta",
|
||||
"version": "0.2.1",
|
||||
"name": "Y",
|
||||
"version": "0.2.3",
|
||||
"description": "A Framework that enables Real-Time Collaboration on arbitrary data structures.",
|
||||
"main": "./build/node/yatta.js",
|
||||
"scripts": {
|
||||
@ -25,7 +25,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/DadaMonad/Yatta/issues"
|
||||
},
|
||||
"homepage": "https://dadamonad.github.io/Yattay/",
|
||||
"homepage": "https://dadamonad.github.io/Yatta/",
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user