Skip to content

Commit

Permalink
Led: consolidate Object.defineProperties(this, ..) mode def.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed May 12, 2015
1 parent e8b83f4 commit 4b6e807
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions lib/led/led.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ var Controllers = {
this.pin = typeof opts.pin === "undefined" ? 0 : opts.pin;

state.mode = this.io.MODES.PWM;

Object.defineProperties(this, {
mode: {
get: function() {
return state.mode;
}
}
});
}
},
write: {
Expand Down Expand Up @@ -102,14 +94,6 @@ var Controllers = {
}

this.io.pinMode(this.pin, state.mode);

Object.defineProperties(this, {
mode: {
get: function() {
return state.mode;
}
}
});
}
},
write: {
Expand Down Expand Up @@ -202,6 +186,11 @@ function Led(opts) {
return state.value;
}
},
mode: {
get: function() {
return state.mode;
}
},
isOn: {
get: function() {
return !!state.value;
Expand Down

0 comments on commit 4b6e807

Please sign in to comment.