Theming API: Update themes folder structure and all exports

This commit is contained in:
mertsincan 2024-03-27 13:12:22 +00:00
parent 5403be3a70
commit e23fd12ff4
27 changed files with 92 additions and 18 deletions

View file

@ -0,0 +1,40 @@
function createService() {
const allHandlers = new Map();
return {
on(type, handler) {
let handlers = allHandlers.get(type);
if (!handlers) handlers = [handler];
else handlers.push(handler);
allHandlers.set(type, handlers);
return this;
},
off(type, handler) {
let handlers = allHandlers.get(type);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
return this;
},
emit(type, evt) {
let handlers = allHandlers.get(type);
if (handlers) {
handlers.slice().map((handler) => {
handler(evt);
});
}
}
};
}
const ThemeService = createService();
export default ThemeService;