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 windowListeners: {
|
15 | [eventName: string]: WindowListenerHandle;
|
16 | };
|
17 | constructor(config?: WebPluginConfig);
|
18 | addListener(eventName: string, listenerFunc: ListenerCallback): Promise<PluginListenerHandle> & PluginListenerHandle;
|
19 | removeAllListeners(): Promise<void>;
|
20 | protected notifyListeners(eventName: string, data: any): void;
|
21 | protected hasListeners(eventName: string): boolean;
|
22 | protected registerWindowListener(windowEventName: string, pluginEventName: string): void;
|
23 | protected unimplemented(msg?: string): CapacitorException;
|
24 | protected unavailable(msg?: string): CapacitorException;
|
25 | private removeListener;
|
26 | private addWindowListener;
|
27 | private removeWindowListener;
|
28 | }
|
29 | export type ListenerCallback = (err: any, ...args: any[]) => void;
|
30 | export interface WindowListenerHandle {
|
31 | registered: boolean;
|
32 | windowEventName: string;
|
33 | pluginEventName: string;
|
34 | handler: (event: any) => void;
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 | export interface WebPluginConfig {
|
40 | |
41 |
|
42 |
|
43 | readonly name: string;
|
44 | |
45 |
|
46 |
|
47 | platforms?: string[];
|
48 | }
|