Migrate to mithril.js

This commit is contained in:
2023-02-18 09:22:43 +03:00
parent 024d7fb10d
commit bdc8f8496f
79 changed files with 1697 additions and 149 deletions

View File

@@ -0,0 +1,22 @@
function EventBus() {
let listeners = {};
return {
on: function(event, callback) {
console.log('on');
if (!(event in listeners)) {
listeners[event] = [];
}
listeners[event].push(callback)
},
off: function(event, id) {
console.log('off');
},
emit: function(event, arguments) {
console.log('emit');
listeners[event].forEach(element => {
console.log(element);
let result = element(arguments);
});
}
};
};