From 406a08c9ccd8b9085194dea65bed056131d94741 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 9 Mar 2018 16:44:10 -0800 Subject: [PATCH] Refactor the JS wasm loader --- Ooui.Wasm/README.md | 2 +- Ooui.Wasm/ooui-sample.cs | 15 +++-- Ooui.Wasm/ooui-sample.html | 135 +++++++++++++++++++++---------------- 3 files changed, 87 insertions(+), 65 deletions(-) diff --git a/Ooui.Wasm/README.md b/Ooui.Wasm/README.md index f2518cf..d9af42a 100644 --- a/Ooui.Wasm/README.md +++ b/Ooui.Wasm/README.md @@ -13,7 +13,7 @@ Expand that into this directory. ## Build ```bash -csc /nostdlib /target:library /r:managed/mscorlib.dll /r:managed/Ooui.dll /out:managed/Ooui.Sample.dll ooui-sample.cs +csc /nostdlib /target:library /r:managed/mscorlib.dll /r:managed/System.Runtime.dll /r:managed/Ooui.dll /out:managed/Ooui.Sample.dll ooui-sample.cs ``` diff --git a/Ooui.Wasm/ooui-sample.cs b/Ooui.Wasm/ooui-sample.cs index a080e86..d53d6ad 100644 --- a/Ooui.Wasm/ooui-sample.cs +++ b/Ooui.Wasm/ooui-sample.cs @@ -1,12 +1,17 @@ using System; using Ooui; -public class Math { - public static string Add (string a, string b) { +public class Program +{ + public static string Main (string a0, string a1) + { try { - Console.WriteLine ("ENTER"); - var e = new Div (); - return e.Id; + var l = new Label { Text = "Hello" }; + var b = new Button ("Click Me"); + var e = new Div (new Div (l), b); + + UI.SetGlobalElement ("main", e); + return e.ToString (); } catch (Exception e) { Console.WriteLine (e); diff --git a/Ooui.Wasm/ooui-sample.html b/Ooui.Wasm/ooui-sample.html index 9062d34..3588989 100644 --- a/Ooui.Wasm/ooui-sample.html +++ b/Ooui.Wasm/ooui-sample.html @@ -1,14 +1,16 @@ - - - - - - C# output: -
- -
- -
+ + + + Ooui Wasm + + + + + +
+

  Loading...

+ +
- - - \ No newline at end of file + + + +