Files
node-metaverse/dist/classes/PacketEventEmitter.js

23 lines
711 B
JavaScript
Raw Normal View History

2017-12-13 15:23:50 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const typed_event_emitter_1 = require("typed-event-emitter");
class PacketEventEmitter extends typed_event_emitter_1.EventEmitter {
constructor(value) {
super();
this.onValueChanged = this.registerEvent();
this._value = value;
}
get value() {
return this._value;
}
set value(value) {
this._value = value;
this.emit(this.onValueChanged, this._value);
}
}
let instance = new MyClass();
instance.onValueChanged(newValue => {
console.log(`Value changed: ${newValue}`);
});
instance.value = 27;
//# sourceMappingURL=PacketEventEmitter.js.map