@@ -3,7 +3,6 @@ import Foundation
33@objcMembers
44@objc open class GlobalChannel : PusherChannel {
55 open var globalCallbacks : [ String : ( PusherEvent ) -> Void ] = [ : ]
6- open var globalLegacyCallbacks : [ String : ( Any ? ) -> Void ] = [ : ]
76
87 /**
98 Initializes a new GlobalChannel instance
@@ -28,17 +27,6 @@ import Foundation
2827 }
2928 }
3029
31- /**
32- Calls the appropriate legacy callbacks for the given event name in the scope of the global channel
33-
34- - parameter event: The JSON object received from the websocket
35- */
36- internal func handleGlobalEventLegacy( event: [ String : Any ] ) {
37- for (_, callback) in self . globalLegacyCallbacks {
38- callback ( event)
39- }
40- }
41-
4230 /**
4331 Binds a callback to the global channel
4432
@@ -52,34 +40,19 @@ import Foundation
5240 return randomId
5341 }
5442
55- /**
56- Binds a callback to the global channel
57-
58- - parameter callback: The function to call when a message is received
59-
60- - returns: A unique callbackId that can be used to unbind the callback at a later time
61- */
62- internal func bindLegacy( _ callback: @escaping ( Any ? ) -> Void ) -> String {
63- let randomId = UUID ( ) . uuidString
64- self . globalLegacyCallbacks [ randomId] = callback
65- return randomId
66- }
67-
6843 /**
6944 Unbinds the callback with the given callbackId from the global channel
7045
7146 - parameter callbackId: The unique callbackId string used to identify which callback to unbind
7247 */
7348 internal func unbind( callbackId: String ) {
7449 globalCallbacks. removeValue ( forKey: callbackId)
75- globalLegacyCallbacks. removeValue ( forKey: callbackId)
7650 }
7751
7852 /**
7953 Unbinds all callbacks from the channel
8054 */
8155 override open func unbindAll( ) {
8256 globalCallbacks = [ : ]
83- globalLegacyCallbacks = [ : ]
8457 }
8558}
0 commit comments