import { EventEmitter } from "../shared/observable.js";
import { MessageType } from "../shared/types.js";
export class PeerDataChannel extends EventEmitter {
    constructor(accessMode) {
        super();
        this.accessMode = accessMode;
        this.decoder = new TextDecoder();
        this.encoder = new TextEncoder();
    }
    emit(type, data) {
        if (this.accessMode == "read" && type == MessageType.Update) {
            console.warn(`User with read access should not update document`);
            return;
        }
        super.emit(type, data);
    }
    disconnect() {
        super.dispose();
    }
}
//# sourceMappingURL=peer-data-channel.js.map