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