-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathProgram.cs
33 lines (28 loc) · 897 Bytes
/
Program.cs
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
31
32
33
using System;
using System.Runtime.InteropServices.JavaScript;
using System.Threading.Tasks;
namespace TodoMVC
{
public partial class MainJS
{
static Controller? controller;
public static async Task Main()
{
if (!OperatingSystem.IsBrowser())
{
throw new PlatformNotSupportedException("This demo is expected to run on browser platform");
}
await JSHost.ImportAsync("todoMVC/store.js", "./store.js");
await JSHost.ImportAsync("todoMVC/view.js", "./view.js");
var store = new Store();
var view = new View(new Template());
controller = new Controller(store, view);
Console.WriteLine("Ready!");
}
[JSExport]
public static void OnHashchange(string url)
{
controller?.SetView(url);
}
}
}