Skip to content

Conversation

nuria-fl
Copy link
Contributor

svelte + wasm because why not 🤯

let start = null;

const handleStats = timestamp => {
const elapsedTime = timestamp - start;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this have if (start == null) { start = timestamp; return; } ?

const elapsedTime = timestamp - start;
start = timestamp;
decrease_stats(stats, elapsedTime / 1000);
stats = stats; // pffffff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Svelte's neatness? Maybe rewriting as:

stats = decrease_stats(stats, elapsedTime / 1000);

would make it less weird

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't work because decrease_stats doesn't return the stats, since it's a borrowed reference and AFAIK it's not possible at the moment to do that with wasm-bindgen.
Anyway, this was just to try out wasm, I'm not gonna move forward with this at least for a few months (too much unsupported stuff). Thanks for your comments though!

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.

2 participants