File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
scratch-prg-extensions/extensions/src/arduino_basics Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,14 @@ const details: ExtensionMenuDisplayDetails = {
1313 menuSelectColor : "#62AEB2" ,
1414} ;
1515
16- // Get Arduino board IP or hostname from URL parameter - required
16+ // Get Arduino board IP or hostname from URL parameter
1717const getArduinoBoardHost = ( ) => {
18- if ( typeof window !== "undefined" && window . location ) {
19- const urlParams = new URLSearchParams ( window . location . search ) ;
20- const boardHost = urlParams . get ( "host" ) ;
21- if ( boardHost ) {
22- console . log ( `Connecting to Arduino board: ${ boardHost } ` ) ;
23- return boardHost ;
24- }
25- }
26- throw new Error ( "Arduino board host required. Add ?host=arduino_board_ip_or_name to the URL" ) ;
18+ const urlParams = new URLSearchParams ( window . location . search ) ;
19+ const boardHost = urlParams . get ( "host" ) ;
20+ if ( boardHost ) {
21+ return boardHost
22+ }
23+ return window . location . hostname ;
2724} ;
2825
2926// TODO: make the block to support the brightness `0-7' of the leds
You can’t perform that action at this time.
0 commit comments