use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[derive(Debug, Clone, PartialEq)]
pub type CalendarView;
}
impl CalendarView {
#[must_use]
pub fn view_type(&self) -> Option<crate::InitialView> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("type"))
.ok()
.and_then(|v| v.as_string())
.and_then(|s| s.as_str().parse().ok())
}
#[must_use]
pub fn title(&self) -> Option<String> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("title"))
.ok()
.and_then(|v| v.as_string())
}
#[must_use]
pub fn active_start(&self) -> Option<web_sys::js_sys::Date> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("activeStart"))
.ok()
.and_then(|s| {
web_sys::wasm_bindgen::JsCast::dyn_into::<web_sys::js_sys::Date>(s)
.inspect_err(|e| web_sys::console::error_1(&format!("{e:#?}").into()))
.ok()
})
}
#[must_use]
pub fn active_end(&self) -> Option<web_sys::js_sys::Date> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("activeEnd"))
.ok()
.and_then(|s| {
web_sys::wasm_bindgen::JsCast::dyn_into::<web_sys::js_sys::Date>(s)
.inspect_err(|e| web_sys::console::error_1(&format!("{e:#?}").into()))
.ok()
})
}
#[must_use]
pub fn current_start(&self) -> Option<web_sys::js_sys::Date> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("currentStart"))
.ok()
.and_then(|s| {
web_sys::wasm_bindgen::JsCast::dyn_into::<web_sys::js_sys::Date>(s)
.inspect_err(|e| web_sys::console::error_1(&format!("{e:#?}").into()))
.ok()
})
}
#[must_use]
pub fn current_end(&self) -> Option<web_sys::js_sys::Date> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("currentEnd"))
.ok()
.and_then(|s| {
web_sys::wasm_bindgen::JsCast::dyn_into::<web_sys::js_sys::Date>(s)
.inspect_err(|e| web_sys::console::error_1(&format!("{e:#?}").into()))
.ok()
})
}
#[must_use]
pub fn calendar(&self) -> Option<super::Calendar> {
web_sys::js_sys::Reflect::get(self, &JsValue::from_str("calendar"))
.ok()
.map(web_sys::wasm_bindgen::JsCast::unchecked_into::<super::Calendar>)
}
}