diff options
Diffstat (limited to 'background/broadcast_broker.js')
-rw-r--r-- | background/broadcast_broker.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/background/broadcast_broker.js b/background/broadcast_broker.js index 5af3a7b..458fb7f 100644 --- a/background/broadcast_broker.js +++ b/background/broadcast_broker.js @@ -54,7 +54,8 @@ function new_broadcast_listener(port) { const listener_ctx = {port, id: ++next_id, channels: new Set()}; port.onMessage.addListener(msg => listener_command(msg, listener_ctx)); - port.onDisconnect.addListener(msg => listener_remove(msg, listener_ctx)); + const on_disconnect = () => remove_broadcast_listener(listener_ctx); + port.onDisconnect.addListener(on_disconnect); } function listener_command(msg, listener_ctx) |