mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 01:12:37 +00:00
Theming API: Update themes folder structure and all exports
This commit is contained in:
parent
5403be3a70
commit
e23fd12ff4
27 changed files with 92 additions and 18 deletions
40
components/lib/themes/service/index.js
Normal file
40
components/lib/themes/service/index.js
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue