Created
July 13, 2015 11:15
-
-
Save freakinruben/c6dd102af2f1cc1a9ce7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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