-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdialog.js
76 lines (66 loc) · 2.08 KB
/
dialog.js
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
const { demo, group } = require("demokit");
const window = require("demokit/window");
const execute = require("demokit/execute");
const borderless = require("demokit/window/borderless");
module.exports = async function (props)
{
return <demo>
<borderless { ...props }
contentURL = { require.resolve("./dialog.html") } />
<execute window = { props.id } script = { setTheme } />
</demo>
}
function setTheme(resolve, reject)
{
document.body.style.color = "white";
resolve();
}
module.exports.initial = async function ({ id })
{
await execute(
{
window: id,
script: function (resolve, reject)
{
initial().then(resolve).catch(function(e) { alert("WHY"); alert(e); reject() });
}
})
}
module.exports.type = async function ({ id, children:[text], WPM = 300, direction = "right" })
{
await execute(
{
window: id,
args: [{ text, WPM, direction }],
script: function ({ text, WPM, direction }, resolve, reject)
{
type(text, WPM, direction).then(resolve).catch(function(e) { alert("WHY"); alert(e); reject() });
}
})
}
module.exports.showButton = function({ id, which })
{
return <execute window = "dialog" args = { [{ which }] } script= { function({ which }, resolve, reject) { showButton(which).then(resolve).catch(reject) } } />
}
module.exports.moveUp = async function ({ id })
{
return <window.style id = { id } height = { 110 } />;
}
module.exports.moveDown = async function ({ id })
{
return <group>
<execute window = "dialog" script= { function(resolve, reject) { hideButton("right").then(resolve).catch(reject) } } />
<window.style id = { id } height = { 868 } />;
</group>
}
module.exports.deleteToRunKit = async function ({ id })
{
await execute(
{
id: window,
script: function (resolve, reject)
{
deleteToRunKit(350).then(resolve).catch(function(e) { alert("WHY"); alert(e); reject() });
}
})
}