@@ -25,7 +25,7 @@ Puck = {
2525
2626/// Add progress handler so we get nice upload progress shown
2727{
28- let COMMS = ( typeof UART !== undefined ) ?UART :Puck ;
28+ let COMMS = ( typeof UART != " undefined" ) ?UART :Puck ;
2929 COMMS . writeProgress = function ( charsSent , charsTotal ) {
3030 if ( charsSent === undefined || charsTotal < 10 ) {
3131 Progress . hide ( ) ;
@@ -41,7 +41,7 @@ const Comms = {
4141// Low Level Comms
4242 /// enable debug print statements
4343 debug : ( ) => {
44- if ( typeof UART !== undefined )
44+ if ( typeof UART !== " undefined" )
4545 UART . debug = 3 ;
4646 else
4747 Puck . debug = 3 ;
@@ -55,7 +55,7 @@ const Comms = {
5555 write : ( data , options ) => {
5656 if ( data === undefined ) throw new Error ( "Comms.write(undefined) called!" )
5757 options = options || { } ;
58- if ( typeof UART !== undefined ) { // New method
58+ if ( typeof UART !== " undefined" ) { // New method
5959 return UART . write ( data , undefined , ! ! options . waitNewLine ) ;
6060 } else { // Old method
6161 return new Promise ( ( resolve , reject ) =>
@@ -69,7 +69,7 @@ const Comms = {
6969 /// Evaluate the given expression, return the result as a promise
7070 eval : ( expr ) => {
7171 if ( expr === undefined ) throw new Error ( "Comms.eval(undefined) called!" )
72- if ( typeof UART === undefined ) { // New method
72+ if ( typeof UART === " undefined" ) { // New method
7373 return UART . eval ( expr ) ;
7474 } else { // Old method
7575 return new Promise ( ( resolve , reject ) =>
@@ -82,15 +82,15 @@ const Comms = {
8282 } ,
8383 /// Return true if we're connected, false if not
8484 isConnected : ( ) => {
85- if ( typeof UART !== undefined ) { // New method
85+ if ( typeof UART !== " undefined" ) { // New method
8686 return UART . isConnected ( ) ;
8787 } else { // Old method
8888 return Puck . isConnected ( ) ;
8989 }
9090 } ,
9191 /// Get the currently active connection object
9292 getConnection : ( ) => {
93- if ( typeof UART !== undefined ) { // New method
93+ if ( typeof UART !== " undefined" ) { // New method
9494 return UART . getConnection ( ) ;
9595 } else { // Old method
9696 return Puck . getConnection ( ) ;
@@ -331,8 +331,8 @@ const Comms = {
331331 console . log ( "<COMMS> watch was in debug mode, interrupting." , result ) ;
332332 // we got a debug prompt - we interrupted the watch while JS was executing
333333 // so we're in debug mode, issue another ctrl-c to bump the watch out of it
334- return Comms . write ( "\x03" ) . then ( checkCtrlC ) ;
335334 interrupts ++ ;
335+ return Comms . write ( "\x03" ) . then ( checkCtrlC ) ;
336336 } else {
337337 return result ;
338338 }
@@ -378,7 +378,7 @@ const Comms = {
378378 return reject ( "No response from device. Is 'Programmable' set to 'Off'?" ) ;
379379 }
380380 // now try and parse
381- let info = { } ;
381+ let err , info = { } ;
382382 let appList ;
383383 try {
384384 appList = JSON . parse ( appListJSON ) ;
@@ -446,21 +446,21 @@ const Comms = {
446446 app . files = app . id + ".info" ;
447447 }
448448 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 ( "" ) ;
450450 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 ( "" ) ;
452452 // remove app Data: (dataFiles and storageFiles)
453453 const data = AppInfo . parseDataString ( app . data )
454454 const isGlob = f => / [ ? * ] / . test ( f )
455455 // regular files, can use wildcards
456456 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` ;
458458 const regex = new RegExp ( globToRegex ( file ) )
459459 return `\x10require("Storage").list(${ regex } ).forEach(f=>require("Storage").erase(f));\n` ;
460460 } ) . join ( "" ) ;
461461 // storageFiles, can use wildcards
462462 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` ;
464464 // storageFiles have a chunk number appended to their real name
465465 const regex = globToRegex ( file + '\u0001' )
466466 // open() doesn't want the chunk number though
0 commit comments