Skip to content

Commit 9a8f49e

Browse files
author
Guillaume Chau
committed
fix(ipc): check connection
1 parent ab66dc1 commit 9a8f49e

File tree

1 file changed

+9
-0
lines changed
  • packages/@vue/cli-shared-utils/lib

1 file changed

+9
-0
lines changed

packages/@vue/cli-shared-utils/lib/ipc.js

+9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ exports.IpcMessenger = class IpcMessenger {
3636
this._reset()
3737
}
3838

39+
checkConnection () {
40+
if (!ipc.of[this.id]) {
41+
this.connected = false
42+
}
43+
}
44+
3945
send (data, type = 'message') {
46+
this.checkConnection()
4047
if (this.connected) {
4148
ipc.of[this.id].emit(type, data)
4249

@@ -55,6 +62,7 @@ exports.IpcMessenger = class IpcMessenger {
5562
}
5663

5764
connect () {
65+
this.checkConnection()
5866
if (this.connected || this.connecting) return
5967
this.connecting = true
6068
this.disconnecting = false
@@ -69,6 +77,7 @@ exports.IpcMessenger = class IpcMessenger {
6977
}
7078

7179
disconnect () {
80+
this.checkConnection()
7281
if (!this.connected || this.disconnecting) return
7382
this.disconnecting = true
7483
this.connecting = false

0 commit comments

Comments
 (0)