Skip to content

Commit b2c01df

Browse files
committed
Merge pull request #121 from stephaneAG/patch-2
Added "espruino.com/webide?codefile=.." support
2 parents fd9fe18 + 6b01cd5 commit b2c01df

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

js/plugins/urlHandler.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
function handleQuery(key, val) {
2020
Espruino.Core.Code.switchToCode(); // if in blockly
2121
switch(key){
22-
case "code":
22+
case "code": // Tef edit: when passing "encodedURIcomponent code" within the URL
2323
Espruino.Core.EditorJavaScript.setCode(val);
2424
break;
25+
case "codefile": // Tef edit: ADDITION: when passing a file URL within the URL :)
26+
$.ajax({ url: val, cache: false }).done(function( data ) {
27+
Espruino.Core.EditorJavaScript.setCode(data);
28+
});
29+
break;
2530
case "upload":
2631
Espruino.Core.MenuPortSelector.ensureConnected(function() {
2732
Espruino.Core.Terminal.focus(); // give the terminal focus
@@ -69,4 +74,4 @@
6974

7075
handle : handle, // handle a URL
7176
};
72-
}());
77+
}());

0 commit comments

Comments
 (0)