Skip to content

Commit

Permalink
broadcastchannel.js: unsubscribe from broadcastchannel
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Apr 26, 2019
1 parent ec2be4f commit 4886f6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions broadcastchannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ const getChannel = room =>
*/
export const subscribe = (room, f) => getChannel(room).subs.add(f)

/**
* @function
* @param {string} room
* @param {Function} f
*/
export const unsubscribe = (room, f) => getChannel(room).subs.delete(f)

/**
* Publish data to all subscribers (including subscribers on this tab)
*
Expand Down

0 comments on commit 4886f6b

Please sign in to comment.