-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ecd63e
commit 383a38e
Showing
10 changed files
with
41 additions
and
105 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,15 @@ | ||
use sevenguis_lib::home_page; | ||
use polyester::page::wasm; | ||
use polyester::page::Page; | ||
use polyester_macro::impl_wasm_page; | ||
use sevenguis_lib::home_page; | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub struct HomePage(home_page::HomePage); | ||
|
||
#[wasm_bindgen] | ||
impl HomePage { | ||
#[wasm_bindgen(constructor)] | ||
pub fn new() -> Result<HomePage, JsValue> { | ||
Ok(HomePage(home_page::HomePage {})) | ||
} | ||
|
||
#[wasm_bindgen(js_name = id)] | ||
pub fn id(&self) -> Result<String, JsValue> { | ||
Ok(self.0.id().to_string()) | ||
} | ||
|
||
#[wasm_bindgen(js_name = init)] | ||
pub fn initial_model(&self) -> Result<JsValue, JsValue> { | ||
wasm::init(&self.0) | ||
} | ||
|
||
#[wasm_bindgen(js_name = viewBody)] | ||
pub fn view_body(&self, js_model: &JsValue) -> Result<String, JsValue> { | ||
wasm::view_body(&self.0, js_model) | ||
} | ||
|
||
#[wasm_bindgen(js_name = getSubscriptions)] | ||
pub fn get_subscriptions(&self, js_model: &JsValue) -> Result<JsValue, JsValue> { | ||
wasm::get_subscriptions(&self.0, js_model) | ||
} | ||
impl_wasm_page!(HomePage); | ||
|
||
#[wasm_bindgen(js_name = update)] | ||
pub fn update(&self, js_msg: &JsValue, js_model: &JsValue) -> Result<JsValue, JsValue> { | ||
wasm::update(&self.0, js_msg, js_model) | ||
} | ||
#[wasm_bindgen(js_name = homePage)] | ||
pub fn home_page() -> Result<HomePage, JsValue> { | ||
Ok(HomePage(home_page::HomePage {})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,15 @@ | ||
use polyester::page::wasm; | ||
use polyester::page::Page; | ||
use polyester_macro::impl_wasm_page; | ||
use sevenguis_lib::temperature_page; | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub struct TemperaturePage(temperature_page::TemperaturePage); | ||
|
||
#[wasm_bindgen] | ||
impl TemperaturePage { | ||
#[wasm_bindgen(constructor)] | ||
pub fn new() -> Result<TemperaturePage, JsValue> { | ||
Ok(TemperaturePage(temperature_page::TemperaturePage {})) | ||
} | ||
|
||
#[wasm_bindgen(js_name = id)] | ||
pub fn id(&self) -> Result<String, JsValue> { | ||
Ok(self.0.id().to_string()) | ||
} | ||
|
||
#[wasm_bindgen(js_name = init)] | ||
pub fn initial_model(&self) -> Result<JsValue, JsValue> { | ||
wasm::init(&self.0) | ||
} | ||
|
||
#[wasm_bindgen(js_name = viewBody)] | ||
pub fn view_body(&self, js_model: &JsValue) -> Result<String, JsValue> { | ||
wasm::view_body(&self.0, js_model) | ||
} | ||
|
||
#[wasm_bindgen(js_name = getSubscriptions)] | ||
pub fn get_subscriptions(&self, js_model: &JsValue) -> Result<JsValue, JsValue> { | ||
wasm::get_subscriptions(&self.0, js_model) | ||
} | ||
impl_wasm_page!(TemperaturePage); | ||
|
||
#[wasm_bindgen(js_name = update)] | ||
pub fn update(&self, js_msg: &JsValue, js_model: &JsValue) -> Result<JsValue, JsValue> { | ||
wasm::update(&self.0, js_msg, js_model) | ||
} | ||
#[wasm_bindgen(js_name = temperaturePage)] | ||
pub fn temperature_page() -> Result<TemperaturePage, JsValue> { | ||
Ok(TemperaturePage(temperature_page::TemperaturePage {})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,21 @@ | ||
use polyester::page::wasm; | ||
use polyester::page::Page; | ||
use polyester_macro::impl_wasm_page; | ||
use sevenguis_lib::timer_page; | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub struct TimerPage(timer_page::TimerPage); | ||
|
||
#[wasm_bindgen] | ||
impl TimerPage { | ||
#[wasm_bindgen(constructor)] | ||
pub fn new(js_current_time: &JsValue) -> Result<TimerPage, JsValue> { | ||
let current_time = js_current_time | ||
.into_serde() | ||
.map_err(|err| format!("Failed to decode current time: {}", err))?; | ||
|
||
Ok(TimerPage(timer_page::TimerPage { | ||
initial_time: current_time, | ||
})) | ||
} | ||
|
||
#[wasm_bindgen(js_name = id)] | ||
pub fn id(&self) -> Result<String, JsValue> { | ||
Ok(self.0.id().to_string()) | ||
} | ||
|
||
#[wasm_bindgen(js_name = init)] | ||
pub fn init(&self) -> Result<JsValue, JsValue> { | ||
wasm::init(&self.0) | ||
} | ||
|
||
#[wasm_bindgen(js_name = viewBody)] | ||
pub fn view_body(&self, js_model: &JsValue) -> Result<String, JsValue> { | ||
wasm::view_body(&self.0, js_model) | ||
} | ||
impl_wasm_page!(TimerPage); | ||
|
||
#[wasm_bindgen(js_name = getSubscriptions)] | ||
pub fn get_subscriptions(&self, js_model: &JsValue) -> Result<JsValue, JsValue> { | ||
wasm::get_subscriptions(&self.0, js_model) | ||
} | ||
#[wasm_bindgen(js_name = timerPage)] | ||
pub fn timer_page(js_current_time: &JsValue) -> Result<TimerPage, JsValue> { | ||
let current_time = js_current_time | ||
.into_serde() | ||
.map_err(|err| format!("Failed to decode current time: {}", err))?; | ||
|
||
#[wasm_bindgen(js_name = update)] | ||
pub fn update(&self, js_msg: &JsValue, js_model: &JsValue) -> Result<JsValue, JsValue> { | ||
wasm::update(&self.0, js_msg, js_model) | ||
} | ||
Ok(TimerPage(timer_page::TimerPage { | ||
initial_time: current_time, | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters