Unify and simplify Ox.Event, Ox.Keyboard and Ox.Message #205

Closed
opened 2013-12-07 13:01:56 +00:00 by rlx · 0 comments
Owner
  • unify eventHandler signature: data, event, element (event is useful for catch-all, element for global handlers)
  • properly namespace keyboard events ('key.shift_0.numpad')
  • still allow key_a: handler as alias for 'key.a': handler
  • remove Ox.Keyboard, as (global) bind/unbind is now Ox.Event.bind/unbind('key') or ({key_a: ..., key_b: ..., ...})
  • in global keyboard handlers like menus (as opposed to loggers), only act if focused element is not input
  • in Ox.Focus, rename 'focused' to 'focusedElement' and add 'focusedElementIsInput' (true for .OxInput, .OxEditableElement, .OxAutocompleteMenu)
  • in keyboard events, pass original event, extended with 'key' or 'keys' (like mouse events with clientDX/DY)
  • remove exceptions in document.onkeydown and let handlers call e.preventDefault (like mouse event handlers calling e.stopPropagation)
  • as per above, autocomplete menus can prevent default for up/down (don't move cursor in input) and lists for control_shift_c (don't open chrome inspector)
  • other exceptions are unconditional and unneeded (if an app doesn't like specific defaults, like space to scroll, or escape to cancel requests in Firefox, it can prevent them in a global handler)
  • move Ox.Message in the same closure as Ox.Event, and use the same generic bind/bindOnce/trigger/unbind methods (#149)
  • make onMessage bindMessage (for symmetry)
  • add bindMessage/bindMessageOnce/postMessage/triggerMessage/unbindMessage to Ox.Element and Ox.$parent
  • only store callbacks, not {callback:, once:} handler objects, and in case of bindOnce, bind self-unbinding callback
  • rename Element's self.eventHandlers to self.eventCallbacks and add self.messageCallbacks
  • move event logging to userland (Ox.Event.bind(globalCatchallHandler))
- unify eventHandler signature: data, event, element (event is useful for catch-all, element for global handlers) - properly namespace keyboard events ('key.shift_0.numpad') - still allow `key_a: handler` as alias for `'key.a': handler` - remove Ox.Keyboard, as (global) bind/unbind is now Ox.Event.bind/unbind('key') or ({key_a: ..., key_b: ..., ...}) - in global keyboard handlers like menus (as opposed to loggers), only act if focused element is not input - in Ox.Focus, rename 'focused' to 'focusedElement' and add 'focusedElementIsInput' (true for .OxInput, .OxEditableElement, .OxAutocompleteMenu) - in keyboard events, pass original event, extended with 'key' or 'keys' (like mouse events with clientDX/DY) - remove exceptions in document.onkeydown and let handlers call e.preventDefault (like mouse event handlers calling e.stopPropagation) - as per above, autocomplete menus can prevent default for up/down (don't move cursor in input) and lists for control_shift_c (don't open chrome inspector) - other exceptions are unconditional and unneeded (if an app doesn't like specific defaults, like space to scroll, or escape to cancel requests in Firefox, it can prevent them in a global handler) - move Ox.Message in the same closure as Ox.Event, and use the same generic bind/bindOnce/trigger/unbind methods (#149) - make onMessage bindMessage (for symmetry) - add bindMessage/bindMessageOnce/postMessage/triggerMessage/unbindMessage to Ox.Element and Ox.$parent - only store callbacks, not {callback:, once:} handler objects, and in case of bindOnce, bind self-unbinding callback - rename Element's self.eventHandlers to self.eventCallbacks and add self.messageCallbacks - move event logging to userland (`Ox.Event.bind(globalCatchallHandler)`)
rlx added the
Ox.UI
label 2013-12-07 13:01:56 +00:00
rlx self-assigned this 2013-12-07 13:01:56 +00:00
rlx added the
severity: major
enhancement
0.1
0.1
labels 2013-12-07 13:01:56 +00:00
rlx added the
fixed
label 2014-09-24 08:30:56 +00:00
rlx closed this issue 2014-09-24 08:30:56 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: 0x2620/oxjs#205
No description provided.