File tree Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 3
3
* @param {string | string[] } key string or array of strings
4
4
* @returns {object }
5
5
*/
6
- export function get ( key ) {
6
+ export function get ( key , defaultValue = null ) {
7
7
let result = { } ;
8
8
if ( Array . isArray ( key ) ) {
9
9
key . forEach ( function ( element ) {
@@ -24,6 +24,11 @@ export function get(key) {
24
24
}
25
25
}
26
26
27
+ // if default value is set and key is not found in localStorage, set default value
28
+ if ( ! result [ key ] && defaultValue !== null ) {
29
+ result [ key ] = defaultValue ;
30
+ }
31
+
27
32
return result ;
28
33
}
29
34
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ function cleanupLocalStorage() {
71
71
'selected_board' ,
72
72
'unifiedConfigLast' ,
73
73
'unifiedSourceCache' ,
74
+ 'erase_chip' ,
74
75
] ;
75
76
76
77
for ( const key in localStorage ) {
Original file line number Diff line number Diff line change @@ -574,12 +574,8 @@ firmware_flasher.initialize = function (callback) {
574
574
self . isFlashing = false ;
575
575
}
576
576
577
- let result = getConfig ( 'erase_chip' ) ;
578
- if ( result . erase_chip ) {
579
- $ ( 'input.erase_chip' ) . prop ( 'checked' , true ) ;
580
- } else {
581
- $ ( 'input.erase_chip' ) . prop ( 'checked' , false ) ;
582
- }
577
+ let result = getConfig ( 'erase_chip' , true ) ;
578
+ $ ( 'input.erase_chip' ) . prop ( 'checked' , result . erase_chip ) ;
583
579
584
580
$ ( 'input.erase_chip' ) . change ( function ( ) {
585
581
setConfig ( { 'erase_chip' : $ ( this ) . is ( ':checked' ) } ) ;
Original file line number Diff line number Diff line change 99
99
< td >
100
100
</ td >
101
101
</ tr >
102
- < tr class ="expertOptions option manual_baud_rate noboarder ">
102
+ < tr class ="expertOptions option manual_baud_rate noborder ">
103
103
< td >
104
104
< label >
105
105
< input class ="flash_manual_baud toggle " type ="checkbox " />
Original file line number Diff line number Diff line change 175
175
< td i18n ="initialSetupDrawing "> </ td >
176
176
< td class ="bat-mah-drawing "> 0.00 A</ td >
177
177
</ tr >
178
- < tr class ="noboarder ">
178
+ < tr class ="noborder ">
179
179
< td i18n ="initialSetupRSSI "> </ td >
180
180
< td class ="rssi "> 0 %</ td >
181
181
</ tr >
You can’t perform that action at this time.
0 commit comments