use super::*;
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct CharacterBoundsUpdateEvent {
inner: Event,
}
impl FromVal for CharacterBoundsUpdateEvent {
fn from_val(v: &Any) -> Self {
CharacterBoundsUpdateEvent {
inner: Event::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for CharacterBoundsUpdateEvent {
type Target = Event;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for CharacterBoundsUpdateEvent {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for CharacterBoundsUpdateEvent {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for CharacterBoundsUpdateEvent {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<CharacterBoundsUpdateEvent> for Any {
fn from(s: CharacterBoundsUpdateEvent) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&CharacterBoundsUpdateEvent> for Any {
fn from(s: &CharacterBoundsUpdateEvent) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(CharacterBoundsUpdateEvent);
impl CharacterBoundsUpdateEvent {
pub fn range_start(&self) -> u32 {
self.inner.get("rangeStart").as_::<u32>()
}
}
impl CharacterBoundsUpdateEvent {
pub fn range_end(&self) -> u32 {
self.inner.get("rangeEnd").as_::<u32>()
}
}
impl CharacterBoundsUpdateEvent {
pub fn new(type_: &JsString) -> CharacterBoundsUpdateEvent {
Self {
inner: Any::global("CharacterBoundsUpdateEvent")
.new(&[type_.into()])
.as_::<Event>(),
}
}
}
impl CharacterBoundsUpdateEvent {
pub fn new_with_options(
type_: &JsString,
options: &CharacterBoundsUpdateEventInit,
) -> CharacterBoundsUpdateEvent {
Self {
inner: Any::global("CharacterBoundsUpdateEvent")
.new(&[type_.into(), options.into()])
.as_::<Event>(),
}
}
}