Remove support for stdweb (#1941)

* Remove support for `stdweb`

* Expunge `stdweb`; make `web-sys` the default

* Mark this change as a breaking change

* Re-insert accidental removal of space

* Use the correct cargo feature syntax

* Re-add some `cfg` attributes

* Remove `web-sys` feature from CI
This commit is contained in:
Markus Røyset 2021-05-24 19:06:21 +02:00 committed by GitHub
parent b371b406d5
commit 657b4fd59e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 13 additions and 815 deletions

View file

@ -12,7 +12,7 @@ pub fn main() {
.build(&event_loop)
.unwrap();
#[cfg(feature = "web-sys")]
#[cfg(target_arch = "wasm32")]
{
use winit::platform::web::WindowExtWebSys;
@ -26,28 +26,12 @@ pub fn main() {
.expect("Append canvas to HTML body");
}
#[cfg(feature = "stdweb")]
{
use std_web::web::INode;
use winit::platform::web::WindowExtStdweb;
let canvas = window.canvas();
let document = std_web::web::document();
let body: std_web::web::Node = document.body().expect("Get HTML body").into();
body.append_child(&canvas);
}
event_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Wait;
#[cfg(feature = "web-sys")]
#[cfg(target_arch = "wasm32")]
log::debug!("{:?}", event);
#[cfg(feature = "stdweb")]
std_web::console!(log, "%s", format!("{:?}", event));
match event {
Event::WindowEvent {
event: WindowEvent::CloseRequested,
@ -61,7 +45,7 @@ pub fn main() {
});
}
#[cfg(feature = "web-sys")]
#[cfg(target_arch = "wasm32")]
mod wasm {
use wasm_bindgen::prelude::*;