Skip to content

Commit

Permalink
Trigger events when broadcast message is received
Browse files Browse the repository at this point in the history
  • Loading branch information
esme committed Jan 17, 2025
1 parent 37e75ec commit b3ba4d3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions demos/demo-minimal-js/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-use-before-define */
/* eslint-disable no-undef */
import CallingExtensions, { Constants } from "@hubspot/calling-extensions-sdk";
// import CallingExtensions, { Constants } from "../../index";
Expand Down Expand Up @@ -46,13 +47,6 @@ const SEND_ERROR = "senderror";
const USER_AVAILABLE = "useravailable";
const USER_UNAVAILABLE = "userunavailable";

const eventHandlers = {
[INCOMING_CALL]: "incomingCall",
[ANSWER_CALL]: "answerCall",
[END_CALL]: "endCall",
[COMPLETE_CALL]: "completeCall",
};

function disableButtons(ids) {
if (!state.enforceButtonsOrder) {
return;
Expand Down Expand Up @@ -98,6 +92,13 @@ function listenToBroadcastMessage() {
};
}

const eventHandlers = {
[INCOMING_CALL]: incomingCall,
[ANSWER_CALL]: answerCall,
[END_CALL]: endCall,
[COMPLETE_CALL]: completeCall,
};

const cti = new CallingExtensions({
debugMode: true,
eventHandlers: {
Expand Down

0 comments on commit b3ba4d3

Please sign in to comment.