Skip to content

Commit 42022cc

Browse files
save file
1 parent 3a7b6b7 commit 42022cc

File tree

1 file changed

+51
-53
lines changed

1 file changed

+51
-53
lines changed

code-dev/25-10-21/override-createserver/override-createserver.html

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,48 @@
66
<h3>
77
override createServer
88
</h3>
9-
9+
1010
<base href='https://ext-code.com/code-dev/25-10-21/override-createserver/'>
11-
11+
1212
<script src='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js'></script>
13-
14-
15-
<script src='https://libs.ext-code.com/js/dom/component/component.js'></script>
16-
17-
<script src='https://libs.ext-code.com/js/dom/init-hdr/init-hdr.js'></script>
13+
14+
15+
<script src='https://libs.ext-code.com/js/dom/component/v3.0/component.js?hdr'></script>
1816

1917
<style>
2018

2119
html {font-family:arial;height:5700px}
2220
body {margin:20px;padding-bottom:200px}
2321

2422
#root {display:flex;flex-direction:column;gap:20px;height:100%}
25-
23+
2624
input {font-size:16px;padding:5px 10px;box-sizing:border-box}
2725
input[typebutton] {cursor:pointer}
28-
26+
2927
#test::part(root) {height:500px}
3028
/*
3129
#setup::part(root) {height:1000px}
3230
#patch::part(root) {height:1500px}
3331
*/
34-
32+
3533
.filename {background:lightgray;padding:5px 10px}
36-
34+
3735
.file
3836
{border:1px solid black;padding:10px;border-radius:10px}
39-
37+
4038
</style>
4139

42-
40+
4341
<div class=file>
4442

4543
<div class=filename>
4644
server.js
4745
</div>
48-
46+
4947
<snippet-terminal-console id=server type=nodejs src='ex/server.js' component v2.0></snippet-terminal-console>
5048

5149
</div>
52-
50+
5351

5452
<div class=file>
5553
<div class=filename>
@@ -58,19 +56,19 @@ <h3>
5856

5957
<web-editor id=test src='ex/test.js' component v2.0></web-editor>
6058
</div>
61-
59+
6260

6361
<div id=btns>
6462
<input value=run type=button>
6563
</div>
66-
67-
64+
65+
6866

6967
<iframe id=iframe></iframe>
7068

7169
<web-console h=150 component></web-console>
72-
73-
70+
71+
7472
<div class=file>
7573

7674
<div class=filename>
@@ -80,11 +78,11 @@ <h3>
8078
<web-editor id=setup mode=html fullsize src='ex/setup.html' component></web-editor>
8179

8280
</div>
83-
81+
8482

8583
<div class=file>
8684

87-
<div class=filename>
85+
<div class=filename>
8886
patch.js
8987
</div>
9088

@@ -95,12 +93,12 @@ <h3>
9593

9694

9795
<log-mod component></log-mod>
98-
99-
96+
97+
10098
<script>
10199

102100
(()=>{
103-
101+
104102
var webcontainer;
105103

106104
var console;
@@ -117,50 +115,50 @@ <h3>
117115
var btn = {};
118116
var on = {};
119117

120-
118+
121119
window.start = async function(){
122-
120+
123121
con = mod['web-console'];
124122
console = con;
125123

126124
server = mod.server;
127125
console.log(server);
128-
126+
129127
test = mod.test;
130128

131129
setup = mod.setup;
132130
patch = mod.patch;
133131

134132
log = mod['log-mod'];
135-
136-
server.on = on;
133+
134+
server.on = on;
137135
server.btn.run = run;
138136

139137
$('[value=run]').onclick = btn.run;
140-
138+
141139
}//start
142-
143-
140+
141+
144142
//:
145143

146-
144+
147145
window.onmessage = e=>{
148-
146+
149147
var json = e.data;
150148
switch(json.type){
151-
149+
152150
case 'log' : console.log.apply(null,json.args); break;
153151

154152
}//switch
155153

156154
}//onmessage
157-
158-
155+
156+
159157
//:
160158

161159

162160
btn.run = function(){
163-
161+
164162
console.log('btn.run');
165163
if(!webcontainer){
166164
log.red('web container instance unavailable');
@@ -172,10 +170,10 @@ <h3>
172170
console.log('write');
173171
iframe.contentWindow.postMessage({type:'run',js},'*');
174172
console.log('load');
175-
173+
176174
}//run
177175

178-
176+
179177
//:
180178

181179

@@ -185,12 +183,12 @@ <h3>
185183
var pre = patch.getvalue();
186184
js = pre+js;
187185
server.run.nodejs({js});
188-
186+
189187
}//run
190188

191189

192190
on.init = async function({webcontainer:wc}){
193-
191+
194192
webcontainer = wc;
195193
console.log('init',webcontainer);
196194
//console.log(srcdoc);
@@ -201,9 +199,9 @@ <h3>
201199
console.log('init complete');
202200

203201
}//init
204-
202+
205203
on.run = function({process}){
206-
204+
207205
console.log('on.run',process);
208206

209207
}//on.run
@@ -219,31 +217,31 @@ <h3>
219217

220218

221219
on.complete = function({code}){
222-
220+
223221
console.log('complete',code);
224222

225223
}//complete
226-
227-
224+
225+
228226
//:
229227

230228

231229
function fnstr(fn){
232-
230+
233231
var s = fn.toString();
234232
var i1 = s.indexOf('{');
235233
var i2 = s.lastIndexOf('}');
236234
var str = s.slice(i1+1,i2);
237235
return str;
238236

239237
}//fnstr
240-
241-
238+
239+
242240
})();
243241

244-
245-
</script>
246242

243+
</script>
244+
247245
</div root>
248246

249247

0 commit comments

Comments
 (0)