As of August 12, 2019, we will introduce some changes to the Web SDK to enhance its event handling. In most cases, these changes won’t affect how Web SDK operates, except for the workflow of the addEventListener/on interface.

WHAT NEEDS TO BE DONE

Our team have released a new version of the Web SDK on June 7, 2019. This version notifies developers about functions used incorrectly. Please check the production versions of your services in all browsers by using the developer console. In case of warning messages, you have up to 2 months to apply the necessary fixes, per the instructions below.

Changes with full backward compatibility

  1. The addEventListener/on interface will have three parameters (same as EventTarget):
    1. the event name
    2. an object implementing the EventListener interface (since this interface is based on a JS function, the backward compatibility is guaranteed)
    3. options objects – with the new release, once and capture will be supported:  
      1. once – removes a listener after the very first call
      2. capture – sets a listener first in the call stack
  2. The removeEventListener/off interface will also accept an object implementing the EventListener interface as the second argument
  3. Several fields and functions of a regular Event will be applied to all the events:
    1. ev.target will refer to the object that triggered the event (current fields will remain the same)
    2. ev.type will return the event's type (the name field will remain the same)
    3. ev.stopImmediatePropagation() prevents other listeners of the same event from being called

Changes that are not backward compatible

A new version of the Web SDK will consider the value returned by the user’s handler. If it’s false, further callback processing will be stopped.

Example:

call.on(VoxImplant.CallEvents.Connected,(e)=>{
  console.log(‘First callback’);
  return false;
})
call.on(VoxImplant.CallEvents.Connected,(e)=>{
  console.log(‘Second callback’);
})

The current version of the Web SDK will print the following:

> First callback

> Second callback

The output of the new version will be:

> First callback