@remixproject/engine
Advanced tools
Comparing version 0.3.20-alpha.2 to 0.3.208
import type { Api, EventKey, EventParams, MethodKey, MethodParams, EventCallback, ApiMap, Profile, PluginRequest, PluginApi, PluginBase, IPluginService, PluginOptions } from '@remixproject/plugin-utils'; | ||
import { PluginQueue } from '@remixproject/plugin-utils'; | ||
import { PluginQueueItem } from '@remixproject/plugin-utils'; | ||
export interface RequestParams { | ||
@@ -11,3 +11,2 @@ name: string; | ||
activateService: Record<string, () => Promise<any>>; | ||
protected requestQueue: Array<() => Promise<any>>; | ||
protected currentRequest: PluginRequest; | ||
@@ -17,3 +16,3 @@ /** Give access to all the plugins registered by the engine */ | ||
protected options: PluginOptions; | ||
protected queue: PluginQueue[]; | ||
protected queue: PluginQueueItem[]; | ||
onRegistration?(): void; | ||
@@ -73,3 +72,3 @@ onActivation?(): void; | ||
call<Name extends Extract<keyof App, string>, Key extends MethodKey<App[Name]>>(name: Name, key: Key, ...payload: MethodParams<App[Name], Key>): Promise<ReturnType<App[Name]['methods'][Key]>>; | ||
/** Call a method of another plugin */ | ||
/** Cancel a method of another plugin */ | ||
cancel<Name extends Extract<keyof App, string>, Key extends MethodKey<App[Name]>>(name: Name, key: Key): Promise<ReturnType<App[Name]['methods'][Key]>>; | ||
@@ -76,0 +75,0 @@ /** Emit an event */ |
@@ -10,3 +10,2 @@ "use strict"; | ||
this.activateService = {}; | ||
this.requestQueue = []; | ||
this.options = {}; | ||
@@ -62,3 +61,3 @@ this.queue = []; | ||
return new Promise((resolve, reject) => { | ||
const queue = new plugin_utils_1.PluginQueue(resolve, reject, request, method, this.options, args); | ||
const queue = new plugin_utils_1.PluginQueueItem(resolve, reject, request, method, this.options, args); | ||
queue['setCurrentRequest'] = (request) => this.setCurrentRequest(request); | ||
@@ -170,3 +169,3 @@ queue['callMethod'] = (method, args) => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.callPluginMethod(method, args); }); | ||
} | ||
/** Call a method of another plugin */ | ||
/** Cancel a method of another plugin */ | ||
cancel(name, key) { | ||
@@ -173,0 +172,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () { |
@@ -136,7 +136,6 @@ "use strict"; | ||
cancelMethod(caller, path, method) { | ||
var _a; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const target = path.split('.').shift(); | ||
if (!this.plugins[target]) { | ||
throw new Error(`Cannot call ${target} from ${caller}, because ${target} is not registered`); | ||
throw new Error(`Cannot cancel ${method} on ${target} from ${caller}, because ${target} is not registered`); | ||
} | ||
@@ -151,10 +150,3 @@ // Get latest version of the profiles | ||
if (!isActive) { | ||
const managerCanActivate = yield this.manager.canActivatePlugin(from, to, method); | ||
const pluginCanActivate = yield ((_a = this.plugins[to.name]) === null || _a === void 0 ? void 0 : _a.canActivate(to, method)); | ||
if (managerCanActivate && pluginCanActivate) { | ||
yield this.manager.toggleActive(target); | ||
} | ||
else { | ||
throw new Error(`${from.name} cannot cancel ${method} of ${target}, because ${target} is not activated yet`); | ||
} | ||
throw new Error(`${from.name} cannot cancel ${method ? `${method} of ` : 'calls on'}${target}, because ${target} is not activated`); | ||
} | ||
@@ -161,0 +153,0 @@ // Check if method is exposed |
{ | ||
"name": "@remixproject/engine", | ||
"version": "0.3.20-alpha.2", | ||
"version": "0.3.208", | ||
"homepage": "https://github.com/ethereum/remix-plugin/tree/master/packages/engine/core#readme", | ||
@@ -27,6 +27,6 @@ "repository": { | ||
"dependencies": { | ||
"@remixproject/plugin-utils": "0.3.20-alpha.2", | ||
"@remixproject/plugin-api": "0.3.20-alpha.2" | ||
"@remixproject/plugin-utils": "0.3.208", | ||
"@remixproject/plugin-api": "0.3.208" | ||
}, | ||
"peerDependencies": {} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
98739
1390
+ Added@remixproject/plugin-api@0.3.208(transitive)
+ Added@remixproject/plugin-utils@0.3.208(transitive)
- Removed@remixproject/plugin-api@0.3.20-alpha.2(transitive)
- Removed@remixproject/plugin-utils@0.3.20-alpha.2(transitive)