@@ -17,6 +17,7 @@ import { style, stopStyle } from "./style.js"
17
17
import { format } from "path" ;
18
18
19
19
//grab screen elements
20
+ const background = document . getElementById ( "background" ) ;
20
21
const time = document . getElementById ( "time" ) ;
21
22
const progressArc = document . getElementById ( "progressArc" ) ;
22
23
const countdownText = document . getElementById ( "countdown" ) ;
@@ -57,6 +58,11 @@ clock.ontick = (evt) => {
57
58
}
58
59
59
60
setupWithUserSettings ( ) ;
61
+ try {
62
+ let s = fs . readFileSync ( "styleSettings.txt" , "cbor" ) ;
63
+ background . value = s . value ;
64
+ }
65
+ catch ( err ) { }
60
66
style ( ) ;
61
67
progress ( ) ;
62
68
@@ -81,6 +87,7 @@ messaging.peerSocket.onmessage = (evt)=>{
81
87
me . onunload = ( ) => {
82
88
//save data on exit
83
89
saveStateToFile ( ) ;
90
+ writeToFile ( { value : background . value } , "styleSettings.txt" ) ;
84
91
}
85
92
86
93
function saveStateToFile ( ) {
@@ -213,8 +220,7 @@ function setupWithUserSettings(){
213
220
settings = fs . readFileSync ( "flowSettings.txt" , "cbor" ) ;
214
221
}
215
222
catch ( err ) {
216
- settings = { flowTime : 0 , shortBreakTime : 0 , longBreakTime : 0 }
217
- //writeToFile({flowTime: 0, shortBreakTime: 0, longBreakTime: 0}, "flowSettings.txt");
223
+ settings = { flowTime : 0 , shortBreakTime : 0 , longBreakTime : 0 } ;
218
224
}
219
225
//setup consts based on user settings
220
226
totalFlowInSeconds = settings . flowTime == 0 ? totalFlowInSeconds : parseInt ( settings . flowTime ) * 60 ;
0 commit comments