2015-12-01 19:27:03 +01:00
|
|
|
/* global Y */
|
|
|
|
|
|
|
|
|
|
// initialize a shared object. This function call returns a promise!
|
|
|
|
|
Y({
|
|
|
|
|
db: {
|
|
|
|
|
name: 'memory'
|
|
|
|
|
},
|
|
|
|
|
connector: {
|
|
|
|
|
name: 'websockets-client',
|
2016-02-23 11:27:26 +01:00
|
|
|
room: 'Textarea-example'
|
2017-03-20 19:15:59 +01:00
|
|
|
// url: '127.0.0.1:1234'
|
2015-12-01 19:27:03 +01:00
|
|
|
},
|
|
|
|
|
sourceDir: '/bower_components',
|
|
|
|
|
share: {
|
|
|
|
|
textarea: 'Text' // y.share.textarea is of type Y.Text
|
|
|
|
|
}
|
|
|
|
|
}).then(function (y) {
|
2016-02-04 12:05:47 +01:00
|
|
|
window.yTextarea = y
|
2015-12-01 19:27:03 +01:00
|
|
|
|
|
|
|
|
// bind the textarea to a shared text element
|
|
|
|
|
y.share.textarea.bind(document.getElementById('textfield'))
|
|
|
|
|
// thats it..
|
|
|
|
|
})
|