diff --git a/Cargo.toml b/Cargo.toml index 7a1ebf6..6ad8f89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ futures-signals = "0.3.5" wasm-bindgen = "0.2.45" js-sys = "0.3.22" # TODO fix this before release -gloo = { git = "https://github.com/rustwasm/gloo" } +gloo = { git = "https://github.com/rustwasm/gloo", commit = "e8e505fbdbe96164381bd6fe7ef350438d54a84f" } [dependencies.wasm-bindgen-futures] version = "0.3.22" diff --git a/examples/animation/package.json b/examples/animation/package.json index 3c73d0b..bef4f1d 100644 --- a/examples/animation/package.json +++ b/examples/animation/package.json @@ -4,7 +4,7 @@ "version": "0.1.0", "scripts": { "build": "rimraf dist pkg && webpack", - "start": "rimraf dist pkg && webpack-dev-server --open -d" + "start": "rimraf dist pkg && webpack-dev-server -d" }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "^0.4.2", diff --git a/examples/animation/webpack.config.js b/examples/animation/webpack.config.js index 57f5c32..d33e9cb 100644 --- a/examples/animation/webpack.config.js +++ b/examples/animation/webpack.config.js @@ -6,6 +6,7 @@ const dist = path.resolve(__dirname, "dist"); module.exports = { mode: "production", + stats: "errors-warnings", entry: { index: "./js/index.js" }, @@ -14,7 +15,13 @@ module.exports = { filename: "[name].js" }, devServer: { - contentBase: dist, + liveReload: true, + open: true, + noInfo: true, + overlay: { + warnings: true, + errors: true + } }, plugins: [ new CopyPlugin([ @@ -22,8 +29,7 @@ module.exports = { ]), new WasmPackPlugin({ - crateDirectory: __dirname, - extraArgs: "--out-name index" - }), + crateDirectory: __dirname + }) ] }; diff --git a/examples/counter/package.json b/examples/counter/package.json index fde81d3..f364227 100644 --- a/examples/counter/package.json +++ b/examples/counter/package.json @@ -4,7 +4,7 @@ "version": "0.1.0", "scripts": { "build": "rimraf dist pkg && webpack", - "start": "rimraf dist pkg && webpack-dev-server --open -d" + "start": "rimraf dist pkg && webpack-dev-server -d" }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "^0.4.2", diff --git a/examples/counter/webpack.config.js b/examples/counter/webpack.config.js index 57f5c32..d33e9cb 100644 --- a/examples/counter/webpack.config.js +++ b/examples/counter/webpack.config.js @@ -6,6 +6,7 @@ const dist = path.resolve(__dirname, "dist"); module.exports = { mode: "production", + stats: "errors-warnings", entry: { index: "./js/index.js" }, @@ -14,7 +15,13 @@ module.exports = { filename: "[name].js" }, devServer: { - contentBase: dist, + liveReload: true, + open: true, + noInfo: true, + overlay: { + warnings: true, + errors: true + } }, plugins: [ new CopyPlugin([ @@ -22,8 +29,7 @@ module.exports = { ]), new WasmPackPlugin({ - crateDirectory: __dirname, - extraArgs: "--out-name index" - }), + crateDirectory: __dirname + }) ] }; diff --git a/examples/todomvc/package.json b/examples/todomvc/package.json index 9ce4fa0..7afbdd5 100644 --- a/examples/todomvc/package.json +++ b/examples/todomvc/package.json @@ -4,7 +4,7 @@ "version": "0.1.0", "scripts": { "build": "rimraf dist pkg && webpack", - "start": "rimraf dist pkg && webpack-dev-server --open -d" + "start": "rimraf dist pkg && webpack-dev-server -d" }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "^0.4.2", diff --git a/examples/todomvc/src/lib.rs b/examples/todomvc/src/lib.rs index 1b46481..d3c0d32 100644 --- a/examples/todomvc/src/lib.rs +++ b/examples/todomvc/src/lib.rs @@ -292,7 +292,10 @@ pub fn main_js() -> Result<(), JsValue> { .event(clone!(todo => move |event: events::KeyDown| { match event.key().as_str() { "Enter" => { - event.dyn_target::().unwrap_throw().blur(); + event.dyn_target::() + .unwrap_throw() + .blur() + .unwrap_throw(); }, "Escape" => { todo.editing.set_neq(None); diff --git a/examples/todomvc/webpack.config.js b/examples/todomvc/webpack.config.js index 57f5c32..d33e9cb 100644 --- a/examples/todomvc/webpack.config.js +++ b/examples/todomvc/webpack.config.js @@ -6,6 +6,7 @@ const dist = path.resolve(__dirname, "dist"); module.exports = { mode: "production", + stats: "errors-warnings", entry: { index: "./js/index.js" }, @@ -14,7 +15,13 @@ module.exports = { filename: "[name].js" }, devServer: { - contentBase: dist, + liveReload: true, + open: true, + noInfo: true, + overlay: { + warnings: true, + errors: true + } }, plugins: [ new CopyPlugin([ @@ -22,8 +29,7 @@ module.exports = { ]), new WasmPackPlugin({ - crateDirectory: __dirname, - extraArgs: "--out-name index" - }), + crateDirectory: __dirname + }) ] }; diff --git a/src/animation.rs b/src/animation.rs index cc2afa8..e5eb768 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -100,6 +100,7 @@ struct TimestampsState { waker: Option, } +// TODO must_use ? #[derive(Debug)] pub struct Timestamps { state: Arc>, diff --git a/src/dom.rs b/src/dom.rs index 41ba277..9b5f083 100644 --- a/src/dom.rs +++ b/src/dom.rs @@ -124,6 +124,7 @@ pub fn append_dom(parent: &Node, mut dom: Dom) -> DomHandle { } +// TODO use must_use ? enum IsWindowLoaded { Initial {}, Pending { @@ -214,6 +215,8 @@ pub fn text_signal(value: B) -> Dom } +// TODO better warning message for must_use +#[must_use] #[derive(Debug)] pub struct Dom { pub(crate) element: Node, @@ -232,7 +235,6 @@ impl Dom { #[inline] pub fn empty() -> Self { // TODO is there a better way of doing this ? - // TODO is it legal to append children to a comment node ? Self::new(document().create_comment("").into()) } @@ -351,6 +353,8 @@ fn set_property(element: &A, name: &B, value: C) where A: AsRef { element: A, callbacks: Callbacks, diff --git a/src/operations.rs b/src/operations.rs index d1e02a8..063963a 100644 --- a/src/operations.rs +++ b/src/operations.rs @@ -16,7 +16,6 @@ use crate::dom::Dom; use crate::callbacks::Callbacks; -// TODO this should probably be in stdweb #[inline] pub(crate) fn spawn_future(future: F) -> DiscardOnDrop where F: Future + 'static { diff --git a/src/utils.rs b/src/utils.rs index 01ed016..e5a5466 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -67,6 +67,7 @@ impl Discard for FnDiscard where A: FnOnce() { } +// TODO verify that this doesn't leak events / memory // TODO is this worth using ? pub(crate) struct EventDiscard(Option);