bridgefy-react-native 1.1.9 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +510 -101
- package/android/build.gradle +2 -3
- package/android/local.properties +8 -0
- package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativeModule.kt +25 -5
- package/android/src/main/java/me/bridgefy/plugin/react_native/util/BridgefyOperationModeManager.kt +1 -1
- package/bridgefy-react-native.podspec +1 -1
- package/ios/BridgefyReactNativeModule.swift +1 -1
- package/package.json +1 -1
- package/src/NativeBridgefy.ts +0 -4
- package/src/index.tsx +1 -15
- package/lib/module/NativeBridgefy.js +0 -117
- package/lib/module/NativeBridgefy.js.map +0 -1
- package/lib/module/index.js +0 -239
- package/lib/module/index.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/typescript/package.json +0 -1
- package/lib/typescript/src/NativeBridgefy.d.ts +0 -250
- package/lib/typescript/src/NativeBridgefy.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -146
- package/lib/typescript/src/index.d.ts.map +0 -1
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BridgefyReactNative.ts
|
|
3
|
-
* TurboModule Spec for Bridgefy SDK
|
|
4
|
-
*
|
|
5
|
-
* This spec defines all methods from the Bridgefy SDK for both Android and iOS
|
|
6
|
-
* Based on: https://github.com/bridgefy/bridgefy-react-native
|
|
7
|
-
*/
|
|
8
|
-
import type { TurboModule } from 'react-native';
|
|
9
|
-
export declare enum BridgefyPropagationProfile {
|
|
10
|
-
STANDARD = "standard",
|
|
11
|
-
HIGH_DENSITY_NETWORK = "highDensityNetwork",
|
|
12
|
-
SPARSE_NETWORK = "sparseNetwork",
|
|
13
|
-
LONG_REACH = "longReach",
|
|
14
|
-
SHORT_REACH = "shortReach",
|
|
15
|
-
REALTIME = "realTime"
|
|
16
|
-
}
|
|
17
|
-
export declare enum BridgefyTransmissionModeType {
|
|
18
|
-
BROADCAST = "broadcast",
|
|
19
|
-
P2P = "p2p",
|
|
20
|
-
MESH = "mesh"
|
|
21
|
-
}
|
|
22
|
-
export declare enum BridgefyEvents {
|
|
23
|
-
BRIDGEFY_DID_START = "bridgefyDidStart",
|
|
24
|
-
BRIDGEFY_DID_STOP = "bridgefyDidStop",
|
|
25
|
-
BRIDGEFY_DID_FAIL_TO_START = "bridgefyDidFailToStart",
|
|
26
|
-
BRIDGEFY_DID_FAIL_TO_STOP = "bridgefyDidFailToStop",
|
|
27
|
-
BRIDGEFY_DID_DESTROY_SESSION = "bridgefyDidDestroySession",
|
|
28
|
-
BRIDGEFY_DID_FAIL_TO_DESTROY_SESSION = "bridgefyDidFailToDestroySession",
|
|
29
|
-
BRIDGEFY_DID_CONNECT = "bridgefyDidConnect",
|
|
30
|
-
BRIDGEFY_DID_UPDATE_CONNECTED_PEERS = "bridgefyDidUpdateConnectedPeers",
|
|
31
|
-
BRIDGEFY_DID_DISCONNECT = "bridgefyDidDisconnect",
|
|
32
|
-
BRIDGEFY_DID_ESTABLISH_SECURE_CONNECTION = "bridgefyDidEstablishSecureConnection",
|
|
33
|
-
BRIDGEFY_DID_FAIL_TO_ESTABLISH_SECURE_CONNECTION = "bridgefyDidFailToEstablishSecureConnection",
|
|
34
|
-
BRIDGEFY_DID_SEND_MESSAGE = "bridgefyDidSendMessage",
|
|
35
|
-
BRIDGEFY_DID_SEND_DATA_PROGRESS = "bridgefyDidSendDataProgress",
|
|
36
|
-
BRIDGEFY_DID_FAIL_SENDING_MESSAGE = "bridgefyDidFailSendingMessage",
|
|
37
|
-
BRIDGEFY_DID_RECEIVE_DATA = "bridgefyDidReceiveData",
|
|
38
|
-
BRIDGEFY_MESSAGE_RECEIVED = "bridgefyMessageReceived",
|
|
39
|
-
BRIDGEFY_DID_UPDATE_LICENSE = "bridgefyDidUpdateLicense",
|
|
40
|
-
BRIDGEFY_DID_FAIL_TO_UPDATE_LICENSE = "bridgefyDidFailToUpdateLicense"
|
|
41
|
-
}
|
|
42
|
-
export declare enum BridgefyErrorCode {
|
|
43
|
-
INVALID_API_KEY = "INVALID_API_KEY",
|
|
44
|
-
SESSION_ERROR = "SESSION_ERROR",
|
|
45
|
-
INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
|
|
46
|
-
LICENSE_ERROR = "LICENSE_ERROR",
|
|
47
|
-
CONNECTION_ERROR = "CONNECTION_ERROR",
|
|
48
|
-
BLUETOOTH_DISABLED = "BLUETOOTH_DISABLED",
|
|
49
|
-
LOCATION_PERMISSION_DENIED = "LOCATION_PERMISSION_DENIED",
|
|
50
|
-
BLUETOOTH_PERMISSION_DENIED = "BLUETOOTH_PERMISSION_DENIED",
|
|
51
|
-
MESSAGE_SEND_FAILED = "MESSAGE_SEND_FAILED",
|
|
52
|
-
INVALID_MESSAGE = "INVALID_MESSAGE",
|
|
53
|
-
ENCRYPTION_ERROR = "ENCRYPTION_ERROR",
|
|
54
|
-
SERVICE_NOT_STARTED = "SERVICE_NOT_STARTED",
|
|
55
|
-
SERVICE_ALREADY_STARTED = "SERVICE_ALREADY_STARTED",
|
|
56
|
-
DESTROY_SESSION_ERROR = "DESTROY_SESSION_ERROR",
|
|
57
|
-
LICENSE_EXPIRED = "LICENSE_EXPIRED",
|
|
58
|
-
LICENSE_UPDATE_FAILED = "LICENSE_UPDATE_FAILED",
|
|
59
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
60
|
-
TIMEOUT_ERROR = "TIMEOUT_ERROR",
|
|
61
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
62
|
-
}
|
|
63
|
-
export declare enum BridgefyOperationMode {
|
|
64
|
-
/**
|
|
65
|
-
* FOREGROUND: SDK runs only when app is in foreground
|
|
66
|
-
* - Lower battery usage
|
|
67
|
-
* - No background service
|
|
68
|
-
* - Simpler lifecycle
|
|
69
|
-
* - Good for testing/development
|
|
70
|
-
*/
|
|
71
|
-
FOREGROUND = "foreground",
|
|
72
|
-
/**
|
|
73
|
-
* BACKGROUND: SDK runs in background service
|
|
74
|
-
* - Continuous mesh networking
|
|
75
|
-
* - Higher battery usage
|
|
76
|
-
* - Foreground service with notification
|
|
77
|
-
* - Survives app backgrounding
|
|
78
|
-
*/
|
|
79
|
-
BACKGROUND = "background",
|
|
80
|
-
/**
|
|
81
|
-
* HYBRID: Foreground in app, background in service
|
|
82
|
-
* - Starts in foreground when app is active
|
|
83
|
-
* - Switches to background service when app backgrounded
|
|
84
|
-
* - Automatic mode switching
|
|
85
|
-
* - Best of both worlds
|
|
86
|
-
*/
|
|
87
|
-
HYBRID = "hybrid"
|
|
88
|
-
}
|
|
89
|
-
export type BridgefyInitConfig = {
|
|
90
|
-
apiKey: string;
|
|
91
|
-
verboseLogging?: boolean;
|
|
92
|
-
operationMode?: BridgefyOperationMode;
|
|
93
|
-
};
|
|
94
|
-
export type BridgefyTransmissionMode = {
|
|
95
|
-
type: BridgefyTransmissionModeType;
|
|
96
|
-
uuid?: string;
|
|
97
|
-
};
|
|
98
|
-
export type BridgefyError = {
|
|
99
|
-
code: BridgefyErrorCode;
|
|
100
|
-
message: string;
|
|
101
|
-
domain?: string;
|
|
102
|
-
userInfo?: Record<string, any>;
|
|
103
|
-
};
|
|
104
|
-
export type BridgefyMessageData = {
|
|
105
|
-
senderId: string;
|
|
106
|
-
receiverId?: string;
|
|
107
|
-
data: string;
|
|
108
|
-
messageId: string;
|
|
109
|
-
timestamp: number;
|
|
110
|
-
transmissionMode: BridgefyTransmissionModeType;
|
|
111
|
-
};
|
|
112
|
-
export type BridgefyStartEvent = {
|
|
113
|
-
userId: string;
|
|
114
|
-
};
|
|
115
|
-
export type BridgefyConnectEvent = {
|
|
116
|
-
userId: string;
|
|
117
|
-
};
|
|
118
|
-
export type BridgefyUpdatedConnectedEvent = {
|
|
119
|
-
peers: string[];
|
|
120
|
-
};
|
|
121
|
-
export type BridgefyDisconnectEvent = {
|
|
122
|
-
userId: string;
|
|
123
|
-
};
|
|
124
|
-
export type BridgefySendMessageEvent = {
|
|
125
|
-
messageId: string;
|
|
126
|
-
};
|
|
127
|
-
export type BridgefyDidSendDataProgress = {
|
|
128
|
-
messageId: string;
|
|
129
|
-
position: number;
|
|
130
|
-
of: number;
|
|
131
|
-
};
|
|
132
|
-
export type BridgefyReceiveDataEvent = {
|
|
133
|
-
data: string;
|
|
134
|
-
messageId: string;
|
|
135
|
-
transmissionMode: BridgefyTransmissionMode;
|
|
136
|
-
};
|
|
137
|
-
export type BridgefySecureConnectionEvent = {
|
|
138
|
-
userId: string;
|
|
139
|
-
};
|
|
140
|
-
export type BridgefyLicenseInfo = {
|
|
141
|
-
expirationDate: number;
|
|
142
|
-
isValid: boolean;
|
|
143
|
-
};
|
|
144
|
-
export type BridgefyOperationModeConfig = {
|
|
145
|
-
mode: BridgefyOperationMode;
|
|
146
|
-
};
|
|
147
|
-
export type BridgefyOperationModeStatus = {
|
|
148
|
-
operationMode: BridgefyOperationMode;
|
|
149
|
-
isInitialized: boolean;
|
|
150
|
-
isStarted: boolean;
|
|
151
|
-
shouldRunInService: boolean;
|
|
152
|
-
debugInfo: string;
|
|
153
|
-
};
|
|
154
|
-
export interface Spec extends TurboModule {
|
|
155
|
-
/**
|
|
156
|
-
* Initialize the Bridgefy SDK
|
|
157
|
-
* @param config Configuration object with API key and settings
|
|
158
|
-
* @returns Promise that resolves when initialization is complete
|
|
159
|
-
* @throws BridgefyError if initialization fails
|
|
160
|
-
*/
|
|
161
|
-
initialize(config: BridgefyInitConfig): Promise<void>;
|
|
162
|
-
/**
|
|
163
|
-
* Start the Bridgefy SDK with optional user ID and propagation profile
|
|
164
|
-
* @param userId Optional custom user ID (UUID string)
|
|
165
|
-
* @param propagationProfile Propagation profile for mesh network
|
|
166
|
-
* @returns Promise that resolves when SDK starts
|
|
167
|
-
* @throws BridgefyError if start fails
|
|
168
|
-
*/
|
|
169
|
-
start(userId?: string, propagationProfile?: BridgefyPropagationProfile): Promise<void>;
|
|
170
|
-
/**
|
|
171
|
-
* Stop the Bridgefy SDK
|
|
172
|
-
* @returns Promise that resolves when SDK stops
|
|
173
|
-
* @throws BridgefyError if stop fails
|
|
174
|
-
*/
|
|
175
|
-
stop(): Promise<void>;
|
|
176
|
-
/**
|
|
177
|
-
* Destroy the current Bridgefy session
|
|
178
|
-
* Terminates all active connections and cleans up resources
|
|
179
|
-
* @returns Promise that resolves when session is destroyed
|
|
180
|
-
* @throws BridgefyError if destroy fails
|
|
181
|
-
*/
|
|
182
|
-
destroySession(): Promise<void>;
|
|
183
|
-
/**
|
|
184
|
-
* Send data through the Bridgefy mesh network
|
|
185
|
-
* @param data String data to send (serialize objects to JSON string)
|
|
186
|
-
* @param transmissionMode Transmission mode configuration
|
|
187
|
-
* @returns Promise that resolves with the message ID (UUID string)
|
|
188
|
-
* @throws BridgefyError if send fails
|
|
189
|
-
*/
|
|
190
|
-
send(data: string, transmissionMode: BridgefyTransmissionMode): Promise<string>;
|
|
191
|
-
/**
|
|
192
|
-
* Establish a secure connection with a specific user
|
|
193
|
-
* @param userId The user ID to establish secure connection with
|
|
194
|
-
* @returns Promise that resolves when connection is established
|
|
195
|
-
* @throws BridgefyError if connection fails
|
|
196
|
-
*/
|
|
197
|
-
establishSecureConnection(userId: string): Promise<void>;
|
|
198
|
-
/**
|
|
199
|
-
* Get the current user ID
|
|
200
|
-
* @returns Promise that resolves with the current user's UUID string
|
|
201
|
-
* @throws BridgefyError if not initialized
|
|
202
|
-
*/
|
|
203
|
-
currentUserId(): Promise<string>;
|
|
204
|
-
/**
|
|
205
|
-
* Get list of currently connected peers
|
|
206
|
-
* @returns Promise that resolves with array of user IDs (UUID strings)
|
|
207
|
-
* @throws BridgefyError if not started
|
|
208
|
-
*/
|
|
209
|
-
connectedPeers(): Promise<string[]>;
|
|
210
|
-
/**
|
|
211
|
-
* Get the license expiration date
|
|
212
|
-
* @returns Promise that resolves with license info
|
|
213
|
-
* @throws BridgefyError if license check fails
|
|
214
|
-
*/
|
|
215
|
-
licenseExpirationDate(): Promise<BridgefyLicenseInfo>;
|
|
216
|
-
/**
|
|
217
|
-
* Update the Bridgefy license
|
|
218
|
-
* @returns Promise that resolves when license is updated
|
|
219
|
-
* @throws BridgefyError if update fails
|
|
220
|
-
*/
|
|
221
|
-
updateLicense(): Promise<void>;
|
|
222
|
-
/**
|
|
223
|
-
* Check if the SDK is initialized
|
|
224
|
-
* @returns Promise that resolves with boolean
|
|
225
|
-
*/
|
|
226
|
-
isInitialized(): Promise<boolean>;
|
|
227
|
-
/**
|
|
228
|
-
* Check if the SDK is started
|
|
229
|
-
* @returns Promise that resolves with boolean
|
|
230
|
-
*/
|
|
231
|
-
isStarted(): Promise<boolean>;
|
|
232
|
-
/**
|
|
233
|
-
* Add event listener (internal method for native events)
|
|
234
|
-
* This is typically handled by React Native's EventEmitter
|
|
235
|
-
*/
|
|
236
|
-
addListener(eventName: string): void;
|
|
237
|
-
/**
|
|
238
|
-
* Remove event listeners (internal method)
|
|
239
|
-
* @param count Number of listeners to remove
|
|
240
|
-
*/
|
|
241
|
-
removeListeners(count: number): void;
|
|
242
|
-
setOperationMode(config: BridgefyOperationModeConfig): Promise<BridgefyOperationModeConfig>;
|
|
243
|
-
getOperationMode(): Promise<BridgefyOperationModeConfig>;
|
|
244
|
-
switchToBackground(): Promise<void>;
|
|
245
|
-
switchToForeground(): Promise<void>;
|
|
246
|
-
getOperationStatus(): Promise<BridgefyOperationModeStatus>;
|
|
247
|
-
}
|
|
248
|
-
declare const _default: Spec;
|
|
249
|
-
export default _default;
|
|
250
|
-
//# sourceMappingURL=NativeBridgefy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeBridgefy.d.ts","sourceRoot":"","sources":["../../../src/NativeBridgefy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,oBAAY,0BAA0B;IACpC,QAAQ,aAAa;IACrB,oBAAoB,uBAAuB;IAC3C,cAAc,kB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OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEpC;;;;OAIG;IACH,qBAAqB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEtD;;;;OAIG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC,gBAAgB,CACd,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,gBAAgB,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACzD,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,kBAAkB,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC5D;;AAED,wBAA6E"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { BridgefyPropagationProfile, BridgefyTransmissionModeType, BridgefyEvents, BridgefyErrorCode, BridgefyOperationMode, type BridgefyInitConfig, type BridgefyTransmissionMode, type BridgefyError, type BridgefyMessageData, type BridgefyStartEvent, type BridgefyConnectEvent, type BridgefyDisconnectEvent, type BridgefySendMessageEvent, type BridgefyReceiveDataEvent, type BridgefySecureConnectionEvent, type BridgefyLicenseInfo, type BridgefyUpdatedConnectedEvent, type BridgefyDidSendDataProgress, type BridgefyOperationModeConfig, type BridgefyOperationModeStatus } from './NativeBridgefy';
|
|
2
|
-
/**
|
|
3
|
-
* index.ts
|
|
4
|
-
*
|
|
5
|
-
* Main export file for Bridgefy React Native TurboModule
|
|
6
|
-
* Provides a clean JavaScript/TypeScript wrapper around the native TurboModule
|
|
7
|
-
*/
|
|
8
|
-
export { BridgefyPropagationProfile, BridgefyTransmissionModeType, BridgefyEvents, BridgefyErrorCode, BridgefyOperationMode, type BridgefyInitConfig, type BridgefyTransmissionMode, type BridgefyError, type BridgefyMessageData, type BridgefyStartEvent, type BridgefyConnectEvent, type BridgefyDisconnectEvent, type BridgefySendMessageEvent, type BridgefyReceiveDataEvent, type BridgefySecureConnectionEvent, type BridgefyLicenseInfo, type BridgefyUpdatedConnectedEvent, type BridgefyDidSendDataProgress, type BridgefyOperationModeConfig, type BridgefyOperationModeStatus, };
|
|
9
|
-
/**
|
|
10
|
-
* Bridgefy class - JavaScript wrapper for the native TurboModule
|
|
11
|
-
* Provides event emitter capabilities and clean API
|
|
12
|
-
*/
|
|
13
|
-
export declare class Bridgefy {
|
|
14
|
-
private eventEmitter;
|
|
15
|
-
constructor();
|
|
16
|
-
/**
|
|
17
|
-
* Initialize the Bridgefy SDK
|
|
18
|
-
*/
|
|
19
|
-
initialize(apiKey: string, verboseLogging?: boolean, operationMode?: BridgefyOperationMode): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Start the Bridgefy SDK
|
|
22
|
-
*/
|
|
23
|
-
start(userId?: string, propagationProfile?: BridgefyPropagationProfile): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Stop the Bridgefy SDK
|
|
26
|
-
*/
|
|
27
|
-
stop(): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Destroy the current session
|
|
30
|
-
*/
|
|
31
|
-
destroySession(): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Send data through the mesh network
|
|
34
|
-
*/
|
|
35
|
-
send(data: string, transmissionMode: BridgefyTransmissionMode): Promise<string>;
|
|
36
|
-
/**
|
|
37
|
-
* Send broadcast message (convenience method)
|
|
38
|
-
*/
|
|
39
|
-
sendBroadcast(data: string): Promise<string>;
|
|
40
|
-
/**
|
|
41
|
-
* Send P2P message (convenience method)
|
|
42
|
-
*/
|
|
43
|
-
sendP2P(data: string, recipientId: string): Promise<string>;
|
|
44
|
-
/**
|
|
45
|
-
* Send mesh message (convenience method)
|
|
46
|
-
*/
|
|
47
|
-
sendMesh(data: string, recipientId: string): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Establish secure connection with a peer
|
|
50
|
-
*/
|
|
51
|
-
establishSecureConnection(userId: string): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Get current user ID
|
|
54
|
-
*/
|
|
55
|
-
currentUserId(): Promise<string>;
|
|
56
|
-
/**
|
|
57
|
-
* Get list of connected peers
|
|
58
|
-
*/
|
|
59
|
-
connectedPeers(): Promise<string[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Get license expiration info
|
|
62
|
-
*/
|
|
63
|
-
licenseExpirationDate(): Promise<BridgefyLicenseInfo>;
|
|
64
|
-
/**
|
|
65
|
-
* Update license
|
|
66
|
-
*/
|
|
67
|
-
updateLicense(): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Check if SDK is initialized
|
|
70
|
-
*/
|
|
71
|
-
isInitialized(): Promise<boolean>;
|
|
72
|
-
/**
|
|
73
|
-
* Check if SDK is started
|
|
74
|
-
*/
|
|
75
|
-
isStarted(): Promise<boolean>;
|
|
76
|
-
setOperationMode(config: BridgefyOperationModeConfig): Promise<BridgefyOperationModeConfig>;
|
|
77
|
-
getOperationMode(): Promise<BridgefyOperationModeConfig>;
|
|
78
|
-
switchToBackground(): Promise<void>;
|
|
79
|
-
switchToForeground(): Promise<void>;
|
|
80
|
-
getOperationStatus(): Promise<BridgefyOperationModeStatus>;
|
|
81
|
-
/**
|
|
82
|
-
* Add event listener
|
|
83
|
-
*/
|
|
84
|
-
addEventListener(eventName: BridgefyEvents, listener: (event: any) => void): {
|
|
85
|
-
remove: () => void;
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Remove all listeners for an event
|
|
89
|
-
*/
|
|
90
|
-
removeAllListeners(eventName?: BridgefyEvents): void;
|
|
91
|
-
/**
|
|
92
|
-
* Event listener helpers for common events
|
|
93
|
-
*/
|
|
94
|
-
onStart(listener: (event: BridgefyStartEvent) => void): {
|
|
95
|
-
remove: () => void;
|
|
96
|
-
};
|
|
97
|
-
onStop(listener: () => void): {
|
|
98
|
-
remove: () => void;
|
|
99
|
-
};
|
|
100
|
-
onFailToStart(listener: (error: BridgefyError) => void): {
|
|
101
|
-
remove: () => void;
|
|
102
|
-
};
|
|
103
|
-
onFailToStop(listener: (error: BridgefyError) => void): {
|
|
104
|
-
remove: () => void;
|
|
105
|
-
};
|
|
106
|
-
onConnect(listener: (event: BridgefyConnectEvent) => void): {
|
|
107
|
-
remove: () => void;
|
|
108
|
-
};
|
|
109
|
-
onConnectedPeers(listener: (event: BridgefyUpdatedConnectedEvent) => void): {
|
|
110
|
-
remove: () => void;
|
|
111
|
-
};
|
|
112
|
-
onDisconnect(listener: (event: BridgefyDisconnectEvent) => void): {
|
|
113
|
-
remove: () => void;
|
|
114
|
-
};
|
|
115
|
-
onSendMessage(listener: (event: BridgefySendMessageEvent) => void): {
|
|
116
|
-
remove: () => void;
|
|
117
|
-
};
|
|
118
|
-
onSendDataProgress(listener: (event: BridgefyDidSendDataProgress) => void): {
|
|
119
|
-
remove: () => void;
|
|
120
|
-
};
|
|
121
|
-
onFailSendingMessage(listener: (error: BridgefyError & {
|
|
122
|
-
messageId: string;
|
|
123
|
-
}) => void): {
|
|
124
|
-
remove: () => void;
|
|
125
|
-
};
|
|
126
|
-
onReceiveData(listener: (event: BridgefyReceiveDataEvent) => void): {
|
|
127
|
-
remove: () => void;
|
|
128
|
-
};
|
|
129
|
-
onEstablishSecureConnection(listener: (event: BridgefySecureConnectionEvent) => void): {
|
|
130
|
-
remove: () => void;
|
|
131
|
-
};
|
|
132
|
-
onFailToEstablishSecureConnection(listener: (error: BridgefyError & {
|
|
133
|
-
userId: string;
|
|
134
|
-
}) => void): {
|
|
135
|
-
remove: () => void;
|
|
136
|
-
};
|
|
137
|
-
onUpdateLicense(listener: () => void): {
|
|
138
|
-
remove: () => void;
|
|
139
|
-
};
|
|
140
|
-
onFailToUpdateLicense(listener: (error: BridgefyError) => void): {
|
|
141
|
-
remove: () => void;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
declare const _default: Bridgefy;
|
|
145
|
-
export default _default;
|
|
146
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAA4B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,kBAAkB,CAAC;AAE1B;;;;;GAKG;AAGH,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,GACjC,CAAC;AAEF;;;GAGG;AACH,qBAAa,QAAQ;IACnB,OAAO,CA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