mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* Fix preview error with page parameter * Fix OIDC form support * Fix input border color * Fix some builder inputs * Clear some TODO MIGs * Clean comments * Update snapshot * Fix page title * Fix reactivity issue * refactor: replace individual RadioButtons with a RadioGroup component for choice option type selection. * Fix domain --------- Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
42 lines
875 B
JavaScript
42 lines
875 B
JavaScript
const listeners = {}
|
|
|
|
const priorityBus = {
|
|
$on(event, priority, callback) {
|
|
if (!listeners[event]) {
|
|
listeners[event] = []
|
|
}
|
|
|
|
listeners[event].push({ priority, callback })
|
|
listeners[event].sort((a, b) => b.priority - a.priority)
|
|
},
|
|
$off(event, callback) {
|
|
if (listeners[event]) {
|
|
listeners[event] = listeners[event].filter(
|
|
(listener) => listener.callback !== callback
|
|
)
|
|
}
|
|
},
|
|
$emit(event, ...args) {
|
|
if (listeners[event]) {
|
|
const highestPriorityListener = listeners[event][0]
|
|
if (highestPriorityListener) {
|
|
highestPriorityListener.callback(...args)
|
|
}
|
|
}
|
|
},
|
|
level: {
|
|
LOWEST: 1,
|
|
LOW: 2,
|
|
MEDIUM: 3,
|
|
HIGH: 4,
|
|
HIGHEST: 5,
|
|
},
|
|
}
|
|
|
|
export default defineNuxtPlugin({
|
|
name: 'priorityBus',
|
|
setup(nuxtApp) {
|
|
nuxtApp.provide('priorityBus', priorityBus)
|
|
},
|
|
})
|