Skip to content

Panics in browser environment #511

@boxdot

Description

@boxdot

Panic happens due to usage of Instant::now() which is not implemented in the stdlib for the wasm32-unknown-unknown target.

A solution would be to use a more general wasm-timer crate, which re-exports std::time::Instant for native targets and uses web_sys to implement it for wasm32.

Here is a patch which I am using for a while in production: boxdot@a14c89c.

Please let me know if it is acceptable, then I will create a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions