-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
app.js
30 lines (23 loc) · 894 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
import { dotnet } from '@microsoft/dotnet-runtime'
import _ from 'underscore'
async function dotnetMeaning() {
try {
const { getAssemblyExports } = await dotnet.create();
const exports = await getAssemblyExports("Wasm.Browser.WebPack.Sample");
const meaningFunction = exports.Sample.Test.Main;
return meaningFunction();
} catch (err) {
console.log(err)
throw err;
}
}
export async function main() {
const element = document.getElementById("out");
element.textContent = "loading dotnet...";
const ret = await dotnetMeaning();
const template = _.template('<%=ret%> as computed on dotnet');
element.textContent = template({ ret });
document.body.appendChild(element);
}