@@ -392,37 +392,37 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
392
392
}
393
393
394
394
/// 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)
396
396
void _attachDeviceListeners (twilio_js.Device device) {
397
397
// ignore: unnecessary_null_comparison
398
398
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));
404
404
}
405
405
406
406
/// 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)
408
408
void _detachDeviceListeners (twilio_js.Device device) {
409
409
// ignore: unnecessary_null_comparison
410
410
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));
416
416
}
417
417
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]
419
419
/// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#registered-event
420
420
void _onDeviceRegistered () {
421
421
printDebug ("_onDeviceRegistered" );
422
422
printDebug ("Device registered for callInvites" );
423
423
}
424
424
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]
426
426
// /// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#registered-event
427
427
// Function _onDeviceRegistered() {
428
428
// // final _f = (twilioJs.Device device) {
@@ -434,21 +434,21 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
434
434
// });
435
435
// }
436
436
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]
438
438
/// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#unregistered-event
439
439
void _onDeviceUnregistered () {
440
440
printDebug ("_onDeviceUnregistered" );
441
441
printDebug ("Device unregistered, won't receive no more callInvites" );
442
442
}
443
443
444
444
/// 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]
446
446
/// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#error-event
447
447
void _onDeviceError (twilio_js.TwilioError twilioError, twilio_js.Call ? call) {
448
448
logLocalEvent (twilioError.message);
449
449
}
450
450
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]
452
452
/// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#incoming-event
453
453
void _onDeviceIncoming (twilio_js.Call call) {
454
454
requestMicAccess ();
@@ -507,7 +507,7 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
507
507
);
508
508
}
509
509
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]
511
511
/// Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#tokenwillexpire-event
512
512
void _onTokenWillExpire (twilio_js.Device device) {
513
513
logLocalEventEntries (["DEVICETOKEN" , device.token], prefix: "" );
@@ -831,23 +831,23 @@ class Call extends MethodChannelTwilioCall {
831
831
}
832
832
833
833
/// Attach event listeners to the active call
834
- /// See [twilio_js.Call.on ]
834
+ /// See [twilio_js.Call.addListener ]
835
835
void _attachCallEventListeners (twilio_js.Call call) {
836
836
// ignore: unnecessary_null_comparison
837
837
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));
847
847
}
848
848
849
849
/// Detach event listeners to the active call
850
- /// See [twilio_js.Call.off ]
850
+ /// See [twilio_js.Call.removeListener ]
851
851
/// 'off' event listener isn't implemented in twilio-voice.js
852
852
void _detachCallEventListeners (twilio_js.Call call) {
853
853
// ignore: unnecessary_null_comparison
0 commit comments