mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #3802 - Improve folder structure for nuxt configurations
This commit is contained in:
parent
851950270b
commit
f5fe822afb
563 changed files with 1703 additions and 1095 deletions
32
components/lib/utils/EventBus.js
Normal file
32
components/lib/utils/EventBus.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
export default function primebus() {
|
||||
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);
|
||||
},
|
||||
|
||||
off(type, handler) {
|
||||
let handlers = allHandlers.get(type);
|
||||
|
||||
if (handlers) {
|
||||
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
|
||||
}
|
||||
},
|
||||
|
||||
emit(type, evt) {
|
||||
let handlers = allHandlers.get(type);
|
||||
|
||||
if (handlers) {
|
||||
handlers.slice().map((handler) => {
|
||||
handler(evt);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue