UNPKG

960 BTypeScriptView Raw
1import type { EventEmitter } from 'events';
2import type { Api, Profile, LibraryProfile, LocationProfile } from '@remixproject/plugin-utils';
3import { Plugin } from './abstract';
4export declare type LibraryApi<T extends Api, P extends Profile> = {
5 [method in P['methods'][number]]: T['methods'][method];
6} & {
7 events?: EventEmitter;
8} & {
9 render?(): Element;
10};
11declare type LibraryViewProfile = LocationProfile & LibraryProfile;
12export declare function isViewLibrary(profile: any): profile is LibraryViewProfile;
13export declare class LibraryPlugin<T extends Api = any, P extends LibraryProfile | LibraryViewProfile = any> extends Plugin {
14 protected library: LibraryApi<T, P>;
15 profile: P;
16 private isView;
17 constructor(library: LibraryApi<T, P>, profile: P);
18 activate(): Promise<void>;
19 deactivate(): void;
20 /** Call a method from this plugin */
21 protected callPluginMethod(key: string, payload: any[]): any;
22}
23export {};