Skip to content

Instantly share code, notes, and snippets.

@fponticelli
Created November 18, 2014 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fponticelli/5c575a2c330bd47f0883 to your computer and use it in GitHub Desktop.
Save fponticelli/5c575a2c330bd47f0883 to your computer and use it in GitHub Desktop.
Sui
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