Skip to content

Commit 9f42742

Browse files
committed
🔧 build: 添加声明文件
1 parent 1f129ea commit 9f42742

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

‎index.d.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
interface VpnOptions {
2+
remoteAddress?: string;
3+
ovpnFileName?: string;
4+
assetsPath?: string;
5+
providerBundleIdentifier: string;
6+
localizedDescription?: string;
7+
}
8+
9+
interface VpnEventParams {
10+
state: RNSimpleOpenvpn.VpnState;
11+
message: string;
12+
level?: string;
13+
}
14+
15+
declare namespace RNSimpleOpenvpn {
16+
function connect(options: VpnOptions): Promise<void>;
17+
function disconnect(): Promise<void>;
18+
function observeState(): Promise<void>;
19+
function stopObserveState(): Promise<void>;
20+
enum VpnState {
21+
VPN_STATE_DISCONNECTED,
22+
VPN_STATE_CONNECTING,
23+
VPN_STATE_CONNECTED,
24+
VPN_STATE_DISCONNECTING,
25+
VPN_OTHER_STATE
26+
}
27+
}
28+
29+
declare const addVpnStateListener: (callback: (e: VpnEventParams) => void) => void;
30+
31+
declare const removeVpnStateListener: () => void;
32+
33+
export { addVpnStateListener, removeVpnStateListener, VpnOptions, VpnEventParams };
34+
35+
export default RNSimpleOpenvpn;

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "1.0.0",
55
"description": "React Native Open VPN Module",
66
"main": "index.js",
7+
"types": "index.d.ts",
78
"files": [
89
"README.md",
910
"android",

0 commit comments

Comments
 (0)