@@ -25,7 +25,7 @@ Puck = {
25
25
26
26
/// Add progress handler so we get nice upload progress shown
27
27
{
28
- let COMMS = ( typeof UART !== undefined ) ?UART :Puck ;
28
+ let COMMS = ( typeof UART != " undefined" ) ?UART :Puck ;
29
29
COMMS . writeProgress = function ( charsSent , charsTotal ) {
30
30
if ( charsSent === undefined || charsTotal < 10 ) {
31
31
Progress . hide ( ) ;
@@ -41,7 +41,7 @@ const Comms = {
41
41
// Low Level Comms
42
42
/// enable debug print statements
43
43
debug : ( ) => {
44
- if ( typeof UART !== undefined )
44
+ if ( typeof UART !== " undefined" )
45
45
UART . debug = 3 ;
46
46
else
47
47
Puck . debug = 3 ;
@@ -55,7 +55,7 @@ const Comms = {
55
55
write : ( data , options ) => {
56
56
if ( data === undefined ) throw new Error ( "Comms.write(undefined) called!" )
57
57
options = options || { } ;
58
- if ( typeof UART !== undefined ) { // New method
58
+ if ( typeof UART !== " undefined" ) { // New method
59
59
return UART . write ( data , undefined , ! ! options . waitNewLine ) ;
60
60
} else { // Old method
61
61
return new Promise ( ( resolve , reject ) =>
@@ -69,7 +69,7 @@ const Comms = {
69
69
/// Evaluate the given expression, return the result as a promise
70
70
eval : ( expr ) => {
71
71
if ( expr === undefined ) throw new Error ( "Comms.eval(undefined) called!" )
72
- if ( typeof UART === undefined ) { // New method
72
+ if ( typeof UART === " undefined" ) { // New method
73
73
return UART . eval ( expr ) ;
74
74
} else { // Old method
75
75
return new Promise ( ( resolve , reject ) =>
@@ -82,15 +82,15 @@ const Comms = {
82
82
} ,
83
83
/// Return true if we're connected, false if not
84
84
isConnected : ( ) => {
85
- if ( typeof UART !== undefined ) { // New method
85
+ if ( typeof UART !== " undefined" ) { // New method
86
86
return UART . isConnected ( ) ;
87
87
} else { // Old method
88
88
return Puck . isConnected ( ) ;
89
89
}
90
90
} ,
91
91
/// Get the currently active connection object
92
92
getConnection : ( ) => {
93
- if ( typeof UART !== undefined ) { // New method
93
+ if ( typeof UART !== " undefined" ) { // New method
94
94
return UART . getConnection ( ) ;
95
95
} else { // Old method
96
96
return Puck . getConnection ( ) ;
@@ -331,8 +331,8 @@ const Comms = {
331
331
console . log ( "<COMMS> watch was in debug mode, interrupting." , result ) ;
332
332
// we got a debug prompt - we interrupted the watch while JS was executing
333
333
// so we're in debug mode, issue another ctrl-c to bump the watch out of it
334
- return Comms . write ( "\x03" ) . then ( checkCtrlC ) ;
335
334
interrupts ++ ;
335
+ return Comms . write ( "\x03" ) . then ( checkCtrlC ) ;
336
336
} else {
337
337
return result ;
338
338
}
@@ -378,7 +378,7 @@ const Comms = {
378
378
return reject ( "No response from device. Is 'Programmable' set to 'Off'?" ) ;
379
379
}
380
380
// now try and parse
381
- let info = { } ;
381
+ let err , info = { } ;
382
382
let appList ;
383
383
try {
384
384
appList = JSON . parse ( appListJSON ) ;
@@ -446,21 +446,21 @@ const Comms = {
446
446
app . files = app . id + ".info" ;
447
447
}
448
448
if ( Const . FILES_IN_FS )
449
- cmds += app . files . split ( ',' ) . filter ( f => f != "" ) . map ( file => `\x10require("fs").unlinkSync(${ toJSString ( file ) } );\n` ) . join ( "" ) ;
449
+ cmds += app . files . split ( ',' ) . filter ( f => f != "" ) . map ( file => `\x10require("fs").unlinkSync(${ Utils . toJSString ( file ) } );\n` ) . join ( "" ) ;
450
450
else
451
- cmds += app . files . split ( ',' ) . filter ( f => f != "" ) . map ( file => `\x10require("Storage").erase(${ toJSString ( file ) } );\n` ) . join ( "" ) ;
451
+ cmds += app . files . split ( ',' ) . filter ( f => f != "" ) . map ( file => `\x10require("Storage").erase(${ Utils . toJSString ( file ) } );\n` ) . join ( "" ) ;
452
452
// remove app Data: (dataFiles and storageFiles)
453
453
const data = AppInfo . parseDataString ( app . data )
454
454
const isGlob = f => / [ ? * ] / . test ( f )
455
455
// regular files, can use wildcards
456
456
cmds += data . dataFiles . map ( file => {
457
- if ( ! isGlob ( file ) ) return `\x10require("Storage").erase(${ toJSString ( file ) } );\n` ;
457
+ if ( ! isGlob ( file ) ) return `\x10require("Storage").erase(${ Utils . toJSString ( file ) } );\n` ;
458
458
const regex = new RegExp ( globToRegex ( file ) )
459
459
return `\x10require("Storage").list(${ regex } ).forEach(f=>require("Storage").erase(f));\n` ;
460
460
} ) . join ( "" ) ;
461
461
// storageFiles, can use wildcards
462
462
cmds += data . storageFiles . map ( file => {
463
- if ( ! isGlob ( file ) ) return `\x10require("Storage").open(${ toJSString ( file ) } ,'r').erase();\n` ;
463
+ if ( ! isGlob ( file ) ) return `\x10require("Storage").open(${ Utils . toJSString ( file ) } ,'r').erase();\n` ;
464
464
// storageFiles have a chunk number appended to their real name
465
465
const regex = globToRegex ( file + '\u0001' )
466
466
// open() doesn't want the chunk number though
0 commit comments