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

Refactor for Builder Pattern and Add custom HTML option #36

Closed
wants to merge 3 commits into from
Closed

Refactor for Builder Pattern and Add custom HTML option #36

wants to merge 3 commits into from

Conversation

stevenhuyn
Copy link

@stevenhuyn stevenhuyn commented Jun 6, 2023

Todo

  • Complete documentation

Closes #35
Makes Possible rust-windowing/winit#2816
Will Enable rust-windowing/winit#2852

Happy to change stuff, please feel free to suggest stuff.

fn main() {
    cargo_run_wasm::WasmRunnerBuilder::new()
        .css(
            r#"
        body { 
            margin: 0px; 
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        "#,
        )
        .html(include_str!("../../examples/web.html"))
        .build()
        .unwrap()
        .run();
}
``

@daxpedda
Copy link

daxpedda commented Jun 6, 2023

Are two separate types really necessary? The build() function seems pretty useless:

WasmRunner::new().with_html(...).with_css(...).run();

... seems to do the trick.

EDIT: Just an idea, you should probably wait for @rukai's opinion on this.

@stevenhuyn
Copy link
Author

stevenhuyn commented Jun 6, 2023

Mr GPT suggested 2 structs but you make good points.

@rukai
Copy link
Owner

rukai commented Jul 9, 2023

First a builder will be introduced as per #37 (comment)
Then I will come back to this PR and consider how we could introduce custom html into that builder.

@stevenhuyn
Copy link
Author

legend, thanks man

@stevenhuyn stevenhuyn closed this by deleting the head repository Aug 29, 2023
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.

add support for specifying html
3 participants