Skip to content

Instantly share code, notes, and snippets.

@freakinruben
Created July 13, 2015 11:15
Show Gist options
  • Save freakinruben/c6dd102af2f1cc1a9ce7 to your computer and use it in GitHub Desktop.
Save freakinruben/c6dd102af2f1cc1a9ce7 to your computer and use it in GitHub Desktop.
package;
import js.Browser;
import mithril.M;
class App implements Component {
public static function main () {
M.mount(Browser.document.body, new App());
}
public function new () { trace("TestApp.constructor"); }
public function controller () { trace("TestApp.controller", this); }
public function view ():ViewOutput {
var tests = [];
for (i in 0...5) {
tests.push(new TestComponent());
}
return m(".app", tests);
}
}
class TestComponent implements Component {
private static var nr = 0;
@prop private var testVar : String;
public function new () { testVar("test"+(nr++)); }
public function controller () { trace("TestComponent.controller", this, this.testVar()); }
public function view ():ViewOutput {
trace("TestComponent.view", this, this.testVar());
m("p", testVar());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment