Skip to content

Commit

Permalink
Remove unused isDispatching flag
Browse files Browse the repository at this point in the history
  • Loading branch information
yonekawa committed Nov 29, 2015
1 parent d767fbb commit 656bca2
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions SwiftFlux/Dispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public protocol Dispatcher {

public class DefaultDispatcher: Dispatcher {
private var callbacks: Dictionary<String, AnyObject> = [:]
private var _isDispatching = false
private var lastDispatchIdentifier = 0

public init() {}
Expand Down Expand Up @@ -63,24 +62,17 @@ public class DefaultDispatcher: Dispatcher {
for identifier in self.callbacks.keys {
self.invokeCallback(identifier, type: type, result: result)
}
self.finishDispatching()

objc_sync_exit(self)
}

private func startDispatching<T: Action>(type: T.Type) {
self._isDispatching = true

for (identifier, _) in self.callbacks {
guard let callback = self.callbacks[identifier] as? DispatchCallback<T> else { continue }
callback.status = DispatchStatus.Waiting
}
}

private func finishDispatching() {
self._isDispatching = false
}

private func invokeCallback<T: Action>(identifier: String, type: T.Type, result: Result<T.Payload, T.Error>) {
guard let callback = self.callbacks[identifier] as? DispatchCallback<T> else { return }

Expand Down

0 comments on commit 656bca2

Please sign in to comment.