Skip to content

Instantly share code, notes, and snippets.

@dpeek
Created May 24, 2012 03:03
Show Gist options
  • Save dpeek/2779204 to your computer and use it in GitHub Desktop.
Save dpeek/2779204 to your computer and use it in GitHub Desktop.
Entities
// declaration
class TestEntity extends Entity
{
@:attr var attribute:Int = 0;
}
// haxe
test1.attribute = 10;
test1.attribute.bind(test2.attribute);
// js inline
test1.set(0,test1.attribute,test1.attribute = 10);
test1._listen(0,function(v) {
test2.set(0,test2.attribute,test2.attribute = test1.attribute);
});
// js normal
test1.set_attribute(10);
test1._listen(0,function(v) {
test2.set_attribute(test1.attribute);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment