Skip to content

Commit 5bf9d9e

Browse files
committed
shortcuts
1 parent c1fa063 commit 5bf9d9e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/webc/index.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
data-cargo-features="webc"
1111
/>
1212
<script>
13+
const $ = document.querySelector.bind(document);
14+
const $$ = document.querySelectorAll.bind(document);
15+
1316
function fileLoaded(array) {
1417
const container = document.createElement("preview-area");
1518
let images = window.wasmBindings.previews(array);
1619
images.forEach(function(src) {
1720
container.appendChild(new PreviewItem(src));
1821
});
19-
document.querySelector('preview-wrapper').appendChild(container)
22+
$('preview-wrapper').appendChild(container)
2023
}
2124

2225
document.addEventListener("DOMContentLoaded", () => {
23-
document.getElementById('file-input').addEventListener("file-reader-input:loaded",
26+
$('#file-input').addEventListener("file-reader-input:loaded",
2427
e => fileLoaded(e.detail)
2528
);
2629
});

0 commit comments

Comments
 (0)