updated examples

This commit is contained in:
Kevin Jahns
2015-04-30 14:15:48 +02:00
parent 8a5b69e86c
commit 4d926cf841
18 changed files with 256 additions and 205 deletions

View File

@@ -70,11 +70,12 @@ module.exports =
userLeft: (user)->
delete @connections[user]
@findNewSyncTarget()
for f in @connections_listeners
f {
action: "userLeft"
user: user
}
if @connections_listeners?
for f in @connections_listeners
f {
action: "userLeft"
user: user
}
userJoined: (user, role)->
@@ -91,12 +92,13 @@ module.exports =
# TODO: What if there are two masters? Prevent sending everything two times!
@performSyncWithMaster user
for f in @connections_listeners
f {
action: "userJoined"
user: user
role: role
}
if @connections_listeners?
for f in @connections_listeners
f {
action: "userJoined"
user: user
role: role
}
#
# Execute a function _when_ we are connected. If not connected, wait until connected.