-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwasm.js
More file actions
executable file
·38 lines (30 loc) · 841 Bytes
/
Copy pathwasm.js
File metadata and controls
executable file
·38 lines (30 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import init, { search } from "./pkg/ciel_core2.js";
async function main() {
await init();
const dep = document.getElementById("dep");
const arr = document.getElementById("arr");
const enter = document.getElementById("enter");
const result = document.getElementById("result");
if (!dep || !arr || !result) {
console.error("e00001: HTMLのIDが見つかりません");
return;
}
const Wasm = () => {
const resultText = search(dep.value, arr.value);
result.innerHTML = resultText;
};
if (enter) {
enter.addEventListener("click", () => {
Wasm();
});
}
const ClickEnter = (event) => {
if (event.key === "Enter") {
event.preventDefault();
enter.click();
}
};
dep.addEventListener("keydown", ClickEnter);
arr.addEventListener("keydown", ClickEnter);
}
main();