added safety to setUserId (when called twice)

This commit is contained in:
Kevin Jahns 2015-12-30 16:34:39 +01:00
parent f18a6ee151
commit ab6a193ec6
6 changed files with 14 additions and 5027 deletions

View File

@ -134,11 +134,6 @@
<!-- Create the editor container -->
<div id="editor">
<div>Hello World!</div>
<div>Some initial <b>bold</b> text</div>
<div>
<br>
</div>
</div>
</div>

View File

@ -8,16 +8,16 @@ Y({
},
connector: {
name: 'websockets-client',
room: 'richtext-example17'
// debug: true
// url: 'http://127.0.0.1:2345'
room: 'richtext-example18',
debug: true
//url: 'http://127.0.0.1:1234'
},
sourceDir: '/bower_components',
share: {
richtext: 'Richtext' // y.share.richtext is of type Y.Richtext
}
}).then(function (y) {
window.y = y
window.yquill = y
// create quill element
window.quill = new Quill('#editor', {

8
y.es6
View File

@ -64,8 +64,12 @@ module.exports = function (Y/* :any */) {
return this.y.db.stopGarbageCollector()
}
setUserId (userId) {
this.userId = userId
return this.y.db.setUserId(userId)
if (this.userId == null) {
this.userId = userId
return this.y.db.setUserId(userId)
} else {
return null
}
}
onUserEvent (f) {
this.userEventListeners.push(f)

File diff suppressed because one or more lines are too long

5016
y.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long