@phonghq/go-chat 1.0.63 → 1.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { computed, onMounted, onUnmounted, ref } from 'vue';
2
+ import { computed, onBeforeUnmount, onMounted, onUnmounted, ref } from 'vue';
3
3
  import IconPhone from '../../../assets/icons/call/IconPhone.vue';
4
4
  import { dataProfile } from '../../../utils/chat/store/auth';
5
5
  import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
@@ -93,7 +93,12 @@ onMounted(async () => {
93
93
  showPageError('We’re having trouble connecting the call. Please try again in a moment');
94
94
  }
95
95
  });
96
+ onBeforeUnmount(() => {
97
+ console.log('ssssssssssssssssssssssss');
98
+ plivoRemoveCallBack();
99
+ });
96
100
  onUnmounted(() => {
101
+ console.log('ssssssssssssssssssssssss');
97
102
  if (timer)
98
103
  clearInterval(timer);
99
104
  if (timeOut)
@@ -19,9 +19,7 @@ export function usePlivo(callback) {
19
19
  try {
20
20
  if (!plivoBrowserSdk) {
21
21
  plivoBrowserSdk = new window.Plivo(options);
22
- plivoBrowserSdk?.client?.on?.('onCallAnswered', (callInfo) => {
23
- handleCallAnswered(callInfo);
24
- });
22
+ plivoBrowserSdk?.client?.on?.('onCallAnswered', handleCallAnswered);
25
23
  plivoBrowserSdk?.client?.on?.('onCallTerminated', (hangupInfo, callInfo) => handleCallTerminated(hangupInfo, callInfo));
26
24
  plivoBrowserSdk.client.on('onCallFailed', (data, callInfo) => {
27
25
  handleCallFailed(data, callInfo);
@@ -177,6 +175,7 @@ export function usePlivo(callback) {
177
175
  return res;
178
176
  };
179
177
  const plivoRemoveCallBack = () => {
178
+ plivoBrowserSdk?.client?.off?.('onCallAnswered', handleCallAnswered);
180
179
  plivoBrowserSdk = null;
181
180
  };
182
181
  const sleep = () => {