@nolawnchairs/chromecast
Version:
Chromecast Abstraction
21 lines (20 loc) • 690 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function Bind(target, propertyKey, descriptor) {
if (!descriptor || (typeof descriptor.value !== 'function')) {
throw new TypeError("Only methods can be decorated with @Bind. <" + propertyKey + "> is not a method!");
}
return {
configurable: true,
get: function () {
var bound = descriptor.value.bind(this);
Object.defineProperty(this, propertyKey, {
value: bound,
configurable: true,
writable: true
});
return bound;
}
};
}
exports.default = Bind;