Created
November 18, 2014 15:31
-
-
Save fponticelli/5c575a2c330bd47f0883 to your computer and use it in GitHub Desktop.
Sui
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
import sui.Sui; | |
class DemoObject { | |
public static function main() { | |
var o = new DemoObject(), | |
sui = new Sui(); | |
sui.bind(o.name); | |
sui.bind(o.enabled); | |
sui.bind(o.startedOn); | |
sui.bind(o.traceMe); | |
sui.attach(); | |
} | |
public var name : String; | |
public var startedOn : Date; | |
@:isVar public var enabled(get, set) : Bool; | |
public function new() { | |
this.name = "Sui"; | |
this.startedOn = Date.fromString("2014-11-09"); | |
} | |
public function traceMe() | |
trace(Reflect.fields(this) | |
.map(function(field) return '$field: ${Reflect.field(this, field)}') | |
.join(", ")); | |
function get_enabled() | |
return enabled; | |
function set_enabled(v : Bool) { | |
trace('enabled set to $v'); | |
return enabled = v; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment