Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jiff: add robust WASM support #58

Merged
merged 1 commit into from
Jul 31, 2024
Merged

jiff: add robust WASM support #58

merged 1 commit into from
Jul 31, 2024

Conversation

BurntSushi
Copy link
Owner

@BurntSushi BurntSushi commented Jul 29, 2024

This PR basically makes the wasm{32,64}-unknown-unknown targets work
almost out of the box. All you need to do is enable Jiff's new js
crate feature. This will cause Jiff to depend on js-sys and
wasm-bindgen. Jiff will then use Javascript APIs to determine the
current time and time zone.

This PR also includes a new long form guide, PLATFORM.md, which
describes Jiff's platform support in one central location. (Most
information is already in Jiff's API docs, but it's scattered in a
variety of places.)

Finally, this adds a wasm32-unknown-unknown test to CI courtesy of
wasm-pack. It just does a basic sanity check that the current time and
time zone can be retrieved.

Fixes #56

@BurntSushi BurntSushi force-pushed the ag/support-wasm-better branch 8 times, most recently from 792a59c to 2f74f1c Compare July 31, 2024 00:03
@BurntSushi BurntSushi changed the title wip jiff: add robust WASM support Jul 31, 2024
@BurntSushi
Copy link
Owner Author

For posterity, I had this conversion with the wasmtime folks about how best to approach WASM support. Their help was instrumental in figuring out what to do here, and also in helping to educate me enough to write some half way decent WASM platform documentation.

This PR basically makes the `wasm{32,64}-unknown-unknown` targets work
_almost_ out of the box. All you need to do is enable Jiff's new `js`
crate feature. This will cause Jiff to depend on `js-sys` and
`wasm-bindgen`. Jiff will then use Javascript APIs to determine the
current time and time zone.

This PR also includes a new long form guide, `PLATFORM.md`, which
describes Jiff's platform support in one central location. (Most
information is already in Jiff's API docs, but it's scattered in a
variety of places.)

Finally, this adds a `wasm32-unknown-unknown` test to CI courtesy of
`wasm-pack`. It just does a basic sanity check that the current time and
time zone can be retrieved.

Fixes #56
@BurntSushi BurntSushi merged commit a44e494 into master Jul 31, 2024
17 checks passed
@BurntSushi BurntSushi deleted the ag/support-wasm-better branch July 31, 2024 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TimeZone::system(): support WASM as a platform
1 participant