added safety to setUserId (when called twice)
This commit is contained in:
parent
f18a6ee151
commit
ab6a193ec6
@ -134,11 +134,6 @@
|
|||||||
|
|
||||||
<!-- Create the editor container -->
|
<!-- Create the editor container -->
|
||||||
<div id="editor">
|
<div id="editor">
|
||||||
<div>Hello World!</div>
|
|
||||||
<div>Some initial <b>bold</b> text</div>
|
|
||||||
<div>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -8,16 +8,16 @@ Y({
|
|||||||
},
|
},
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'richtext-example17'
|
room: 'richtext-example18',
|
||||||
// debug: true
|
debug: true
|
||||||
// url: 'http://127.0.0.1:2345'
|
//url: 'http://127.0.0.1:1234'
|
||||||
},
|
},
|
||||||
sourceDir: '/bower_components',
|
sourceDir: '/bower_components',
|
||||||
share: {
|
share: {
|
||||||
richtext: 'Richtext' // y.share.richtext is of type Y.Richtext
|
richtext: 'Richtext' // y.share.richtext is of type Y.Richtext
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
}).then(function (y) {
|
||||||
window.y = y
|
window.yquill = y
|
||||||
|
|
||||||
// create quill element
|
// create quill element
|
||||||
window.quill = new Quill('#editor', {
|
window.quill = new Quill('#editor', {
|
||||||
|
8
y.es6
8
y.es6
@ -64,8 +64,12 @@ module.exports = function (Y/* :any */) {
|
|||||||
return this.y.db.stopGarbageCollector()
|
return this.y.db.stopGarbageCollector()
|
||||||
}
|
}
|
||||||
setUserId (userId) {
|
setUserId (userId) {
|
||||||
this.userId = userId
|
if (this.userId == null) {
|
||||||
return this.y.db.setUserId(userId)
|
this.userId = userId
|
||||||
|
return this.y.db.setUserId(userId)
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onUserEvent (f) {
|
onUserEvent (f) {
|
||||||
this.userEventListeners.push(f)
|
this.userEventListeners.push(f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user