new H_event()
events.js, line 28
Methods
-
staticH_event.add_event(dom_element, event_name, callback, use_capture, evall){boolean|undefined}
events.js, line 690 -
Adds an event listener to a DOM element.
Handles duplicate prevention and delayed registration.Name Type Default Description dom_elementHTMLElement Target element. event_namestring Event type. callbackfunction | string Callback function or string to eval. use_captureboolean optional Use capture phase. evallboolean false optional If true, eval the callback. Returns:
Type Description boolean | undefined True if added, false if duplicate. -
staticH_event.add_event_click(dom_element, callback, use_capture, evall)
events.js, line 1908 -
Adds a click event listener to a DOM element.
Name Type Default Description dom_elementHTMLElement The element. callbackfunction Callback function. use_captureboolean optional Use capture phase. evallboolean false optional If true, eval the callback. -
staticH_event.add_event_click_outside(dom_element, callback, use_capture, evall)
events.js, line 1941 -
Add a click outside event listener to a DOM element.
H_event.other_inside_elements is an array to save other HTMLElement to handle the click like it was inside.
Name Type Default Description dom_elementHTMLElement The element. callbackfunction Callback function. use_captureboolean | null Use capture phase. evallboolean false optional If true, eval the callback. -
staticH_event.add_event_dbl_click(dom_element, callback, use_capture, evall)
events.js, line 1919 -
Adds a double-click event listener to a DOM element.
Name Type Default Description dom_elementHTMLElement The element. callbackfunction Callback function. use_captureboolean optional Use capture phase. evallboolean false optional If true, eval the callback. -
staticH_event.add_event_delayed(dom_element, event_name, callback, use_capture, delay)
events.js, line 772 -
Adds an event listener with a delay.
Why a delay ? to avoid accident trigerring, if we add event on same dom_element that trigger the add_event.Name Type Description dom_elementHTMLElement Target element. event_namestring Event type. callbackfunction Callback function. use_captureboolean Use capture phase. delaynumber Delay in ms. -
staticH_event.add_event_key(dom_element, callback, use_capture, evall)
events.js, line 1930 -
Adds a keyup event listener to a DOM element.
Name Type Default Description dom_elementHTMLElement The element. callbackfunction Callback function. use_captureboolean optional Use capture phase. evallboolean false optional If true, eval the callback. -
staticH_event.add_load_handler(handler, evall)
events.js, line 211 -
Adds a handler to be called on window load.
If the window is already loaded, executes immediately.Name Type Default Description handlerfunction | string Handler function or string to eval. evallboolean false optional If true, eval the handler. -
staticH_event.add_resize_handler(handler, evall)
events.js, line 277 -
Adds a handler to be called on window resize.
Name Type Default Description handlerfunction | string Handler function or string to eval. evallboolean false optional If true, eval the handler. -
staticH_event.apply_event(event_name, event, other_event)
events.js, line 786 -
Applies an event to all registered handlers for the event name.
Handles outside events, bubbling, and nested listeners.Name Type Description event_namestring Event type. eventEvent The event. other_eventEvent optional Optional related event. -
staticH_event.bind_callback(source_class_instance, callback){function}
events.js, line 547 -
Binds a callback to a class instance and caches it.
Useful for event handlers to preserve 'this' context.Name Type Description source_class_instanceObject The class instance. callbackfunction The callback function. Returns:
Type Description function The bound callback. -
staticH_event.broadcast_event(event_name, data, from)
events.js, line 584 -
Broadcasts an event to all listeners.
Optionally restricts to listeners from a specific sender. if from is not specified, all elements listening to an event with the name specified in event_name will be invoked!Name Type Description event_namestring Name of the event. data* Data to send. fromObject optional Sender object (optional). -
staticH_event.check_resize(event){boolean}
events.js, line 1337 -
Checks if the mouse is near a resizable border. Updates resize_data and cursor.
Name Type Description eventEvent The event. Returns:
Type Description boolean True if resize should start. -
staticH_event.detect_mouse_buttons(event)
events.js, line 421 -
Detects which mouse buttons are pressed. Updates H_event.mouse state.
Name Type Description eventMouseEvent | PointerEvent The event. -
staticH_event.disable_drag(dom_element)
events.js, line 1538 -
Disables dragging for a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_event.disable_drop(dom_element)
events.js, line 1818 -
Disables drop events on a DOM element.
Name Type Description dom_elementHTMLElement | Document The element or document. -
staticH_event.disable_event_callback(event){boolean}
events.js, line 455 -
Prevents default event behavior.
Name Type Description eventEvent The event. Returns:
Type Description boolean Always false to block callbacks... -
staticH_event.disable_resize(dom_element)
events.js, line 1286 -
Disables resizing for a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_event.disable_scroll_on_touch(event){boolean}
events.js, line 1752 -
Prevents scrolling on touch devices during drag/resize.
actually similar to H_event.prevent_default(), but it was not the case in the past.
so perhaps it will change again in the future...
so keeped for compatibility reason.Name Type Description eventTouchEvent The event. Returns:
Type Description boolean Always false. -
staticH_event.drag(event, b)
events.js, line 1602 -
Handles dragging of a DOM element during mouse move.
Name Type Description eventEvent The event. bboolean Unused. -
staticH_event.drag_end(event)
events.js, line 1708 -
Ends drag operation.
Name Type Description eventEvent The event. -
staticH_event.enable_drag(dom_element, start_handler, move_handler, end_handler, avatar_handler){boolean}
events.js, line 1493 -
Enables dragging for a DOM element.
Sets up handlers and optional avatar to represent the moving element.
all handlers are callbacks to call at each moment of the drag& drop : start, move, end, and can be replaced by null.
the end_handler can used to replace the drop event on the target.Name Type Description dom_elementHTMLElement The element. start_handlerfunction | Object Start handler or settings object. move_handlerfunction Move handler. end_handlerfunction End handler. avatar_handlerfunction | string Avatar handler or string. Returns:
Type Description boolean True if enabled. -
staticH_event.enable_drop(dom_element, callback){boolean}
events.js, line 1786 -
Enables drop events on a DOM element.
Name Type Description dom_elementHTMLElement | Document The element or document. callbackfunction Drop callback. Returns:
Type Description boolean True if enabled. -
staticH_event.enable_resize(dom_element, start_resize_handler, resize_handler, end_resize_handler, border_detection_size)
events.js, line 1267 -
Enables resizing for a DOM element.
By default, the border detection size is 10 px, and you can use the right and bottom border to resize.
It's better practice to display this border, and set the overflow style property of the dom element to hidden
Sets up handlers and border detection.Name Type Default Description dom_elementHTMLElement The element. start_resize_handlerfunction null Start handler. resize_handlerfunction null Resize handler. end_resize_handlerfunction null End handler. border_detection_sizenumber 10 optional Border size in px. -
staticH_event.end_global_move(event)
events.js, line 1214 -
Ends global move tracking for drag/resize.
Name Type Description eventEvent The event. -
staticH_event.end_resize(event)
events.js, line 1425 -
Ends resize operation.
Name Type Description eventEvent The event. -
staticH_event.extract_data_from_drop_event(event, filter){Object}
events.js, line 1853 -
Extracts data from a drop event.
Supports files, HTML, and text.Name Type Description eventDragEvent | CustomEvent The event. filterArray optional Types to filter. Returns:
Type Description Object Extracted data. -
staticH_event.global_drop(event)
events.js, line 1770 -
Handles global drop events.
Calls the default drop callback if set.Name Type Description eventDragEvent | CustomEvent The event. -
staticH_event.global_key_down(event)
events.js, line 335 -
Handles global keydown events.
Updates key state and applies EVENT_KEYDOWN.Name Type Description eventKeyboardEvent The keydown event. -
staticH_event.global_key_up(event)
events.js, line 353 -
Handles global keyup events.
Updates key state and applies EVENT_KEYUP.Name Type Description eventKeyboardEvent The keyup event. -
staticH_event.global_mouse_down(event)
events.js, line 371 -
Handles global mousedown or pointerdown events.
Detects mouse buttons, initializes drag/resize, and applies EVENT_MOUSEDOWN.Name Type Description eventMouseEvent | PointerEvent The event. -
staticH_event.global_mouse_move(event)
events.js, line 1117 -
Handles global mouse or pointer move events.
Updates drag/resize state and triggers mouse enter/leave.Name Type Description eventMouseEvent | PointerEvent The event. -
staticH_event.global_mouse_up(event)
events.js, line 465 -
Handles global mouseup or pointerup events.
Detects clicks end, double clicks end, and applies EVENT_MOUSEUP.Name Type Description eventMouseEvent | PointerEvent The event. -
staticH_event.handler_event(event)
events.js, line 760 -
Internal event handler that applies the event to registered callbacks.
Name Type Description eventEvent The event. -
staticH_event.has_drag(dom_element){boolean}
events.js, line 1528 -
Checks if a DOM element has drag enabled.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description boolean True if draggable. -
staticH_event.has_drop(dom_element){boolean|number}
events.js, line 1836 -
Checks if a DOM element has drop enabled.
Name Type Description dom_elementHTMLElement | Document The element or document. Returns:
Type Description boolean | number True/1 if enabled, 0 if not. -
staticH_event.has_event(dom_element, event_name){boolean}
events.js, line 967 -
Checks if a DOM element has a listener for a specific event.
Name Type Description dom_elementHTMLElement The element. event_namestring Event type. Returns:
Type Description boolean True if found. -
staticH_event.has_event_callback(dom_element, event_name, callback){boolean}
events.js, line 988 -
Checks if a DOM element has a specific callback for an event.
Name Type Description dom_elementHTMLElement The element. event_namestring Event type. callbackfunction Callback function. Returns:
Type Description boolean True if found. -
staticH_event.init()
events.js, line 172 -
Initializes global event listeners for mouse, touch, keyboard, resize, and load events.
Detects platform and sets up appropriate handlers. -
staticH_event.init_drag(dom_element)
events.js, line 1571 -
Initializes drag operation for a DOM element.
launched by global_mouse_downName Type Description dom_elementHTMLElement The element. -
staticH_event.init_mouse_down_event(event)
events.js, line 431 -
Initializes the current mousedown event and computes offsets.
Name Type Description eventMouseEvent | PointerEvent The event. -
staticH_event.init_resize(mouse_down_event){boolean}
events.js, line 1306 -
Initializes resize operation.
launched by global_mouse_downName Type Description mouse_down_eventEvent The mousedown event. Returns:
Type Description boolean True if resize started. -
staticH_event.is_resizable(dom_element){boolean}
events.js, line 1296 -
Checks if a DOM element is resizable.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description boolean True if resizable. -
staticH_event.listen_to_event(to, event_name, callback, from)
events.js, line 616 -
Registers a listener for an event.
Optionally restricts to events from a specific sender.
if from is not specified, all elements listening to an event with the name specified in event_name will be invoked.Name Type Description toObject Target object. event_namestring Name of the event. callbackfunction Callback function. fromObject optional Sender object (optional). -
staticH_event.mouse_interacting(){boolean}
events.js, line 267 -
Returns true if mouse is interacting (dragging, resizing, etc).
Returns:
Type Description boolean True if interacting. -
staticH_event.prevent_default(event)
events.js, line 1250 -
Prevents default event behavior only.
Name Type Description eventEvent The event. -
staticH_event.remove_all_events(dom_element){boolean}
events.js, line 1058 -
Removes all event listeners from a DOM element.
Name Type Description dom_elementHTMLElement The element. Returns:
Type Description boolean True if removed. -
staticH_event.remove_event(dom_element, event_name, callback){boolean}
events.js, line 1010 -
Removes a specific event listener from a DOM element.
Name Type Description dom_elementHTMLElement The element. event_namestring Event type. callbackfunction Callback function. Returns:
Type Description boolean True if removed. -
staticH_event.remove_event_click(dom_element, callback)
events.js, line 1952 -
Removes a click event listener from a DOM element.
Name Type Description dom_elementHTMLElement The element. callbackfunction Callback function. -
staticH_event.remove_event_click_outside(dom_element, callback)
events.js, line 1979 -
Removes a click outside event listener from a DOM element.
Name Type Description dom_elementHTMLElement The element. callbackfunction Callback function. -
staticH_event.remove_event_dbl_click(dom_element, callback)
events.js, line 1961 -
Removes a double-click event listener from a DOM element.
Name Type Description dom_elementHTMLElement The element. callbackfunction Callback function. -
staticH_event.remove_event_key(dom_element, callback)
events.js, line 1970 -
Removes a keyup event listener from a DOM element.
Name Type Description dom_elementHTMLElement The element. callbackfunction Callback function. -
staticH_event.remove_load_handler(handler)
events.js, line 238 -
Removes a handler from the window load handlers list.
Name Type Description handlerfunction Handler to remove. -
staticH_event.remove_resize_handler(handler)
events.js, line 301 -
Removes a handler from the window resize handlers list.
Name Type Description handlerfunction Handler to remove. -
staticH_event.resize(event)
events.js, line 1437 -
Handles resizing of a DOM element during mouse move.
Name Type Description eventEvent The event. -
staticH_event.send_event(dom_element, type, data, bubbles, cancelable)
events.js, line 648 -
Dispatches a DOM or custom event on an element.
Name Type Default Description dom_elementHTMLElement Target element. typestring Event type. data* optional Event detail data. bubblesboolean true optional Whether the event bubbles. cancelableboolean true optional Whether the event is cancelable. -
staticH_event.send_event_click(dom_element, data, bubbles, cancelable)
events.js, line 1993 -
Dispatches a click event on a DOM element.
Name Type Description dom_elementHTMLElement The element. data* optional Event detail data. bubblesboolean optional Whether the event bubbles. cancelableboolean optional Whether the event is cancelable. -
staticH_event.send_event_click_outside(dom_element, data, bubbles, cancelable)
events.js, line 2026 -
Dispatches a click outside event on a DOM element.
Name Type Description dom_elementHTMLElement The element. data* optional Event detail data. bubblesboolean optional Whether the event bubbles. cancelableboolean optional Whether the event is cancelable. -
staticH_event.send_event_dbl_click(dom_element, data, bubbles, cancelable)
events.js, line 2004 -
Dispatches a double-click event on a DOM element.
Name Type Description dom_elementHTMLElement The element. data* optional Event detail data. bubblesboolean optional Whether the event bubbles. cancelableboolean optional Whether the event is cancelable. -
staticH_event.send_event_key(dom_element, data, bubbles, cancelable)
events.js, line 2015 -
Dispatches a keyup event on a DOM element.
Name Type Description dom_elementHTMLElement The element. data* optional Event detail data. bubblesboolean optional Whether the event bubbles. cancelableboolean optional Whether the event is cancelable. -
staticH_event.set_default_drop_callback(callback)
events.js, line 1762 -
Sets the default drop callback for drag-and-drop.
Name Type Description callbackfunction Callback function. -
staticH_event.set_drag_area(dom_element, area_dom_element, padding)
events.js, line 1548 -
Sets a drag area dom element for a DOM element.
Name Type Default Description dom_elementHTMLElement The element. area_dom_elementHTMLElement Area element. paddingnumber 0 optional Padding in px. -
staticH_event.start_global_move(dom_element, move_handler, end_move_handler)
events.js, line 1097 -
Starts tracking global mouse/touch movement for drag/resize.
Name Type Description dom_elementHTMLElement Target element. move_handlerfunction Move handler. end_move_handlerfunction End handler. -
staticH_event.stop_event(event){boolean}
events.js, line 1230 -
Stops event propagation and default behavior.
Name Type Description eventEvent The event. Returns:
Type Description boolean Always false. -
staticH_event.unset_drag_area(dom_element)
events.js, line 1560 -
Unsets the drag area for a DOM element.
Name Type Description dom_elementHTMLElement The element. -
staticH_event.window_load(event)
events.js, line 252 -
Executes all registered window load handlers.
Sets window_loaded to true.Name Type Description eventEvent The load event. -
staticH_event.window_resize(event)
events.js, line 315 -
Executes all registered window resize handlers.
Also marks the body rect as dirty.Name Type Description eventEvent The resize event.