Relay messages between browser extensions and web pages.
Relay
class is a utility for receiving messages from the ChainPatrol
warning page in your browser extension-based wallet/security app. You may
already have a message passing system in place in your browser extension, but
this class is provided as a convenience for those who do not, or if you want to
keep your message passing system separate from the ChainPatrol SDK.
Relay
class sets up the appropriate message listeners depending on
the scripting context (ie. window.postMessage
in the warning page, chrome.runtime.sendMessage
in the content
and background scripts), and makes sure that all messages are passed along to all
subscribers.