From 2549cf8d5d08786c4a290159528133bcf944b1d0 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Thu, 27 Apr 2023 11:13:44 -0300 Subject: [PATCH] Remove deprecated RealtimePresence.on/off methods Part of #1197. --- src/common/lib/client/realtimepresence.ts | 12 --------- test/realtime/presence.test.js | 33 ----------------------- 2 files changed, 45 deletions(-) diff --git a/src/common/lib/client/realtimepresence.ts b/src/common/lib/client/realtimepresence.ts index 43f19f2b4c..1d25be4035 100644 --- a/src/common/lib/client/realtimepresence.ts +++ b/src/common/lib/client/realtimepresence.ts @@ -507,18 +507,6 @@ class RealtimePresence extends Presence { }); } - /* Deprecated */ - on(...args: unknown[]): void { - Logger.deprecated('presence.on', 'presence.subscribe'); - this.subscribe(...args); - } - - /* Deprecated */ - off(...args: unknown[]): void { - Logger.deprecated('presence.off', 'presence.unsubscribe'); - this.unsubscribe(...args); - } - subscribe(..._args: unknown[] /* [event], listener, [callback] */): void | Promise { const args = RealtimeChannel.processListenerArgs(_args); const event = args[0]; diff --git a/test/realtime/presence.test.js b/test/realtime/presence.test.js index 10525c783c..e9e9a65682 100644 --- a/test/realtime/presence.test.js +++ b/test/realtime/presence.test.js @@ -1118,39 +1118,6 @@ define(['ably', 'shared_helper', 'async', 'chai'], function (Ably, helper, async }); }); - /* - * Check that old deprecated on/off methods still work - */ - it('presenceOn', function (done) { - var channelName = 'enterOn'; - var testData = 'some data'; - var eventListener = function (channel, callback) { - var presenceHandler = function () { - callback(); - }; - channel.presence.on(presenceHandler); - }; - var enterOn = function (cb) { - var clientRealtime = helper.AblyRealtime({ clientId: testClientId, tokenDetails: authToken }); - clientRealtime.connection.on('connected', function () { - /* get channel, attach, and enter */ - var clientChannel = clientRealtime.channels.get(channelName); - clientChannel.attach(function (err) { - if (err) { - cb(err, clientRealtime); - return; - } - clientChannel.presence.enter(testData, function (err) { - cb(err, clientRealtime); - }); - }); - }); - monitorConnection(done, clientRealtime); - }; - - runTestWithEventListener(done, channelName, eventListener, enterOn); - }); - /* * Check that encodable presence messages are encoded correctly */