diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-06-23 17:45:04 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-06-23 17:45:04 +0200 |
commit | ed9d39d488508894603bca2f134f5c4e5e7c3f80 (patch) | |
tree | 07c3c27a53be8c79c16ca20e35632606892875f1 /src/ws | |
parent | fc995412d7a53993b7144b4b1f02045578c6a377 (diff) |
Fix unsubscribe/subscribe
Diffstat (limited to 'src/ws')
-rw-r--r-- | src/ws/handler.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ws/handler.js b/src/ws/handler.js index 5bb7892..eff5a07 100644 --- a/src/ws/handler.js +++ b/src/ws/handler.js @@ -26,9 +26,14 @@ function removeEventHandler(e) var id = e.detail.id; var node = findNode(id, subscribeid); + if(node == null) + { + return; // Node not present - don't do anything + } if(node.id == node.subscribeid) { removeBoard(subscribeid); + nodes.splice(nodes.indexOf(node), 1); } if(node.parent) @@ -61,6 +66,11 @@ function createEventHandler(e) var parentid = e.detail.parentid; var insertBeforeId = e.detail.insertBeforeId; + if(findNode(id, subscribeid) != null) + { + return; // node already exists + } + var node = new Node(id, subscribeid); node.create(); |