Skip to content

Commit

Permalink
use function instead of arrow function => closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Feb 28, 2018
1 parent 04befe5 commit 0f2ef95
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/y-websockets-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export default function extend (Y) {
this.socket = socket
var self = this

this._onConnect = () => {
this._onConnect = function () {
if (options.initSync) {
if (options.room == null) {
throw new Error('You must define a room name!')
}
this._sentSync = true
self._sentSync = true
// only sync with server when connect = true
socket.emit('joinRoom', options.room)
self.userJoined('server', 'master')
Expand All @@ -32,8 +32,8 @@ export default function extend (Y) {
self.setUserId(Y.utils.generateUserId())
})
}
socket.on('yjsEvent', this._onYjsEvent)
socket.on('disconnect', this._onDisconnect)
socket.on('yjsEvent', self._onYjsEvent)
socket.on('disconnect', self._onDisconnect)
}

socket.on('connect', this._onConnect)
Expand Down

0 comments on commit 0f2ef95

Please sign in to comment.