Skip to content

Commit 5996858

Browse files
save file
1 parent bc021a3 commit 5996858

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

  • utils/misc/nodejs-terminal/html/webcontainer-fs/examples
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
2+
3+
4+
<html>
5+
6+
<head>
7+
8+
<base href='https://ext-code.com/utils/misc/nodejs-terminal/nodejs-terminal.html'>
9+
10+
<script src='https://libs.ext-code.com/js/dom/component/v3.0/component.js?hdr'></script>
11+
12+
13+
<script init>
14+
console.log('webcontainer-fs test');
15+
console.log();
16+
17+
var wcfs;
18+
19+
20+
//:
21+
22+
23+
async function init(){
24+
console.log('init');
25+
debugger;
26+
wcfs = mod['webcontainer-fs'];
27+
//fileserver.load.complete = complete.load;
28+
//fileserver.save.complete = complete.save;
29+
wcfs.initmod({source});
30+
31+
await mod.auto();
32+
33+
initdom();
34+
35+
}//init
36+
37+
38+
</script>
39+
40+
<style>
41+
42+
html
43+
{font-family:arial;height:650px}
44+
45+
.icon
46+
{border:1px solid gray;border-radius:3px;box-sizing:border-box;width:32px;height:32px;cursor:pointer}
47+
48+
</style>
49+
50+
51+
</head>
52+
53+
54+
<body>
55+
56+
<webcontainer-fs component=page></webcontainer-fs>
57+
58+
</body>
59+
60+
61+
62+
<script>
63+
64+
65+
//:
66+
67+
68+
function initdom(){
69+
}//initdom
70+
71+
72+
//:
73+
74+
75+
function source(){
76+
77+
var txt = 'helloworld';
78+
var blob = new Blob([txt]);
79+
return blob;
80+
81+
}//source
82+
83+
84+
function complete(){
85+
}//complete
86+
87+
88+
complete.load = function(file,blob){
89+
console.log(file,blob);
90+
}//load
91+
92+
93+
complete.save = function(file,confirm=true){
94+
console.log(file);
95+
}//save
96+
97+
98+
</script>
99+
100+
</html>

0 commit comments

Comments
 (0)