This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send a simple message | |
FxoMessenger.sendMessage('Hey!'); | |
// Send a message with metadata | |
FxoMessenger.sendMessage('Hey!', { | |
user_id: 12345, | |
name: 'John Doe' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the messenger to open fullscreen | |
FxoMessenger.setConfig({ | |
fullscreen: true | |
}); | |
// Set header text and color | |
FxoMessenger.setConfig({ | |
headerText: 'Chat to Us', | |
color: '#4B0082' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the messenger to open fullscreen | |
FxoMessenger.getState(); | |
// Returns Object: | |
// { | |
// state: "connected", | |
// color: "#4B0082", | |
// fullscreen: true, | |
// headerText: "Chat to Us" | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FxoMessenger.create(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FxoMessenger.destroy(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FxoMessenger.toggle(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FxoMessenger.on(eventName, callback) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FxoMessenger.removeListeners(<optional eventName>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FxoMessenger.on<EventName>(callback) |
OlderNewer