API Reference
Detailed reference for all exported APIs, including the Singleton, Hook, and Provider.
Singleton API: DeepLinkManager
The core singleton instance for managing deep links throughout your application. Access it via DeepLinkManager.getInstance()
.
Method | Description |
---|---|
getInstance() | Returns the singleton instance. |
init(config) | Initializes the manager with apiKey and optional debug flag. Must be called first. |
addUrlListener(cb) | Subscribes to URL changes. The callback receives url and data . Returns an unsubscribe function. |
removeAllListeners() | Removes all registered listeners. |
getInitialUrl() | Returns and consumes the first link that launched the app. |
getCurrentUrl() | Returns the most recent deep link without consuming it. |
setLogging(enabled) | Enables or disables debug logging. |
destroy() | Resets internal state (mainly for testing). |
Hook API: useDeepLink
A React hook for handling deep links within functional components. It automatically manages the subscription lifecycle.
typescript
useDeepLink(callback: (url: string | null, data: UrlSchemeMetaData) => void): void
Parameter | Type | Description |
---|---|---|
callback | (url, data) => void | A function that is called every time a new deep link is received. It receives the URL string and metadata. |
Provider API: DeepLinkProvider
A React component to wrap your app and handle deep links globally.
Prop | Type | Description |
---|---|---|
onLink | (url, data) => void | Callback for every deep link event. |
enableLogging | boolean | Enables or disables debug logging globally. |
children | React.ReactNode | Your app's component tree. |
Type Definitions
Core TypeScript types used throughout the SDK.
typescript
export type UrlCallback = (
url: string | null,
data?: UrlSchemeMetaData
) => void;
export type Unsubscribe = () => void;
export interface DeepLinkManagerConfig {
apiKey: string;
debug?: boolean;
}
export interface UrlSchemeMetaData {
[x: string]: any;
}