updated examples
This commit is contained in:
parent
0292181830
commit
6c13be376f
@ -3,7 +3,7 @@
|
||||
// create a shared object. This function call will return a promise!
|
||||
Y({
|
||||
db: {
|
||||
name: 'IndexedDB',
|
||||
name: 'indexeddb',
|
||||
namespace: 'offlineEditingDemo'
|
||||
},
|
||||
connector: {
|
||||
@ -11,8 +11,8 @@ Y({
|
||||
room: 'offlineEditingDemo',
|
||||
debug: true
|
||||
},
|
||||
types: [],
|
||||
sourceDir: '/bower_components/'
|
||||
types: ['Array', 'Text'],
|
||||
sourceDir: '/bower_components'
|
||||
}).then(function (yconfig) {
|
||||
// yconfig holds all the information about the shared object
|
||||
window.yconfig = yconfig
|
||||
@ -33,10 +33,10 @@ Y({
|
||||
text.bind(contenteditable)
|
||||
}
|
||||
})
|
||||
// create a shared TextBind
|
||||
// create a shared Text
|
||||
var textpromise = yconfig.root.get('text')
|
||||
if (textpromise == null) {
|
||||
yconfig.root.set('text', Y.TextBind)
|
||||
yconfig.root.set('text', Y.Text)
|
||||
}
|
||||
// We also provide a button for disconnecting/reconnecting the shared element
|
||||
var button = document.querySelector('#button')
|
||||
|
@ -5,8 +5,7 @@
|
||||
<h1 id="contenteditable" contentEditable></h1>
|
||||
<textarea style="width:80%;" rows=40 id="textfield"></textarea>
|
||||
|
||||
<script src="../../node_modules/simplewebrtc/simplewebrtc.bundle.js"></script>
|
||||
<script src="../../y.js"></script>
|
||||
<script src="../bower_components/yjs/y.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -3,13 +3,15 @@
|
||||
// create a shared object. This function call will return a promise!
|
||||
Y({
|
||||
db: {
|
||||
name: 'Memory'
|
||||
name: 'memory'
|
||||
},
|
||||
connector: {
|
||||
name: 'WebRTC',
|
||||
room: 'TextBindDemo',
|
||||
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
|
||||
@ -30,8 +32,8 @@ Y({
|
||||
text.bind(contenteditable)
|
||||
}
|
||||
})
|
||||
// create a shared TextBind
|
||||
yconfig.root.set('text', Y.TextBind)
|
||||
// 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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user