const listeners = new Set();
export function onGlobalEvent(fn) {
    listeners.add(fn);
    return () => {
        listeners.delete(fn);
    };
}
export function emitGlobalEvent(event) {
    if (listeners.size === 0)
        return;
    for (const fn of listeners) {
        try {
            fn(event);
        }
        catch {
            /* drop */
        }
    }
}
//# sourceMappingURL=global-events-bus.js.map