"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapBroadcastChannel = wrapBroadcastChannel;
const _1 = require("../Class/$");
function wrapBroadcastChannel(broadcastChannel, system) {
    const channel = new (class Channel extends _1.$ {
        constructor(system) {
            super(system);
            this.__ = ['CH'];
            broadcastChannel.onmessage = (event) => {
                const { data } = event;
                this.emit('message', data);
            };
        }
        send(data) {
            broadcastChannel.postMessage(data);
            return;
        }
    })(system);
    return channel;
}
//# sourceMappingURL=BroadcastChannel.js.map