Unverified Commit 3397b639 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1232 from ethereum/activatehat

fixes for deactivating hardhat
parents 3a96a09d 8d02d6c6
...@@ -31,17 +31,17 @@ const profile = { ...@@ -31,17 +31,17 @@ const profile = {
} }
export class RemixdHandle extends WebsocketPlugin { export class RemixdHandle extends WebsocketPlugin {
constructor (locahostProvider, appManager) { constructor (localhostProvider, appManager) {
super(profile) super(profile)
this.locahostProvider = locahostProvider this.localhostProvider = localhostProvider
this.appManager = appManager this.appManager = appManager
} }
deactivate () { deactivate () {
if (super.socket) super.deactivate() if (super.socket) super.deactivate()
// this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 // this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342
this.appManager.deactivatePlugin('hardhat') if (this.appManager.actives.includes('hardhat')) this.appManager.deactivatePlugin('hardhat')
this.locahostProvider.close((error) => { this.localhostProvider.close((error) => {
if (error) console.log(error) if (error) console.log(error)
}) })
} }
...@@ -53,7 +53,6 @@ export class RemixdHandle extends WebsocketPlugin { ...@@ -53,7 +53,6 @@ export class RemixdHandle extends WebsocketPlugin {
async canceled () { async canceled () {
// await this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 // await this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342
await this.appManager.deactivatePlugin('remixd') await this.appManager.deactivatePlugin('remixd')
await this.appManager.deactivatePlugin('hardhat')
} }
/** /**
...@@ -83,11 +82,11 @@ export class RemixdHandle extends WebsocketPlugin { ...@@ -83,11 +82,11 @@ export class RemixdHandle extends WebsocketPlugin {
this.canceled() this.canceled()
} }
}, 3000) }, 3000)
this.locahostProvider.init(() => {}) this.localhostProvider.init(() => {})
this.call('manager', 'activatePlugin', 'hardhat') this.call('manager', 'activatePlugin', 'hardhat')
} }
} }
if (this.locahostProvider.isConnected()) { if (this.localhostProvider.isConnected()) {
this.deactivate() this.deactivate()
} else if (!isElectron()) { } else if (!isElectron()) {
// warn the user only if he/she is in the browser context // warn the user only if he/she is in the browser context
...@@ -98,7 +97,7 @@ export class RemixdHandle extends WebsocketPlugin { ...@@ -98,7 +97,7 @@ export class RemixdHandle extends WebsocketPlugin {
label: 'Connect', label: 'Connect',
fn: () => { fn: () => {
try { try {
this.locahostProvider.preInit() this.localhostProvider.preInit()
super.activate() super.activate()
setTimeout(() => { setTimeout(() => {
if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment