Create handlers for keys, events, timers and tasks using their constructors, not through the global Phoenix-object. This should finally separate the distinction between managed and unmanaged handlers and make it obvious why you need to keep a reference.
For this, for the context of the JavaScript scope, shorten the names of handlers as follows:
KeyHandler -> Key
EventHandler -> Event
TimerHandler -> Timer
TaskHandler -> Task
This will also merge the API for managed and unmanaged handlers. To create a new key handler, you will then then use the following.
var handler = new Key('q', [ 'ctrl', 'shift' ], function () {});
To use the managed API, you will use the following.
Key.on('q', [ 'ctrl', 'shift' ], function () {});
Create handlers for keys, events, timers and tasks using their constructors, not through the global Phoenix-object. This should finally separate the distinction between managed and unmanaged handlers and make it obvious why you need to keep a reference.
For this, for the context of the JavaScript scope, shorten the names of handlers as follows:
KeyHandler -> KeyEventHandler -> EventTimerHandler -> TimerTaskHandler -> TaskThis will also merge the API for managed and unmanaged handlers. To create a new key handler, you will then then use the following.
To use the managed API, you will use the following.