@@ -392,37 +392,37 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
392392 }
393393
394394 /// Attach event listeners to [twilio_js.Device]
395- /// See [twilio_js.Device.on]
395+ /// See [twilio_js.Device.addListener] (https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#deviceaddlistenereventname-listener)
396396 void _attachDeviceListeners (twilio_js.Device device) {
397397 // ignore: unnecessary_null_comparison
398398 assert (device != null , "Device cannot be null" );
399- device.on ("registered" , js.allowInterop (_onDeviceRegistered));
400- device.on ("unregistered" , js.allowInterop (_onDeviceUnregistered));
401- device.on ("error" , js.allowInterop (_onDeviceError));
402- device.on ("incoming" , js.allowInterop (_onDeviceIncoming));
403- device.on ("tokenWillExpire" , js.allowInterop (_onTokenWillExpire));
399+ device.addListener ("registered" , js.allowInterop (_onDeviceRegistered));
400+ device.addListener ("unregistered" , js.allowInterop (_onDeviceUnregistered));
401+ device.addListener ("error" , js.allowInterop (_onDeviceError));
402+ device.addListener ("incoming" , js.allowInterop (_onDeviceIncoming));
403+ device.addListener ("tokenWillExpire" , js.allowInterop (_onTokenWillExpire));
404404 }
405405
406406 /// Detach event listeners to [twilio_js.Device]
407- /// See [twilio_js.Device.off]
407+ /// See [twilio_js.Device.removeListener] (https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#deviceremovelistenereventname-listener)
408408 void _detachDeviceListeners (twilio_js.Device device) {
409409 // ignore: unnecessary_null_comparison
410410 assert (device != null , "Device cannot be null" );
411- device.off ("registered" , js.allowInterop (_onDeviceRegistered));
412- device.off ("unregistered" , js.allowInterop (_onDeviceUnregistered));
413- device.off ("error" , js.allowInterop (_onDeviceError));
414- device.off ("incoming" , js.allowInterop (_onDeviceIncoming));
415- device.off ("tokenWillExpire" , js.allowInterop (_onTokenWillExpire));
411+ device.removeListener ("registered" , js.allowInterop (_onDeviceRegistered));
412+ device.removeListener ("unregistered" , js.allowInterop (_onDeviceUnregistered));
413+ device.removeListener ("error" , js.allowInterop (_onDeviceError));
414+ device.removeListener ("incoming" , js.allowInterop (_onDeviceIncoming));
415+ device.removeListener ("tokenWillExpire" , js.allowInterop (_onTokenWillExpire));
416416 }
417417
418- /// On device registered and ready to make/receive calls via [twilio_js.Device.on ] and [twilio_js.TwilioDeviceEvents.registered]
418+ /// On device registered and ready to make/receive calls via [twilio_js.Device.addListener ] and [twilio_js.TwilioDeviceEvents.registered]
419419 /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#registered-event
420420 void _onDeviceRegistered () {
421421 printDebug ("_onDeviceRegistered" );
422422 printDebug ("Device registered for callInvites" );
423423 }
424424
425- // /// On device registered and ready to make/receive calls via [twilioJs.Device.on ] and [twilioJs.TwilioDeviceEvents.registered]
425+ // /// On device registered and ready to make/receive calls via [twilioJs.Device.addListener ] and [twilioJs.TwilioDeviceEvents.registered]
426426 // /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#registered-event
427427 // Function _onDeviceRegistered() {
428428 // // final _f = (twilioJs.Device device) {
@@ -434,21 +434,21 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
434434 // });
435435 // }
436436
437- /// On device unregistered, access token disabled and won't receive any more call invites [twilio_js.Device.off ] and [twilio_js.TwilioDeviceEvents.unregistered]
437+ /// On device unregistered, access token disabled and won't receive any more call invites [twilio_js.Device.removeListener ] and [twilio_js.TwilioDeviceEvents.unregistered]
438438 /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#unregistered-event
439439 void _onDeviceUnregistered () {
440440 printDebug ("_onDeviceUnregistered" );
441441 printDebug ("Device unregistered, won't receive no more callInvites" );
442442 }
443443
444444 /// On device error
445- /// See [twilio_js.Device.on ] and [twilio_js.TwilioDeviceEvents.error]
445+ /// See [twilio_js.Device.addListener ] and [twilio_js.TwilioDeviceEvents.error]
446446 /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#error-event
447447 void _onDeviceError (twilio_js.TwilioError twilioError, twilio_js.Call ? call) {
448448 logLocalEvent (twilioError.message);
449449 }
450450
451- /// On incoming call received via [twilio_js.Device.on ] and [twilio_js.TwilioDeviceEvents.incoming]
451+ /// On incoming call received via [twilio_js.Device.addListener ] and [twilio_js.TwilioDeviceEvents.incoming]
452452 /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#incoming-event
453453 void _onDeviceIncoming (twilio_js.Call call) {
454454 requestMicAccess ();
@@ -507,7 +507,7 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
507507 );
508508 }
509509
510- /// On device token about to expire (default is 10s prior to expiry), via [twilio_js.Device.on ] and [twilio_js.TwilioDeviceEvents.tokenWillExpire]
510+ /// On device token about to expire (default is 10s prior to expiry), via [twilio_js.Device.addListener ] and [twilio_js.TwilioDeviceEvents.tokenWillExpire]
511511 /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#tokenwillexpire-event
512512 void _onTokenWillExpire (twilio_js.Device device) {
513513 logLocalEventEntries (["DEVICETOKEN" , device.token], prefix: "" );
@@ -831,23 +831,23 @@ class Call extends MethodChannelTwilioCall {
831831 }
832832
833833 /// Attach event listeners to the active call
834- /// See [twilio_js.Call.on ]
834+ /// See [twilio_js.Call.addListener ]
835835 void _attachCallEventListeners (twilio_js.Call call) {
836836 // ignore: unnecessary_null_comparison
837837 assert (call != null , "Call cannot be null" );
838- call.on ("ringing" , js.allowInterop (_onCallRinging));
839- call.on ("accept" , js.allowInterop (_onCallAccept));
840- call.on ("disconnect" , js.allowInterop (_onCallDisconnect));
841- call.on ("cancel" , js.allowInterop (_onCallCancel));
842- call.on ("reject" , js.allowInterop (_onCallReject));
843- call.on ("error" , js.allowInterop (_onCallError));
844- call.on ("reconnecting" , js.allowInterop (_onCallReconnecting));
845- call.on ("reconnected" , js.allowInterop (_onCallReconnected));
846- call.on ("log" , js.allowInterop (_onLogEvent));
838+ call.addListener ("ringing" , js.allowInterop (_onCallRinging));
839+ call.addListener ("accept" , js.allowInterop (_onCallAccept));
840+ call.addListener ("disconnect" , js.allowInterop (_onCallDisconnect));
841+ call.addListener ("cancel" , js.allowInterop (_onCallCancel));
842+ call.addListener ("reject" , js.allowInterop (_onCallReject));
843+ call.addListener ("error" , js.allowInterop (_onCallError));
844+ call.addListener ("reconnecting" , js.allowInterop (_onCallReconnecting));
845+ call.addListener ("reconnected" , js.allowInterop (_onCallReconnected));
846+ call.addListener ("log" , js.allowInterop (_onLogEvent));
847847 }
848848
849849 /// Detach event listeners to the active call
850- /// See [twilio_js.Call.off ]
850+ /// See [twilio_js.Call.removeListener ]
851851 /// 'off' event listener isn't implemented in twilio-voice.js
852852 void _detachCallEventListeners (twilio_js.Call call) {
853853 // ignore: unnecessary_null_comparison
0 commit comments