@remixproject/engine-electron
Advanced tools
Comparing version 0.3.40 to 0.3.41
{ | ||
"name": "@remixproject/engine-electron", | ||
"version": "0.3.40", | ||
"version": "0.3.41", | ||
"homepage": "https://github.com/ethereum/remix-plugin/tree/master/packages/engine/node#readme", | ||
@@ -22,7 +22,7 @@ "repository": { | ||
"dependencies": { | ||
"@remixproject/plugin-utils": "0.3.40", | ||
"@remixproject/engine": "0.3.40", | ||
"@remixproject/plugin-api": "0.3.40" | ||
"@remixproject/plugin-utils": "0.3.41", | ||
"@remixproject/engine": "0.3.41", | ||
"@remixproject/plugin-api": "0.3.41" | ||
}, | ||
"peerDependencies": {} | ||
} |
@@ -0,5 +1,8 @@ | ||
/// <reference types="node" /> | ||
import type { Profile, Message } from '@remixproject/plugin-utils'; | ||
import { Plugin } from '@remixproject/engine'; | ||
import { EventEmitter } from 'events'; | ||
export declare abstract class ElectronPlugin extends Plugin { | ||
protected loaded: boolean; | ||
events: EventEmitter; | ||
protected id: number; | ||
@@ -31,2 +34,3 @@ protected pendingRequest: Record<number, (result: any, error: Error | string) => void>; | ||
protected handshake(): Promise<any>; | ||
onload(cb?: () => void): Promise<void>; | ||
/** | ||
@@ -33,0 +37,0 @@ * React when a message comes from client |
@@ -6,5 +6,7 @@ "use strict"; | ||
const engine_1 = require("@remixproject/engine"); | ||
const events_1 = require("events"); | ||
class ElectronPlugin extends engine_1.Plugin { | ||
constructor(profile) { | ||
super(profile); | ||
this.events = new events_1.EventEmitter(); | ||
this.id = 0; | ||
@@ -101,5 +103,7 @@ this.pendingRequest = {}; | ||
} | ||
this.events.emit('loaded'); | ||
this.emit('loaded', this.name); | ||
} | ||
else { | ||
this.events.emit('loaded'); | ||
// If there is a broken connection we want send back the handshake to the plugin client | ||
@@ -110,2 +114,13 @@ return this.callPluginMethod('handshake', [this.profile.name]); | ||
} | ||
// Wait until this connection is settled | ||
onload(cb) { | ||
return new Promise((res, rej) => { | ||
const loadFn = () => { | ||
res(); | ||
if (cb) | ||
cb(); | ||
}; | ||
this.loaded ? loadFn() : this.events.once('loaded', () => loadFn()); | ||
}); | ||
} | ||
/** | ||
@@ -112,0 +127,0 @@ * React when a message comes from client |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15639
240
+ Added@remixproject/engine@0.3.41(transitive)
+ Added@remixproject/plugin-api@0.3.41(transitive)
+ Added@remixproject/plugin-utils@0.3.41(transitive)
- Removed@remixproject/engine@0.3.40(transitive)
- Removed@remixproject/plugin-api@0.3.40(transitive)
- Removed@remixproject/plugin-utils@0.3.40(transitive)
Updated@remixproject/engine@0.3.41