diff --git a/src/kernel/KernelEvents.hx b/src/kernel/KernelEvents.hx index 5a6869d..9c54528 100644 --- a/src/kernel/KernelEvents.hx +++ b/src/kernel/KernelEvents.hx @@ -231,4 +231,38 @@ class KernelEvents { throw new Exception("Invalid input"); } } + + @:allow(lib.Debug) + private function printListenerCount() { + if (onAlarmTrigger.getLength() > 0) Log.debug("onAlarm: " + onAlarmTrigger.getLength()); + if (onCharTrigger.getLength() > 0) Log.debug("onChar: " + onCharTrigger.getLength()); + if (onDiskTrigger.getLength() > 0) Log.debug("onDisk: " + onDiskTrigger.getLength()); + if (onDiskEjectTrigger.getLength() > 0) Log.debug("onDiskEject: " + onDiskEjectTrigger.getLength()); + if (onHttpCheckTrigger.getLength() > 0) Log.debug("onHttpCheck: " + onHttpCheckTrigger.getLength()); + if (onHttpFailureTrigger.getLength() > 0) Log.debug("onHttpFailure: " + onHttpFailureTrigger.getLength()); + if (onHttpSuccessTrigger.getLength() > 0) Log.debug("onHttpSuccess: " + onHttpSuccessTrigger.getLength()); + if (onKeyTrigger.getLength() > 0) Log.debug("onKey: " + onKeyTrigger.getLength()); + if (onKeyUpTrigger.getLength() > 0) Log.debug("onKeyUp: " + onKeyUpTrigger.getLength()); + if (onModemMessageTrigger.getLength() > 0) Log.debug("onModemMessage: " + onModemMessageTrigger.getLength()); + if (onMonitorResizeTrigger.getLength() > 0) Log.debug("onMonitorResize: " + onMonitorResizeTrigger.getLength()); + if (onMonitorTouchTrigger.getLength() > 0) Log.debug("onMonitorTouch: " + onMonitorTouchTrigger.getLength()); + if (onMouseClickTrigger.getLength() > 0) Log.debug("onMouseClick: " + onMouseClickTrigger.getLength()); + if (onMouseDragTrigger.getLength() > 0) Log.debug("onMouseDrag: " + onMouseDragTrigger.getLength()); + if (onMouseScrollTrigger.getLength() > 0) Log.debug("onMouseScroll: " + onMouseScrollTrigger.getLength()); + if (onMouseUpTrigger.getLength() > 0) Log.debug("onMouseUp: " + onMouseUpTrigger.getLength()); + if (onPasteTrigger.getLength() > 0) Log.debug("onPaste: " + onPasteTrigger.getLength()); + if (onPeripheralTrigger.getLength() > 0) Log.debug("onPeripheral: " + onPeripheralTrigger.getLength()); + if (onPeripheralDetachTrigger.getLength() > 0) Log.debug("onPeripheralDetach: " + onPeripheralDetachTrigger.getLength()); + if (onRedstoneTrigger.getLength() > 0) Log.debug("onRedstone: " + onRedstoneTrigger.getLength()); + if (onSpeakerAudioEmptyTrigger.getLength() > 0) Log.debug("onSpeakerAudioEmpty: " + onSpeakerAudioEmptyTrigger.getLength()); + if (onTaskCompleteTrigger.getLength() > 0) Log.debug("onTaskComplete: " + onTaskCompleteTrigger.getLength()); + if (onTermResizeTrigger.getLength() > 0) Log.debug("onTermResize: " + onTermResizeTrigger.getLength()); + if (onTerminateTrigger.getLength() > 0) Log.debug("onTerminate: " + onTerminateTrigger.getLength()); + if (onTimerTrigger.getLength() > 0) Log.debug("onTimer: " + onTimerTrigger.getLength()); + if (onTurtleInventoryTrigger.getLength() > 0) Log.debug("onTurtleInventory: " + onTurtleInventoryTrigger.getLength()); + if (onWebsocketCloseTrigger.getLength() > 0) Log.debug("onWebsocketClose: " + onWebsocketCloseTrigger.getLength()); + if (onWebsocketFailureTrigger.getLength() > 0) Log.debug("onWebsocketFailure: " + onWebsocketFailureTrigger.getLength()); + if (onWebsocketMessageTrigger.getLength() > 0) Log.debug("onWebsocketMessage: " + onWebsocketMessageTrigger.getLength()); + if (onWebsocketSuccessTrigger.getLength() > 0) Log.debug("onWebsocketSuccess: " + onWebsocketSuccessTrigger.getLength()); + } } diff --git a/src/lib/Debug.hx b/src/lib/Debug.hx index cdd8ff8..dc73cdf 100644 --- a/src/lib/Debug.hx +++ b/src/lib/Debug.hx @@ -1,5 +1,6 @@ package lib; +import kernel.KernelEvents; import kernel.log.Log; import lua.NativeStringTools; import lib.ui.Canvas; @@ -38,6 +39,12 @@ class Debug { Log.debug("\n" + lines.join("\n")); } + #if Debug + public static function printKernelEventsCount(){ + KernelEvents.instance.printListenerCount(); + } + #end + #if webconsole public static function printWeb(msg:String) { HTTP.request("http://127.0.0.1:8080/"+Net.instance.networkID,msg);