Skip to content

Commit 1efafeb

Browse files
save file
1 parent 6f84c93 commit 1efafeb

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

blog/25-07-31/xml-http-request/xml-http-request.html

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,21 @@
7878
var terminal;
7979
var webconsole;
8080

81+
82+
var files = {};
83+
files['node_modules'] = {directory: {}};
84+
files['.jshrc'] = {file:{contents:`
85+
export NODE_PATH=./node_modules
86+
`}};
87+
8188

8289
//:
8390

8491

8592
async function init(){
8693
//debug('init',version);
8794

95+
8896
menu = menumod();
8997

9098

@@ -137,8 +145,14 @@
137145
);
138146
[$,datatype,menumod,keydown,debug] = await promise;
139147

140-
141-
[sandbox] = await ext.load.libs('js/sandbox/sandbox.js.api');
148+
await Promise.all([
149+
ext.load.libs('js/sandbox/sandbox.js.api').then(result=>[sandbox]=result),
150+
ext.text.libs('nodejs/server-cert/server-cert.js').then(result=>{
151+
152+
files['node_modules']['server-cert.js'] = {file:{contents:result[0]}};
153+
154+
})
155+
]);
142156

143157

144158
mod.stack.complete;
@@ -309,15 +323,20 @@ <h1 class=title>
309323
btn['upload-server'].run = async function(){
310324

311325
if(process['upload-server']){
326+
webconsole.log('kill existing process ...');
312327
await process['upload-server'].kill();
313-
}
328+
webconsole.log('ok');
329+
}
314330

315331

316332
var on = {};
317333

318334
on.init = function({webcontainer}){
319335

320336
wc['upload-server'] = webcontainer;
337+
webconsole.log('mount file system ...');
338+
webcontainer.mount(files);
339+
webconsole.log('ok');
321340

322341
}//init
323342

0 commit comments

Comments
 (0)