Skip to content

Instantly share code, notes, and snippets.

@johnmjackson
Created June 12, 2017 18:57
Show Gist options
  • Save johnmjackson/5437c9001e608113c33e9b609ac9c9cb to your computer and use it in GitHub Desktop.
Save johnmjackson/5437c9001e608113c33e9b609ac9c9cb to your computer and use it in GitHub Desktop.
// Wait until the messenger is fully
// ready, then send a message
FxoMessenger.on('stateChanged', function(state) {
if (state === 'connected') {
FxoMessenger.sendMessage('Hey!');
}
});
// Subscribe to all messages received,
// logging them to the console
FxoMessenger.on('messageReceived', function(message) {
console.log(message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment