forked from I2P_Developers/i2p.i2p
OSX Launcher: Log all events for debugging
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
// TODO: Log all events?
|
||||||
|
|
||||||
class EventManager {
|
class EventManager {
|
||||||
var listeners = Dictionary<String, NSMutableArray>();
|
var listeners = Dictionary<String, NSMutableArray>();
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ class EventManager {
|
|||||||
// @param eventName: Matching listener eventNames will fire when this is called
|
// @param eventName: Matching listener eventNames will fire when this is called
|
||||||
// @param information: pass values to your listeners
|
// @param information: pass values to your listeners
|
||||||
func trigger(eventName:String, information:Any? = nil) {
|
func trigger(eventName:String, information:Any? = nil) {
|
||||||
|
print("Event: ", eventName, " will trigger ", self.listeners[eventName]?.count ?? 0, " listeners")
|
||||||
if let actionObjects = self.listeners[eventName] {
|
if let actionObjects = self.listeners[eventName] {
|
||||||
for actionObject in actionObjects {
|
for actionObject in actionObjects {
|
||||||
if let actionToPerform = actionObject as? EventListenerAction {
|
if let actionToPerform = actionObject as? EventListenerAction {
|
||||||
|
Reference in New Issue
Block a user