-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathevents.ts
79 lines (61 loc) · 1.89 KB
/
events.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { createWindow, mainloop } from "../mod.ts";
createWindow({
title: "DwmWindow",
width: 800,
height: 600,
resizable: true,
});
addEventListener("close", (event) => {
console.log("Closing window", event.window.title);
});
addEventListener("resize", (event) => {
console.log("Window resized", event.width, event.height);
});
addEventListener("dblclick", (evt) => {
console.log("dblclick", evt.button, evt.clientX, evt.clientY);
});
addEventListener("click", (evt) => {
console.log("click", evt.button, evt.clientX, evt.clientY);
});
addEventListener("mousedown", (evt) => {
console.log("mousedown", evt.button, evt.clientX, evt.clientY);
});
addEventListener("mouseup", (evt) => {
console.log("mouseup", evt.button, evt.clientX, evt.clientY);
});
addEventListener("focus", (evt) => {
console.log("focus", evt.window.title, evt.focused);
});
addEventListener("move", (evt) => {
console.log("move", evt.window.title, evt.x, evt.y);
});
addEventListener("refresh", (evt) => {
console.log("refresh", evt.window.title);
});
addEventListener("framebuffersize", (evt) => {
console.log("framebufersize", evt.window.title, evt.width, evt.height);
});
addEventListener("minimize", (evt) => {
console.log("minimize", evt.window.title, evt.minimized);
});
addEventListener("maximize", (evt) => {
console.log("maximize", evt.window.title, evt.maximized);
});
addEventListener("drop", (evt) => {
console.log("drop", evt.window.title, evt.files);
evt.files.forEach((file) => {
Deno.readTextFile(file).then((text) => {
console.log(file, text);
});
});
});
addEventListener("keydown", (evt) => {
console.log("keydown", evt.window.title, evt.key);
});
addEventListener("keyup", (evt) => {
console.log("keyup", evt.window.title, evt.key);
});
addEventListener("scroll", (evt) => {
console.log("scroll", evt.window.title, evt.scrollX, evt.scrollY);
});
await mainloop();