EventBus
public class EventBus: NSObject, IUIWebViewObserver, IWKWebViewObserver
EventBus
In charge of watching a subscriber / webview-wkwebview pair. Deals with any request from the user side, as well as the watched pair, and forward them to the dispatcher.
-
Draft
Required when watching a WKWebView
Declaration
Swift
public class Draft: NSObject, IWKWebViewObserver
-
Current name
Declaration
Swift
public var name: String
-
Posts event
Declaration
Swift
public func post(eventName: String)
Parameters
eventName
Name of the event
-
Posts event with extra data
Declaration
Swift
public func post<T>(eventName: String, data: T)
Parameters
eventName
Name of the event
data
Data to post (see documentation for supported types)
-
Subscribes to event. Callback is run with the event’s name and extra data (if any).
Declaration
Swift
public func register(eventName: String, callback: (String, AnyObject?) -> Void)
Parameters
eventName
Event to watch
callback
Action to run when fired
-
Subscribes to event. Callback is run on main thread with the event’s name and extra data (if any).
Declaration
Swift
public func registerOnMain(eventName: String, callback: (String, AnyObject?) -> Void)
Parameters
eventName
Event to watch
callback
Action to run when fired
-
Unregisters subscriber from bus
Declaration
Swift
public func unregister()