質問編集履歴
1
コードを追加しました。何がどのようにわからないかは質問文に書いてあります。
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,32 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
【コード】
|
26
|
+
|
27
|
+
```javascript
|
28
|
+
|
29
|
+
function disconnectionHandler(peerId, user) {
|
30
|
+
|
31
|
+
$(window).on('beforeunload', function() {
|
32
|
+
|
33
|
+
// log
|
34
|
+
|
35
|
+
logUserAction(user, 'SR-out')
|
36
|
+
|
37
|
+
return undefined;
|
38
|
+
|
39
|
+
})
|
25
40
|
|
26
41
|
|
42
|
+
|
27
|
-
|
43
|
+
// DB: remove records
|
44
|
+
|
45
|
+
roomRef.child(peerId).onDisconnect().remove();
|
46
|
+
|
47
|
+
// record deleted onDisconnect EXCEPT when going to breakroom
|
48
|
+
|
49
|
+
rootRef.child('on-break/' + user.uid).onDisconnect().remove();
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
```
|