-
-
Save evq/f8239238b368653dee634cc9d2f74fae to your computer and use it in GitHub Desktop.
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
diff --git examples/todomvc/Cargo.toml examples/todomvc/Cargo.toml | |
index fe01ede..b39fee7 100644 | |
--- examples/todomvc/Cargo.toml | |
+++ examples/todomvc/Cargo.toml | |
@@ -8,3 +8,4 @@ serde = "1" | |
serde_json = "1" | |
serde_derive = "1" | |
stdweb = { path = "../.." } | |
+chrono = { git = "https://github.com/evq/chrono", branch = "wasm" } | |
diff --git examples/todomvc/src/main.rs examples/todomvc/src/main.rs | |
index 95af8c9..9b745f7 100644 | |
--- examples/todomvc/src/main.rs | |
+++ examples/todomvc/src/main.rs | |
@@ -5,6 +5,10 @@ extern crate stdweb; | |
extern crate serde_derive; | |
extern crate serde_json; | |
+extern crate chrono; | |
+ | |
+use chrono::prelude::*; | |
+ | |
use std::cell::RefCell; | |
use std::rc::Rc; | |
@@ -198,6 +202,9 @@ fn update_dom( state: &StateRef ) { | |
fn main() { | |
stdweb::initialize(); | |
+ println!("{}", Utc::now()); | |
+ println!("{}", Local::now()); | |
+ | |
let state = window().local_storage().get( "state" ).and_then( |state_json| { | |
serde_json::from_str( state_json.as_str() ).ok() | |
}).unwrap_or_else( State::new ); | |
diff --git examples/wasm-bindgen-minimal/Cargo.toml examples/wasm-bindgen-minimal/Cargo.toml | |
index 848c70e..0589ddb 100644 | |
--- examples/wasm-bindgen-minimal/Cargo.toml | |
+++ examples/wasm-bindgen-minimal/Cargo.toml | |
@@ -10,3 +10,4 @@ crate-type = ["cdylib"] | |
[dependencies] | |
wasm-bindgen = "0.2" | |
stdweb = { path = "../.." } | |
+chrono = { git = "https://github.com/evq/chrono", branch = "wasm" } | |
diff --git examples/wasm-bindgen-minimal/src/lib.rs examples/wasm-bindgen-minimal/src/lib.rs | |
index 70c7517..5c8ba09 100644 | |
--- examples/wasm-bindgen-minimal/src/lib.rs | |
+++ examples/wasm-bindgen-minimal/src/lib.rs | |
@@ -1,6 +1,8 @@ | |
#[macro_use] | |
extern crate stdweb; | |
+extern crate chrono; | |
+use chrono::prelude::*; | |
use wasm_bindgen::prelude::*; | |
#[wasm_bindgen(start)] | |
@@ -9,6 +11,10 @@ pub fn main() -> Result<(), JsValue> { | |
js! { | |
alert( @{message} ); | |
} | |
+ js! { | |
+ console.log(@{format!("{}", Utc::now())}); | |
+ console.log(@{format!("{}", Local::now())}); | |
+ } | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment