Skip to main content

Functions

init(config)

Initialize the Toffee SDK. Returns a ToffeeInstance.
Parameters: Returns: ToffeeInstance

toffee.identify(properties)

Attach custom properties to the current session. Useful for associating detection data with your own user records.
Parameters:

toffee.getDetection()

Get the current detection result. Returns null if detection hasn’t run yet.
Returns: DetectionOutput | null

toffee.destroy()

Tear down the SDK. Flushes pending events, removes event listeners, and cleans up timers.
Always call this in cleanup (e.g., React 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().

Types

ToffeeConfig

ToffeeInstance

DetectionOutput

RiskTier

ModelClassification

DetectorResult