real reactive ui
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import lib.ui.Observable;
|
||||
import lib.ui.TextElement;
|
||||
import lib.ui.ReactiveUI;
|
||||
import kernel.Log;
|
||||
@@ -36,13 +37,20 @@ class Startup {
|
||||
|
||||
static function exampleUI() {
|
||||
var context = WindowManager.instance.createNewContext();
|
||||
var ui = new ReactiveUI(context);
|
||||
|
||||
ui.render([
|
||||
new TextElement("Hello world"),
|
||||
new TextElement("Hello world",Green,Red),
|
||||
var text = new Observable("Hello world");
|
||||
|
||||
var ui = new ReactiveUI(context,[
|
||||
new TextElement(text),
|
||||
new TextElement(text,Green,Red),
|
||||
]);
|
||||
|
||||
ui.render();
|
||||
|
||||
context.clickSignal.on(data -> {
|
||||
text.set("Holla mundo");
|
||||
});
|
||||
|
||||
WindowManager.instance.focusContextToOutput(context,"main");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user