From 7b11e7c3e026ba78bfea59549d69e21b1e083450 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 4 Dec 2015 10:08:47 -0500 Subject: [PATCH] documentation --- README.md | 7 ++++--- Source/SocketIOClient.swift | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f1773d..ec44b92 100644 --- a/README.md +++ b/README.md @@ -150,8 +150,8 @@ case Secure(Bool) // If the connection should use TLS. Default is false. ``` Methods ------- -1. `on(event: String, callback: NormalCallback)` - Adds a handler for an event. Items are passed by an array. `ack` can be used to send an ack when one is requested. See example. -2. `once(event: String, callback: NormalCallback)` - Adds a handler that will only be executed once. +1. `on(event: String, callback: NormalCallback) -> NSUUID` - Adds a handler for an event. Items are passed by an array. `ack` can be used to send an ack when one is requested. See example. Returns a unique id for the handler. +2. `once(event: String, callback: NormalCallback) -> NSUUID` - Adds a handler that will only be executed once. Returns a unique id for the handler. 3. `onAny(callback:((event: String, items: AnyObject?)) -> Void)` - Adds a handler for all events. It will be called on any received event. 4. `emit(event: String, _ items: AnyObject...)` - Sends a message. Can send multiple items. 5. `emit(event: String, withItems items: [AnyObject])` - `emit` for Objective-C @@ -164,7 +164,8 @@ Methods 12. `joinNamespace()` - Causes the client to join nsp. Shouldn't need to be called unless you change nsp manually. 13. `leaveNamespace()` - Causes the client to leave the nsp and go back to / 14. `off(event: String)` - Removes all event handlers for event. -15. `removeAllHandlers()` - Removes all handlers. +15. `off(id id: NSUUID)` - Removes the event that corresponds to id. +16. `removeAllHandlers()` - Removes all handlers. Client Events ------ diff --git a/Source/SocketIOClient.swift b/Source/SocketIOClient.swift index 3fef0e3..385ecfa 100644 --- a/Source/SocketIOClient.swift +++ b/Source/SocketIOClient.swift @@ -400,6 +400,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient { /** Adds a handler for an event. + Returns: A unique id for the handler */ public func on(event: String, callback: NormalCallback) -> NSUUID { DefaultSocketLogger.Logger.log("Adding handler for event: %@", type: logType, args: event) @@ -412,6 +413,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient { /** Adds a single-use handler for an event. + Returns: A unique id for the handler */ public func once(event: String, callback: NormalCallback) -> NSUUID { DefaultSocketLogger.Logger.log("Adding once handler for event: %@", type: logType, args: event)