Trait sauron_core::dom::CustomElement
source · pub trait CustomElement<MSG> {
// Required methods
fn custom_tag() -> &'static str;
fn observed_attributes() -> Vec<&'static str>;
fn attribute_changed<APP>(
program: &Program<APP, MSG>,
attr_name: &str,
old_value: JsValue,
new_value: JsValue
)
where APP: Application<MSG> + 'static,
MSG: 'static;
fn connected_callback(&mut self);
fn disconnected_callback(&mut self);
fn adopted_callback(&mut self);
}
Expand description
a trait for implementing CustomElement in the DOM with custom tag
Required Methods§
sourcefn custom_tag() -> &'static str
fn custom_tag() -> &'static str
the custom tag that this custom element will be registerd to the browser
sourcefn observed_attributes() -> Vec<&'static str>
fn observed_attributes() -> Vec<&'static str>
returns the attributes that is observed by this component These are the names of the attributes the component is interested in
sourcefn attribute_changed<APP>(
program: &Program<APP, MSG>,
attr_name: &str,
old_value: JsValue,
new_value: JsValue
)where
APP: Application<MSG> + 'static,
MSG: 'static,
fn attribute_changed<APP>( program: &Program<APP, MSG>, attr_name: &str, old_value: JsValue, new_value: JsValue )where APP: Application<MSG> + 'static, MSG: 'static,
This will be invoked when a component is used as a custom element and the attributes of the custom-element has been modified
if the listed attributes in the observed attributes are modified
sourcefn connected_callback(&mut self)
fn connected_callback(&mut self)
the component is attached to the dom
sourcefn disconnected_callback(&mut self)
fn disconnected_callback(&mut self)
the component is removed from the DOM
sourcefn adopted_callback(&mut self)
fn adopted_callback(&mut self)
the component is moved or attached to the dom