         }
     }
 
+    /// Creates an event bus with a given configuration and dispatch queue
+    ///
+    /// - Parameters:
+    ///   - options: the event bus' options
+    ///   - queue: the dispatch queue to notify subscribers on
     public init(options: Options? = nil, queue: DispatchQueue = .global()) {
         self.queue = queue
         self.options = options ?? Options()


import Foundation

public protocol EventRegistrable: class {
    func register<T>(forEvent eventType: T.Type)
}

public protocol EventSubscribable: class {
    func add<T>(subscriber: T, for eventType: T.Type)
    func remove<T>(subscriber: T, for eventType: T.Type)
    func remove<T>(subscriber: T)
    func removeAllSubscribers()
}

public protocol EventChainable: class {
    func attach(chain: EventNotifiable)
    func detach(chain: EventNotifiable)
    func detachAllChains()
}

public protocol EventNotifiable: class {
    func notify<T>(_ eventType: T.Type, closure: @escaping (T) -> ())
}

public struct Options: OptionSet {

    public let rawValue: Int

    public init(rawValue: Int) {
        self.rawValue = rawValue
    }

    public static let warnUnknown = Options(rawValue: 1 << 0)

    public static let warnDropped = Options(rawValue: 1 << 1)

    public static let logEvents = Options(rawValue: 1 << 2)
}

public class EventBus {

    internal struct WeakBox: Hashable {

        }
    }

    /// A global shared event bus configured using default options.
    public static let shared: EventBus = EventBus()

    /// The event bus' configuration options
    public let options: Options

    fileprivate var registered: [ObjectIdentifier: String] = [:]
