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>
forWindow
event handler).target
contains reference to the notification target DOM element.source
element e.g. inSELECTION_CHANGED
it is new selected<option>
, inMENU_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
fn get_subscription(&mut self) -> Option<EVENT_GROUPS>
Return list of event groups this event_handler is subscribed to.
Default is HANDLE_BEHAVIOR_EVENT | HANDLE_SCRIPTING_METHOD_CALL
.
See also default_events()
.
fn attached(&mut self, root: HELEMENT)
Called when handler was attached to element or window.
root
is NULL if attaching to window without loaded document.
fn detached(&mut self, root: HELEMENT)
Called when handler was detached from element or window.
fn document_complete(&mut self, root: HELEMENT, target: HELEMENT)
Notification that document finishes its loading - all requests for external resources are finished
fn document_close(&mut self, root: HELEMENT, target: HELEMENT)
The last notification before document removal from the DOM.
fn on_script_call(
&mut self,
root: HELEMENT,
name: &str,
args: &[Value]
) -> Option<Value>
&mut self,
root: HELEMENT,
name: &str,
args: &[Value]
) -> Option<Value>
Script calls from CSSS! script and TIScript.
fn dispatch_script_call(
&mut self,
root: HELEMENT,
name: &str,
args: &[Value]
) -> Option<Value>
&mut self,
root: HELEMENT,
name: &str,
args: &[Value]
) -> Option<Value>
Autogenerated dispatcher for script calls.
fn on_event(
&mut self,
root: HELEMENT,
source: HELEMENT,
target: HELEMENT,
code: BEHAVIOR_EVENTS,
phase: PHASE_MASK,
reason: EventReason
) -> bool
&mut self,
root: HELEMENT,
source: HELEMENT,
target: HELEMENT,
code: BEHAVIOR_EVENTS,
phase: PHASE_MASK,
reason: EventReason
) -> bool
Notification event from builtin behaviors.
fn on_timer(&mut self, root: HELEMENT, timer_id: u64) -> bool
Timer event from attached element.