Trait sciter::dom::event::EventHandler [] [src]

pub trait EventHandler {
    fn get_subscription(&mut self) -> Option<EVENT_GROUPS> { ... }
fn attached(&mut self, root: HELEMENT) { ... }
fn detached(&mut self, root: HELEMENT) { ... }
fn document_complete(&mut self, root: HELEMENT, target: HELEMENT) { ... }
fn document_close(&mut self, root: HELEMENT, target: HELEMENT) { ... }
fn on_script_call(
        &mut self,
        root: HELEMENT,
        name: &str,
        args: &[Value]
    ) -> Option<Value> { ... }
fn dispatch_script_call(
        &mut self,
        root: HELEMENT,
        name: &str,
        args: &[Value]
    ) -> Option<Value> { ... }
fn on_event(
        &mut self,
        root: HELEMENT,
        source: HELEMENT,
        target: HELEMENT,
        code: BEHAVIOR_EVENTS,
        phase: PHASE_MASK,
        reason: EventReason
    ) -> bool { ... }
fn on_timer(&mut self, root: HELEMENT, timer_id: u64) -> bool { ... } }

DOM event handler which can be attached to any DOM element.

In notifications:

  • root means the DOM element to which we attached (<html> for Window event handler).
  • target contains reference to the notification target DOM element.
  • source element e.g. in SELECTION_CHANGED it is new selected <option>, in MENU_ITEM_CLICK it is menu item (<li>) element.

For example, if we attached to <body> element, we will receive document_complete with target set to <html>.

Provided Methods

Return list of event groups this event_handler is subscribed to.

Default is HANDLE_BEHAVIOR_EVENT | HANDLE_SCRIPTING_METHOD_CALL. See also default_events().

Called when handler was attached to element or window. root is NULL if attaching to window without loaded document.

Called when handler was detached from element or window.

Notification that document finishes its loading - all requests for external resources are finished

The last notification before document removal from the DOM.

Script calls from CSSS! script and TIScript.

Autogenerated dispatcher for script calls.

Notification event from builtin behaviors.

Timer event from attached element.

Implementors