开放云服务设置,增加加载完后通知主应用功能
This commit is contained in:
parent
9ad2665b0d
commit
b2aff3720c
|
@ -36,6 +36,9 @@ export class WuJieInitializer {
|
|||
$wujie.bus.$on("initialize_app", (device_sn: string) => {
|
||||
WuJieInitializer.onInitializeApp(device_sn, $wujie, $store, $q, $t);
|
||||
});
|
||||
setTimeout(() => {
|
||||
$wujie.bus.$emit("client_mounted");
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,6 +82,9 @@ export class WuJieInitializer {
|
|||
.initialize()
|
||||
.then(() => {
|
||||
$store.commit("setInitialized");
|
||||
if ($wujie) {
|
||||
$wujie.bus.$emit("client_initialize_end");
|
||||
}
|
||||
});
|
||||
EventBus.getInstance().emit(EventNamesDefine.WebSocketConnected, this);
|
||||
}, 0);
|
||||
|
|
|
@ -1,33 +1,32 @@
|
|||
import { IWuJieInterface } from './../store/index';
|
||||
import { store } from 'quasar/wrappers';
|
||||
|
||||
import { IWuJieInterface } from "./../store/index";
|
||||
import { store } from "quasar/wrappers";
|
||||
|
||||
export default class WuJieReconnectingWebSocket {
|
||||
readyState: number ;
|
||||
$wujie : IWuJieInterface;
|
||||
readyState: number;
|
||||
$wujie: IWuJieInterface;
|
||||
|
||||
constructor() {
|
||||
this.readyState=WebSocket.OPEN;
|
||||
this.onclose=(ev:any)=>{}
|
||||
this.onerror=(ev:any)=>{}
|
||||
this.onmessage=(ev:any)=>{}
|
||||
this.onopen=(ev:any)=>{}
|
||||
this.readyState = WebSocket.OPEN;
|
||||
this.onclose = (ev: any) => {};
|
||||
this.onerror = (ev: any) => {};
|
||||
this.onmessage = (ev: any) => {};
|
||||
this.onopen = (ev: any) => {};
|
||||
|
||||
this.$wujie = (window as any).$wujie;
|
||||
if(this.$wujie){
|
||||
this.$wujie.bus.$on("onclose",this.onclose)
|
||||
this.$wujie.bus.$on("onerror",this.onerror)
|
||||
this.$wujie.bus.$on("onmessage", (ev:any)=>{
|
||||
if(this.onmessage) {
|
||||
this.onmessage(ev)
|
||||
if (this.$wujie) {
|
||||
this.$wujie.bus.$on("onclose", this.onclose);
|
||||
this.$wujie.bus.$on("onerror", this.onerror);
|
||||
this.$wujie.bus.$on("onmessage", (ev: any) => {
|
||||
if (this.onmessage) {
|
||||
this.onmessage(ev);
|
||||
}
|
||||
})
|
||||
this.$wujie.bus.$on("onopen",this.onopen)
|
||||
});
|
||||
this.$wujie.bus.$on("onopen", this.onopen);
|
||||
setTimeout(() => {
|
||||
if(this.onopen){
|
||||
if (this.onopen) {
|
||||
this.onopen(null);
|
||||
}
|
||||
},1000);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
onclose: ((event: any) => void) | null;
|
||||
|
@ -48,14 +47,13 @@ export default class WuJieReconnectingWebSocket {
|
|||
* Closes the WebSocket connection or connection attempt, if any. If the connection is already
|
||||
* CLOSED, this method does nothing
|
||||
*/
|
||||
close(code?: number, reason?: string){
|
||||
}
|
||||
close(code?: number, reason?: string) {}
|
||||
/**
|
||||
* Enqueue specified data to be transmitted to the server over the WebSocket connection
|
||||
*/
|
||||
send(data: string) {
|
||||
if(this.$wujie){
|
||||
this.$wujie.bus.$emit("send_to",data)
|
||||
if (this.$wujie) {
|
||||
this.$wujie.bus.$emit("send_to", data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,6 @@
|
|||
:disable="loading"
|
||||
/>
|
||||
<q-tab
|
||||
v-if="$store.state.advanced_debug"
|
||||
name="cloud_server"
|
||||
no-caps
|
||||
icon="cloud"
|
||||
|
|
Loading…
Reference in New Issue