export function createRuntimeEventFeed(subscribe) {
    return {
        on(type, listener) {
            return subscribe(type, (envelope) => {
                listener(envelope.payload);
            });
        },
        onEnvelope(type, listener) {
            return subscribe(type, listener);
        },
    };
}
export function createRuntimeEventFeeds(domains, createFeed) {
    const feeds = {};
    for (const domain of domains) {
        feeds[domain] = createFeed(domain);
    }
    return Object.freeze({
        ...feeds,
        domains,
        domain(domain) {
            return feeds[domain];
        },
    });
}
