1 | import type { PluginListenerHandle, Plugin } from './definitions';
|
2 | import type { CapacitorException } from './util';
|
3 |
|
4 |
|
5 |
|
6 | export declare class WebPlugin implements Plugin {
|
7 | |
8 |
|
9 |
|
10 | config?: WebPluginConfig;
|
11 | protected listeners: {
|
12 | [eventName: string]: ListenerCallback[];
|
13 | };
|
14 | protected retainedEventArguments: {
|
15 | [eventName: string]: any[];
|
16 | };
|
17 | protected windowListeners: {
|
18 | [eventName: string]: WindowListenerHandle;
|
19 | };
|
20 | constructor(config?: WebPluginConfig);
|
21 | addListener(eventName: string, listenerFunc: ListenerCallback): Promise<PluginListenerHandle>;
|
22 | removeAllListeners(): Promise<void>;
|
23 | protected notifyListeners(eventName: string, data: any, retainUntilConsumed?: boolean): void;
|
24 | protected hasListeners(eventName: string): boolean;
|
25 | protected registerWindowListener(windowEventName: string, pluginEventName: string): void;
|
26 | protected unimplemented(msg?: string): CapacitorException;
|
27 | protected unavailable(msg?: string): CapacitorException;
|
28 | private removeListener;
|
29 | private addWindowListener;
|
30 | private removeWindowListener;
|
31 | private sendRetainedArgumentsForEvent;
|
32 | }
|
33 | export type ListenerCallback = (err: any, ...args: any[]) => void;
|
34 | export interface WindowListenerHandle {
|
35 | registered: boolean;
|
36 | windowEventName: string;
|
37 | pluginEventName: string;
|
38 | handler: (event: any) => void;
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 | export interface WebPluginConfig {
|
44 | |
45 |
|
46 |
|
47 | readonly name: string;
|
48 | |
49 |
|
50 |
|
51 | platforms?: string[];
|
52 | }
|