Skip to content

Commit b1deede

Browse files
committed
fixup! feat: remove deprecated JS platform
1 parent 9bffaf6 commit b1deede

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/js-executor/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default class JsExecutor {
4646
compilerVersion,
4747
) {
4848
if (platform === TargetPlatforms.SWIFT_EXPORT) {
49-
return `<span class="standard-output ${theme}"><div class="result-code">${jsCode}</span>`;
49+
return `<span class='standard-output ${theme}'><div class='result-code'>${jsCode}</span>`;
5050
}
5151
if (platform === TargetPlatforms.CANVAS) {
5252
this.iframe.style.display = 'block';
@@ -119,14 +119,14 @@ export default class JsExecutor {
119119
try {
120120
const output = this.iframe.contentWindow.eval(jsCode);
121121
return output
122-
? `<span class="standard-output ${theme}">${processingHtmlBrackets(
122+
? `<span class='standard-output ${theme}'>${processingHtmlBrackets(
123123
output,
124124
)}</span>`
125125
: '';
126126
} catch (e) {
127127
if (onError) onError();
128128
let exceptionOutput = showJsException(e);
129-
return `<span class="error-output">${exceptionOutput}</span>`;
129+
return `<span class='error-output'>${exceptionOutput}</span>`;
130130
}
131131
}
132132
await this.timeout(400);
@@ -160,14 +160,14 @@ export default class JsExecutor {
160160
const outputString = bufferedOutput.buffer;
161161
bufferedOutput.buffer = '';
162162
return outputString
163-
? `<span class="standard-output ${theme}">${processingHtmlBrackets(
163+
? `<span class='standard-output ${theme}'>${processingHtmlBrackets(
164164
outputString,
165165
)}</span>`
166166
: '';
167167
} catch (e) {
168168
if (onError) onError();
169169
let exceptionOutput = showJsException(e);
170-
return `<span class="error-output">${exceptionOutput}</span>`;
170+
return `<span class='error-output'>${exceptionOutput}</span>`;
171171
}
172172
}
173173

@@ -240,7 +240,7 @@ export default class JsExecutor {
240240
// necessary to load stdlib.wasm before its initialization to parallelize
241241
// language=JavaScript
242242
(
243-
`const stdlibWasm = fetch('${API_URLS.STDLIB_WASM(stdlibVersion)}');\n` +
243+
`const stdlibWasm = fetch('${API_URLS.STDLIB_WASM(stdlibVersion)}'); ` +
244244
script
245245
)
246246
.replace(
@@ -251,6 +251,9 @@ export default class JsExecutor {
251251
'(extends) => { return { extends }; }',
252252
'(extends_) => { return { extends_ }; }',
253253
),
254+
)
255+
.then((stdlibCode) =>
256+
executeWasmCodeWithSkiko(this.iframe.contentWindow, stdlibCode),
254257
);
255258

256259
return Promise.all([skikoExports, stdlibExports]);
@@ -273,7 +276,7 @@ export default class JsExecutor {
273276
});
274277

275278
this.iframe.height = '1000';
276-
iframeDoc.write(`<canvas height="1000" id="ComposeTarget"></canvas>`);
279+
iframeDoc.write(`<canvas height='1000' id='ComposeTarget'></canvas>`);
277280
}
278281
iframeDoc.write('<body style="margin: 0; overflow: hidden;"></body>');
279282
iframeDoc.close();

0 commit comments

Comments
 (0)