import {AgoraStatus} from "$utils/agora/const";

export default {

    data(){
        return {
            AgoraStatus:AgoraStatus,
            loadingAgora:true
        }
    },

    watch:{
        agoraStatus(){
            if (this.agoraStatus === AgoraStatus.published || this.agoraStatus === AgoraStatus.listener) {
                this.loadingAgora = false;
            }
        }
    },

    methods:{

        toggleWheat(){
            if (this.loadingAgora) return;

            if (this.agoraStatus === AgoraStatus.listener) {
                this.useAgora.joinPublished();
            } else if (this.agoraStatus === AgoraStatus.published) {
                this.useAgora.unPublish();
            }

        }

    }

}
