Skip to content

Instantly share code, notes, and snippets.

@romero126
Created September 27, 2018 04:32
Show Gist options
  • Save romero126/3d91e3de899abb53409094c9e9d453e0 to your computer and use it in GitHub Desktop.
Save romero126/3d91e3de899abb53409094c9e9d453e0 to your computer and use it in GitHub Desktop.
class foo {
private _bar:boolean = false;
get bar():boolean {
return this._bar;
}
set bar(theBar:boolean) {
this._bar = theBar;
}
}
var myFoo = new foo();
if(myFoo.bar) { // calls the getter
myFoo.bar = false; // calls the setter and passes false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment