Minor tweaks
This commit is contained in:
parent
8e276c3572
commit
a7904e27c8
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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::<HtmlElement>().unwrap_throw().blur();
|
||||
event.dyn_target::<HtmlElement>()
|
||||
.unwrap_throw()
|
||||
.blur()
|
||||
.unwrap_throw();
|
||||
},
|
||||
"Escape" => {
|
||||
todo.editing.set_neq(None);
|
||||
|
|
|
@ -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
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
|
@ -100,6 +100,7 @@ struct TimestampsState {
|
|||
waker: Option<Waker>,
|
||||
}
|
||||
|
||||
// TODO must_use ?
|
||||
#[derive(Debug)]
|
||||
pub struct Timestamps {
|
||||
state: Arc<Mutex<TimestampsState>>,
|
||||
|
|
|
@ -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<A, B>(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<A, B, C>(element: &A, name: &B, value: C) where A: AsRef<JsValue
|
|||
}
|
||||
|
||||
|
||||
// TODO better warning message for must_use
|
||||
#[must_use]
|
||||
pub struct DomBuilder<A> {
|
||||
element: A,
|
||||
callbacks: Callbacks,
|
||||
|
|
|
@ -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<F>(future: F) -> DiscardOnDrop<CancelableFutureHandle>
|
||||
where F: Future<Output = ()> + 'static {
|
||||
|
|
|
@ -67,6 +67,7 @@ impl<A> Discard for FnDiscard<A> where A: FnOnce() {
|
|||
}
|
||||
|
||||
|
||||
// TODO verify that this doesn't leak events / memory
|
||||
// TODO is this worth using ?
|
||||
pub(crate) struct EventDiscard(Option<EventListener>);
|
||||
|
||||
|
|
Loading…
Reference in New Issue