documentation

This commit is contained in:
Erik 2015-12-04 10:08:47 -05:00
parent 6e5b95be31
commit 7b11e7c3e0
2 changed files with 6 additions and 3 deletions

View File

@ -150,8 +150,8 @@ case Secure(Bool) // If the connection should use TLS. Default is false.
``` ```
Methods 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. 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)` - Adds a handler that will only be executed once. 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. 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. 4. `emit(event: String, _ items: AnyObject...)` - Sends a message. Can send multiple items.
5. `emit(event: String, withItems items: [AnyObject])` - `emit` for Objective-C 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. 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 / 13. `leaveNamespace()` - Causes the client to leave the nsp and go back to /
14. `off(event: String)` - Removes all event handlers for event. 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 Client Events
------ ------

View File

@ -400,6 +400,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
/** /**
Adds a handler for an event. Adds a handler for an event.
Returns: A unique id for the handler
*/ */
public func on(event: String, callback: NormalCallback) -> NSUUID { public func on(event: String, callback: NormalCallback) -> NSUUID {
DefaultSocketLogger.Logger.log("Adding handler for event: %@", type: logType, args: event) 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. Adds a single-use handler for an event.
Returns: A unique id for the handler
*/ */
public func once(event: String, callback: NormalCallback) -> NSUUID { public func once(event: String, callback: NormalCallback) -> NSUUID {
DefaultSocketLogger.Logger.log("Adding once handler for event: %@", type: logType, args: event) DefaultSocketLogger.Logger.log("Adding once handler for event: %@", type: logType, args: event)