Compare commits

..

10 Commits

Author SHA1 Message Date
Kevin Jahns
14a3fbc638 changed to memory adapter 2015-11-15 02:13:32 +01:00
Kevin Jahns
4efc428ce0 Deploy 0.6.40 2015-11-15 02:11:41 +01:00
Kevin Jahns
ded8ef07bb Deploy 0.6.39 2015-11-15 02:09:37 +01:00
Kevin Jahns
dcf6212436 example update 2015-11-11 17:18:57 +01:00
Kevin Jahns
acfce06912 removed disconnect button for example 2015-11-10 18:38:21 +01:00
Kevin Jahns
6c13be376f updated examples 2015-11-09 03:04:03 +01:00
Kevin Jahns
0292181830 Deploy 0.6.36 2015-11-07 22:17:25 +01:00
Kevin Jahns
93a3ff3d6e Deploy 0.6.32 2015-11-05 17:08:57 +01:00
Kevin Jahns
5116d70adb Deploy 0.6.25 2015-11-04 16:57:35 +01:00
Kevin Jahns
e2e89e198f outsourced examples 2015-11-04 16:52:31 +01:00
11 changed files with 5530 additions and 47 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
node_modules
Examples/bower_components
.directory
.codio
.settings
.jshintignore
.jshintrc
.validate.json

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<body>
<textarea style="width:80%;" rows=40 id="textfield"></textarea>
<script src="../bower_components/yjs/y.js"></script>
<script src="./index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,38 @@
/* global Y */
// create a shared object. This function call will return a promise!
Y({
db: {
name: 'memory',
namespace: 'offlineEditingDemo'
},
connector: {
name: 'websockets-client',
room: 'offlineEditingDemo',
debug: true
},
types: ['Array', 'Text'],
sourceDir: '/bower_components'
}).then(function (yconfig) {
// yconfig holds all the information about the shared object
window.yconfig = yconfig
// now we bind the textarea and the contenteditable h1 element
// to a shared element
var textarea = document.getElementById('textfield')
yconfig.root.observePath(['text'], function (text) {
// every time the 'text' property of the yconfig.root changes,
// this function is called. Then we bind it to the html elements
if (text != null) {
// when the text property is deleted, text may be undefined!
// This is why we have to check if text exists..
text.bind(textarea)
}
})
// create a shared Text
var textpromise = yconfig.root.get('text')
if (textpromise == null) {
// Set the text type if it does not yet exist
yconfig.root.set('text', Y.Text)
}
})

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<button id="button">Disconnect</button>
<h1 id="contenteditable" contentEditable></h1>
<textarea style="width:80%;" rows=40 id="textfield"></textarea>
<script src="../bower_components/yjs/y.js"></script>
<script src="./index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,49 @@
/* global Y */
// create a shared object. This function call will return a promise!
Y({
db: {
name: 'memory'
},
connector: {
name: 'webrtc',
room: 'offlineEditingDemo',
debug: true
},
types: ['Array', 'Text'],
sourceDir: '/bower_components/'
}).then(function (yconfig) {
// yconfig holds all the information about the shared object
window.yconfig = yconfig
// yconfig.root holds the shared element
window.y = yconfig.root
// now we bind the textarea and the contenteditable h1 element
// to a shared element
var textarea = document.getElementById('textfield')
var contenteditable = document.getElementById('contenteditable')
yconfig.root.observePath(['text'], function (text) {
// every time the 'text' property of the yconfig.root changes,
// this function is called. Then we bind it to the html elements
if (text != null) {
// when the text property is deleted, text may be undefined!
// This is why we have to check if text exists..
text.bind(textarea)
text.bind(contenteditable)
}
})
// create a shared Text
yconfig.root.set('text', Y.Text)
// We also provide a button for disconnecting/reconnecting the shared element
var button = document.querySelector('#button')
button.onclick = function () {
if (button.innerText === 'Disconnect') {
yconfig.disconnect()
button.innerText = 'Reconnect'
} else {
yconfig.reconnect()
button.innerText = 'Disconnect'
}
}
})

14
Examples/bower.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "yjs-examples",
"version": "0.0",
"homepage": "y-js.org",
"authors": [
"Kevin Jahns <kevin.jahns@rwth-aachen.de>"
],
"description": "Examples for yjs",
"license": "MIT",
"ignore": [],
"dependencies": {
"yjs": "../"
}
}

View File

@@ -1,30 +1,30 @@
# ![Yjs](http://y-js.org/files/layout/yjs.svg)
[![Build Status](https://travis-ci.org/y-js/yjs.svg)](https://travis-ci.org/y-js/yjs)
Yjs is a framework for optimistic concurrency control and automatic conflict resolution on shared data types. The framework implements a new OT-like concurrency algorithm and provides similar functionality as [ShareJs] and [OpenCoweb]. Yjs was designed to handle concurrent actions on arbitrary complex data types like Text, Json, and XML. We provide a tutorial and some applications for this framework on our [homepage](http://y-js.org/).
**NOTE** This project is currently migrating. So there may exist some information that is not true anymore..
You can create you own shared types easily. Therefore, you can take matters into your own hand by defining the meaning of the shared types and ensure that it is valid, while Yjs ensures data consistency (everyone will eventually end up with the same data). We already provide data types for
| Name | Description
| ---------------------------------------------------- | ---------------------------------------------
y-object | Add, update, and remove properties of an object. Circular references are supported. Included in Yjs
[y-list](https://github.com/y-js/y-list) | A shared linked list implementation. Circular references are supported
[y-selections](https://github.com/y-js/y-selections) | Manages selections on types that use linear structures (e.g. the y-list type). You can select a range of elements and assign meaning to them.
[y-xml](https://github.com/y-js/y-xml) | An implementation of the DOM. You can create a two way binding to Browser DOM objects
[y-text](https://github.com/y-js/y-text) | Collaborate on text. You can create a two way binding to textareas, input elements, or HTML elements (e.g. *h1*, or *p*)
[y-richtext](https://github.com/y-js/y-richtext) | Collaborate on rich text. You can create a two way binding to several editors
| Name | Description |
|----------|-------------------|
| map | Add, update, and remove properties of an object. Included in Yjs|
|[array](https://github.com/y-js/y-array) | A shared linked list implementation |
|[selections](https://github.com/y-js/y-selections) | Manages selections on types that use linear structures (e.g. the y-array type). Select a range of elements, and assign meaning to them.|
|[xml](https://github.com/y-js/y-xml) | An implementation of the DOM. You can create a two way binding to Browser DOM objects|
|[text](https://github.com/y-js/y-text) | Collaborate on text. Supports two way binding to textareas, input elements, or HTML elements (e.g. *h1*, or *p*)|
|[richtext](https://github.com/y-js/y-richtext) | Collaborate on rich text. Supports two way binding to several editors|
Unlike other frameworks, Yjs supports P2P message propagation and is not bound to a specific communication protocol. Therefore, Yjs is extremely scalable and can be used in a wide range of application scenarios.
We support several communication protocols as so called *Connectors*. You can create your own connector too - read [this wiki page](https://github.com/y-js/yjs/wiki/Custom-Connectors). Currently, we support the following communication protocols:
Name | Description
---------------------------------------- | -------------------------------------------------------
[y-xmpp](https://github.com/y-js/y-xmpp) | Propagate updates in a XMPP multi-user-chat room ([XEP-0045](http://xmpp.org/extensions/xep-0045.html))
[y-webrtc](https://github.com/y-js/y-webrtc) | Propagate updates Browser2Browser via WebRTC
[y-test](https://github.com/y-js/y-test) | A Connector for testing purposes. It is designed to simulate delays that happen in worst case scenarios
|Name | Description |
|----------------|-----------------------------------|
|[xmpp](https://github.com/y-js/y-xmpp) | Propagate updates in a XMPP multi-user-chat room ([XEP-0045](http://xmpp.org/extensions/xep-0045.html))|
|[webrtc](https://github.com/y-js/y-webrtc) | Propagate updates Browser2Browser via WebRTC|
|[test](https://github.com/y-js/y-test) | A Connector for testing purposes. It is designed to simulate delays that happen in worst case scenarios|
You can use Yjs client-, and server- side. You can get it as via npm, and bower. We even provide polymer elements for Yjs!
@@ -36,7 +36,6 @@ The advantages over similar frameworks are support for
* .. AnyUndo: Undo *any* action that was executed in constant time (coming..)
* .. Intention Preservation: When working on Text, the intention of your changes are preserved. This is particularily important when working offline. Every type has a notion on how we define Intention Preservation on it.
## Use it!
You can find a tutorial, and examples on the [website](http://y-js.org). Furthermore, the [github wiki](https://github.com/y-js/yjs/wiki) offers more information about how you can use Yjs in your application.
@@ -122,7 +121,7 @@ There are some friendly people on [![Gitter](https://badges.gitter.im/Join%20Cha
Please report _any_ issues to the [Github issue page](https://github.com/y-js/yjs/issues)! I try to fix them very soon, if possible.
## Changelog
##### 1.0
### 1.0
This is a complete rewrite of the 0.5 version of Yjs. Since Yjs 1.0 it is possible to work asynchronously on a persistent database, which enables offline support.
* Switched to semver versioning
* Requires a promise implementation in environment (es6 promises suffice, included in all the major browsers). Otherwise you have to include a polyfill
@@ -142,4 +141,5 @@ Yjs is licensed under the [MIT License](./LICENSE.txt).
<yjs@dbis.rwth-aachen.de>
[ShareJs]: https://github.com/sh
[ShareJs]: https://github.com/share/ShareJS
[OpenCoweb]: https://github.com/opencoweb/coweb/wiki

19
bower.json Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "yjs",
"version": "0.6.38",
"homepage": "y-js.org",
"authors": [
"Kevin Jahns <kevin.jahns@rwth-aachen.de>"
],
"description": "A Framework that enables Real-Time collaboration on arbitrary data structures.",
"main": "y.js",
"keywords": [
"OT",
"collaboration",
"synchronization",
"sharejs",
"coweb",
"concurrency"
],
"license": "MIT"
}

View File

@@ -1,21 +1,19 @@
{
"name": "yjs",
"version": "0.6.23",
"version": "0.6.40",
"description": "A framework for real-time p2p shared editing on arbitrary complex data types",
"main": "y.js",
"scripts": {
"test": "node --harmony ./node_modules/.bin/gulp test",
"lint": "./node_modules/.bin/standard",
"build": "./node_modules/.bin/standard build"
"lint": "./node_modules/.bin/standard"
},
"pre-commit": [
"lint",
"test"
"lint"
],
"standard": {
"parser": "babel-eslint",
"ignore": [
"build/**",
"dist/**",
"./y.js",
"./y.js.map"
]
@@ -41,25 +39,7 @@
},
"homepage": "http://y-js.org",
"devDependencies": {
"babel-eslint": "^4.1.2",
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-bump": "^1.0.0",
"gulp-concat": "^2.6.0",
"gulp-filter": "^3.0.1",
"gulp-git": "^1.6.0",
"gulp-jasmine": "^2.0.1",
"gulp-jasmine-browser": "^0.2.3",
"gulp-load-plugins": "^1.0.0",
"gulp-shell": "^0.5.1",
"gulp-sourcemaps": "^1.5.2",
"gulp-tag-version": "^1.3.0",
"gulp-uglify": "^1.4.1",
"gulp-util": "^3.0.6",
"gulp-watch": "^4.3.5",
"minimist": "^1.2.0",
"pre-commit": "^1.1.1",
"promise-polyfill": "^2.1.0",
"standard": "^5.2.2"
}
}

5363
y.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long