export default class EventSystem {
	constructor() {
		this.listeners = { test: () => console.log('This is default listener!')};
		
		// helper renames
		this.addEventListener = this.on;
		this.removeEventListener = this.off;
	}

	on(eventId, fn) {
		this.listeners[eventId] = fn;
		return this;
	}

	off(eventId) {
		delete this.listeners[eventId];
		return this;
	}

	emit(eventId, data) {
		return this.listeners[eventId](data); // return result
	}
}