-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
f4b7636
commit 792a59c
Showing
19 changed files
with
402 additions
and
76 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[build.env] | ||
passthrough = [ | ||
"TZ", | ||
"RUST_LOG", | ||
"RUST_BACKTRACE", | ||
] |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Platform support | ||
|
||
This document describes Jiff's platform support. |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/Cargo.lock | ||
/target | ||
/tests |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
publish = false | ||
name = "jiff-wasm" | ||
version = "0.1.0" | ||
authors = ["Andrew Gallant <[email protected]>"] | ||
license = "Unlicense OR MIT" | ||
edition = "2021" | ||
|
||
[workspace] | ||
|
||
[lib] | ||
path = "lib.rs" | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
jiff = { path = "..", features = ["js"] } | ||
wasm-bindgen = "0.2.84" | ||
wasm-bindgen-test = "0.3.34" | ||
web-sys = { version = "0.3.69", features = ["console"] } | ||
|
||
# The `console_error_panic_hook` crate provides better debugging of panics | ||
# by logging them with `console.error`. | ||
console_error_panic_hook = "0.1.7" | ||
|
||
[profile.release] | ||
opt-level = "s" |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
jiff-wasm | ||
========= | ||
This is a small dummy test project for doing a sanity check that getting the | ||
current time and time zone on the `wasm32-unknown-unknown` target with the `js` | ||
Jiff crate feature enabled works as expected. | ||
|
||
This is not a published crate. It is only used in CI testing. |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use wasm_bindgen_test::*; | ||
|
||
macro_rules! eprintln { | ||
($($tt:tt)*) => {{ | ||
let s = std::format!($($tt)*); | ||
web_sys::console::log_1(&s.into()); | ||
}} | ||
} | ||
|
||
#[wasm_bindgen_test] | ||
fn zoned_now_no_panic() { | ||
let zdt = jiff::Zoned::now(); | ||
eprintln!("{zdt}"); | ||
} | ||
|
||
// Not sure if this is needed? ---AG | ||
pub fn set_panic_hook() { | ||
// When the `console_error_panic_hook` feature is enabled, we can call the | ||
// `set_panic_hook` function at least once during initialization, and then | ||
// we will get better error messages if our code ever panics. | ||
// | ||
// For more details see | ||
// https://github.com/rustwasm/console_error_panic_hook#readme | ||
console_error_panic_hook::set_once(); | ||
} |
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
Oops, something went wrong.