Описание тега intercom.js

Intercom.js is a client-side library that allows one window to broadcast messages to all other open windows / tabs. A socket.io binding is built in—which allows a single socket connection to painlessly propagate messages to all windows. Useful for chat services, notifications, and more.

Intercom.js is a client-side library that allows one window to broadcast messages to all other open windows / tabs. A socket.io binding is built in—which allows a single socket connection to painlessly propagate messages to all windows. Useful for chat services, notifications, and more.

With the socket.io binding it's easy set up the socket connection to broadcast messages it receives to all open windows. It's also effortless to send messages over a single active socket from any open window.

Here are the method used in intercom:

  • emit(name, message): Broadcasts a message to all open windows (including the current window).
  • .on(name, fn): Sets up a listener to be invoked when a message with the given name is received.
  • .once(key, fn, [ttl]): Given a unique unique key to represent the function, fn will be invoked in only one window. The ttl argument represents the number of seconds before the function can be called again.
  • Intercom.destroy(): Removes all data associated with intercom from localStorage.
  • Intercom.getInstance(): Returns an instance of Intercom. If one doesn't exist, it will be instantiated.

Here is the library for the intercom.js.