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

add wasm example #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add wasm example #16

wants to merge 1 commit into from

Conversation

zhangzqs
Copy link
Contributor

@zhangzqs zhangzqs commented Jul 5, 2024

No description provided.

@zhangzqs zhangzqs mentioned this pull request Jul 5, 2024
Copy link
Owner

@maxwase maxwase left a comment

Choose a reason for hiding this comment

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

Thank you so much for sharing this unexpected, yet valid usecase for this crate! There are some minor changes that I request and I would love to merge this

align-items: center;
width: 200px;
height: 100px;
background-color: lightgray;
Copy link
Owner

Choose a reason for hiding this comment

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

Let's not override the default style to have a standard "animation" visible

Comment on lines +19 to +21
<div class="clickable-area">
<span>Press Area</span>
</div>
Copy link
Owner

Choose a reason for hiding this comment

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

Let's change this to

Suggested change
<div class="clickable-area">
<span>Press Area</span>
</div>
<button class="clickable-area" type="button">Button</button>

}

#[derive(Clone, Default)]
struct MockButtonPin(Rc<RefCell<bool>>);
Copy link
Owner

Choose a reason for hiding this comment

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

I don't feel like it is a mock, let's change the name to ButtonInput or something


impl WasmInstant {
fn now() -> WasmInstant {
WasmInstant(Date::now() as u64)
Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for this! I think you can even implement impl InstantProvider<Duration> for Date in the crate istef and guard it by a feature "wasm" as it already implements Sub

@@ -0,0 +1,117 @@
use std::{cell::RefCell, ops::Sub, rc::Rc, time::Duration};
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please add a top-level comment similar to other examples? For example how to run this (trunk serve?)

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