Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ulixee
GitHub Repository: ulixee/secret-agent
Path: blob/main/interfaces/IClientPlugin.ts
1028 views
1
import { PluginTypes } from './IPluginTypes';
2
import type { Agent, Tab, FrameEnvironment } from '../client';
3
4
export default interface IClientPlugin {
5
id: string;
6
7
onAgent?(agent: Agent, sendToCore: ISendToCoreFn): void;
8
onTab?(agent: Agent, tab: Tab, sendToCore: ISendToCoreFn): void;
9
onFrameEnvironment?(
10
agent: Agent,
11
frameEnvironment: FrameEnvironment,
12
sendToCore: ISendToCoreFn,
13
): void;
14
}
15
16
export interface IClientPluginClass {
17
id: string;
18
type: PluginTypes.ClientPlugin;
19
coreDependencyIds?: string[];
20
new (): IClientPlugin;
21
}
22
23
// decorator for client plugin classes. hacky way to check the class implements statics we need
24
// eslint-disable-next-line @typescript-eslint/no-unused-vars
25
export function ClientPluginClassDecorator(constructor: IClientPluginClass): void {}
26
27
export type ISendToCoreFn = (toPluginId: string, ...args: any[]) => Promise<any>;
28
29