check parent builder object for enabled status

This commit is contained in:
Josh Junon 2017-01-29 23:42:35 -08:00
parent 5a69476142
commit fb65f895c3
2 changed files with 35 additions and 1 deletions

View file

@ -36,8 +36,20 @@ function build(_styles) {
return applyStyle.apply(builder, arguments);
};
var self = this;
builder._styles = _styles;
builder.enabled = this.enabled;
Object.defineProperty(builder, 'enabled', {
enumerable: true,
get: function () {
return self.enabled;
},
set: function (v) {
self.enabled = v;
}
});
// __proto__ is used because we must return a function, but there is
// no way to create a function with a different prototype.
/* eslint-disable no-proto */