Skip to content

Commit ccda653

Browse files
author
filip mertens
committed
handle connections in plugins
1 parent 42c1add commit ccda653

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

apps/remix-ide/src/app/files/foundry-handle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ export class FoundryHandle extends WebsocketPlugin {
1515
constructor () {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
1826
}

apps/remix-ide/src/app/files/hardhat-handle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ export class HardhatHandle extends WebsocketPlugin {
1515
constructor () {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
1826
}

apps/remix-ide/src/app/files/truffle-handle.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ const profile = {
1212
}
1313

1414
export class TruffleHandle extends WebsocketPlugin {
15-
constructor () {
15+
constructor() {
1616
super(profile)
1717
}
18+
19+
callPluginMethod(key, payload = []) {
20+
if (this.socket.readyState !== this.socket.OPEN) {
21+
console.log(`${this.profile.name} connection is not opened.`)
22+
return false
23+
}
24+
return super.callPluginMethod(key, payload)
25+
}
26+
1827
}

0 commit comments

Comments
 (0)