Functions
init(config)
Initialize the Toffee SDK. Returns a ToffeeInstance.
| Name | Type | Description |
|---|---|---|
config | ToffeeConfig | Configuration object |
ToffeeInstance
toffee.identify(properties)
Attach custom properties to the current session. Useful for associating detection data with your own user records.
| Name | Type | Description |
|---|---|---|
properties | Record<string, string> | Key-value pairs to attach to the session |
toffee.getDetection()
Get the current detection result. Returns null if detection hasn’t run yet.
DetectionOutput | null
toffee.destroy()
Tear down the SDK. Flushes pending events, removes event listeners, and cleans up timers.
useEffect return, Vue onUnmounted).
identify(properties)
Module-level convenience function. Works the same as toffee.identify() but uses the most recently created instance.
getDetection()
Module-level convenience function. Works the same as toffee.getDetection().