Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
class Visitor
implements IVisitor
extends EventEmitter
import { Visitor } from "https://deno.land/x/flagship_io_js_sdk@4.0.1/visitor/index.ts";

The Visitor class represents a unique user within your application. It aids in managing the visitor's data and fetching the corresponding flags for the visitor from the Flagship platform .

Constructors

new
Visitor(visitorDelegate: VisitorAbstract)

Properties

private
visitorDelegate: VisitorAbstract
readonly
anonymousId: string | null
readonly
config: IFlagshipConfig
readonly
context: Record<string, primitive>
readonly
fetchStatus
readonly
hasConsented: boolean
visitorId: string

Methods

authenticate(visitorId: string): void
clearContext(): void
fetchFlags(): Promise<void>
getFlag(key: string): IFSFlag
getFlags(): IFSFlagCollection
sendHit(hit: HitAbstract): Promise<void>
sendHit(hit: IHit): Promise<void>
sendHit(hit: IHit | HitAbstract): Promise<void>
sendHits(hits: HitAbstract[]): Promise<void>
sendHits(hits: IHit[]): Promise<void>
sendHits(hits: HitAbstract[] | IHit[]): Promise<void>
setConsent(hasConsented: boolean): void
updateContext(key: string, value: primitive): void
updateContext(context: Record<string, primitive>): void