fix for ackemitter

This commit is contained in:
Erik 2016-05-22 14:17:01 -04:00
parent c6d000972e
commit 3b4a3828ba
2 changed files with 4 additions and 4 deletions

View File

@ -13,8 +13,8 @@ socket.on("connect") {data, ack in
socket.on("currentAmount") {data, ack in socket.on("currentAmount") {data, ack in
if let cur = data[0] as? Double { if let cur = data[0] as? Double {
socket.emitWithAck("canUpdate", cur as AnyObject)(timeoutAfter: 0) {data in socket.emitWithAck("canUpdate", cur)(timeoutAfter: 0) {data in
socket.emit("update", ["amount": cur + 2.50] as AnyObject) socket.emit("update", ["amount": cur + 2.50])
} }
ack.with("Got your currentAmount", "dude") ack.with("Got your currentAmount", "dude")

View File

@ -33,10 +33,10 @@ public final class SocketAckEmitter : NSObject {
self.ackNum = ackNum self.ackNum = ackNum
} }
public func with(_ items: AnyObject...) { public func with(_ items: SocketData...) {
guard ackNum != -1 else { return } guard ackNum != -1 else { return }
socket.emitAck(ackNum, with: items) socket.emitAck(ackNum, with: socket.socketDataToAnyObject(data: items))
} }
public func with(_ items: [AnyObject]) { public func with(_ items: [AnyObject]) {