-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (44 loc) · 1.24 KB
/
index.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
import { Dir, readTextFile } from "tauri/api/fs";
import { Elm } from "./src/Main.elm";
import "./scss/style.scss";
const baseDirOpt = process.env.NODE_ENV === "production" ? { dir: Dir.Resource } : {}
Promise.all([
readTextFile(`static/config.json`, baseDirOpt),
readTextFile(`static/exercises.json`, baseDirOpt)
]).then(([config, exercises]) => {
// For testing without Tauri
// const config = JSON.stringify({
// "workInterval": 150,
// "shortInterval": 30,
// "longInterval": 60,
// "longBreakAfterCount": 4,
// "fitnessLevel": "intermediate"
// })
// const exercises = JSON.stringify([{
// "name": "Push-ups",
// "variations": [
// {
// "level": "beginner",
// "reps": 15,
// "directions": ["against the wall"]
// },
// {
// "level": "intermediate",
// "reps": 15,
// "directions": ["on the floor"]
// },
// {
// "level": "advanced",
// "reps": 25,
// "directions": ["on the floor"]
// }
// ]
// }])
const flags = { config: JSON.parse(config), exercises: JSON.parse(exercises) };
const app = Elm.Main.init({ flags });
})
if (module.hot) {
module.hot.dispose(() => {
window.location.reload();
});
}