Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"generatorVersions": "[1.0.0.0-*)",
"identity": "WebAssembly.Browser",
"name": "WebAssembly Browser App",
"description": "A project template for creating a .NET app that runs on WebAssembly in the browser",
"shortName": "wasmbrowser",
"sourceName": "browser.0",
"preferNameDirectory": true,
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/templates/templates/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

import { dotnet } from './dotnet.js'

const is_browser = typeof window != "undefined";
if (!is_browser) throw new Error(`Expected to be running in a browser`);
const is_browser = typeof window != 'undefined';
if (!is_browser) throw new Error('Expected to be running in a browser');

const { setModuleImports, getAssemblyExports, getConfig, runMainAndExit } = await dotnet
.withDiagnosticTracing(false)
.withApplicationArgumentsFromQuery()
.create();

setModuleImports("main.js", {
setModuleImports('main.js', {
window: {
location: {
href: () => globalThis.window.location.href
Expand All @@ -24,5 +24,5 @@ const exports = await getAssemblyExports(config.mainAssemblyName);
const text = exports.MyClass.Greeting();
console.log(text);

document.getElementById("out").innerHTML = `${text}`;
await runMainAndExit(config.mainAssemblyName, ["dotnet", "is", "great!"]);
document.getElementById('out').innerHTML = text;
await runMainAndExit(config.mainAssemblyName, ['dotnet', 'is', 'great!']);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"classifications": [ "Web", "WebAssembly", "Console" ],
"identity": "WebAssembly.Console",
"name": "WebAssembly Console App",
"description": "A project template for creating a .NET app that runs on WebAssembly on Node JS or V8",
"shortName": "wasmconsole",
"sourceName": "console.0",
"preferNameDirectory": true,
Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasm/templates/templates/console/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { setModuleImports, getAssemblyExports, getConfig, runMainAndExit } = awai
.withDiagnosticTracing(false)
.create();

setModuleImports("main.mjs", {
setModuleImports('main.mjs', {
node: {
process: {
version: () => globalThis.process.version
Expand All @@ -23,4 +23,4 @@ const exports = await getAssemblyExports(config.mainAssemblyName);
const text = exports.MyClass.Greeting();
console.log(text);

await runMainAndExit(config.mainAssemblyName, ["dotnet", "is", "great!"]);
await runMainAndExit(config.mainAssemblyName, ['dotnet', 'is', 'great!']);