Closed jaminhaber closed 10 months ago
Seems to be coming from this line which seems to be a known issue with Instant::now
when compiling for wasm32-unknown-unknown
. Is it possible to disable some of the features behind a "no-std" or "wasm" flag?
I can confirm it works with my fork here where i simply delete that code - I can use that for now since I am not taking advantage of any async code 👍🏻 If you want I can look about adding a flag for async stuff?
That code should only need to run Instant::now
if the is_async_time_limited
value is true. Maybe it should be an Option<Instant>
, set to None
if is_async_time_limited
is false, and its contents could be checked instead of this condition.
(As a bigger refactor, I was thinking this code could be made into more of a co-routine pattern, meaning the code related to time and milliseconds could be abstracted out. The timing aspect is just a function that says "keep going" or "stop", and it feels weird to have this core function dealing directly in milliseconds.)
I think that this PR should fix this issue and enables the use of async feature in WASM too: https://github.com/bladecoder/blade-ink-rs/pull/12
I could not test it. @jaminhaber , could you test it before I merge?
@IFcoltransG, what do you think about this solution?
Yep! I am able to run the game in wasm with this:
bladeink = { git = "https://github.com/bladecoder/blade-ink-rs", branch = "fix/wasm_instant_now" }
Branch merged in master.
I have a bevy project with the story added as a
NonSend
resource but I am encountering the following error when exporting as WASM and embedding on a web page.The error may or may not be related to this package but just wanted to flag it
Main fn:
Error: