Javascript SDKs for Hackle
    Preparing search index...

    Interface BrowserHackleClient

    interface BrowserHackleClient {
        getExperiment(experimentKey: number): HackleExperiment;
        onReady(block: () => void, timeout?: number): void;
        onInitialized(config?: { timeout?: number }): Promise<{ success: boolean }>;
        close(): void;
        getSessionId(): string;
        getUser(): User;
        setUser(user: User): Promise<void>;
        setUserId(userId: string | number): Promise<void>;
        setDeviceId(deviceId: string): Promise<void>;
        setUserProperty(key: string, value: any): Promise<void>;
        setUserProperties(properties: Properties): Promise<void>;
        updateUserProperties(operations: PropertyOperations): Promise<void>;
        updatePushSubscriptions(
            operations: HackleSubscriptionOperations,
        ): Promise<void>;
        updateSmsSubscriptions(
            operations: HackleSubscriptionOperations,
        ): Promise<void>;
        updateKakaoSubscriptions(
            operations: HackleSubscriptionOperations,
        ): Promise<void>;
        resetUser(): Promise<void>;
        setPhoneNumber(phoneNumber: string): Promise<void>;
        unsetPhoneNumber(): Promise<void>;
        variation(
            experimentKey: number,
            user?: string | User,
            defaultVariation?: string,
        ): string;
        variationDetail(
            experimentKey: number,
            user?: string | User,
            defaultVariation?: string,
        ): Decision;
        isFeatureOn(featureKey: number, user?: string | User): boolean;
        featureFlagDetail(
            featureKey: number,
            user?: string | User,
        ): FeatureFlagDecision;
        track(event: string | HackleEvent<string>, user?: string | User): void;
        trackPageView(option?: PageView): void;
        setCurrentPage(page: HacklePage): void;
        remoteConfig(user?: string | User): HackleRemoteConfig;
        showUserExplorer(): void;
        hideUserExplorer(): void;
        fetch(): Promise<void>;
        setInAppMessageListener(listener: HackleInAppMessageListener): void;
        getDisplayedInAppMessageView(): HackleInAppMessageView;
    }

    Hierarchy

    • default
      • BrowserHackleClient

    Implemented by

    Index

    Methods

    • Parameters

      • experimentKey: number

      Returns HackleExperiment

    • Parameters

      • block: () => void

        callback function.

      • Optionaltimeout: number

      Returns void

      use onInitialized instead.

    • Parameters

      • Optionalconfig: { timeout?: number }

      Returns Promise<{ success: boolean }>

    • Returns void

    • Returns current session ID

      Returns string

      if session is unavailable, returns 0.ffffffff

      11.8.0

    • Returns User

    • Parameters

      • user: User

      Returns Promise<void>

    • Parameters

      • userId: string | number

      Returns Promise<void>

    • Parameters

      • deviceId: string

      Returns Promise<void>

    • Parameters

      • key: string
      • value: any

      Returns Promise<void>

    • Parameters

      • properties: Properties

      Returns Promise<void>

    • Updates the user's properties.

      Parameters

      • operations: PropertyOperations

        Property operations to update user properties.

      Returns Promise<void>

    • Updates the user's push subscriptions.

      Parameters

      • operations: HackleSubscriptionOperations

        Push subscription operations to update user properties.

      Returns Promise<void>

    • Updates the user's SMS subscriptions.

      Parameters

      • operations: HackleSubscriptionOperations

        SMS subscription operations to update user properties.

      Returns Promise<void>

    • Updates the user's Kakao subscriptions.

      Parameters

      • operations: HackleSubscriptionOperations

        Kakao subscription operations to update user properties.

      Returns Promise<void>

    • Returns Promise<void>

    • Set user's phone number. Existing value will be replaced by new value if you call this method multiple times.

      Parameters

      • phoneNumber: string

        String satisfying valid E.164 format is accepted.

      Returns Promise<void>

    • Reset user's phone number to be an empty value.

      Returns Promise<void>

    • Determine the variation to expose to the user for experiment.

      This method return the {"A"} if:

      • The experiment key is invalid
      • The experiment has not started yet
      • The user is not allocated to the experiment
      • The determined variation has been dropped

      Parameters

      • experimentKey: number

        the unique key of the experiment.

      • Optionaluser: string | User

        the user to participate in the experiment. MUST NOT be null.

      • OptionaldefaultVariation: string

        the default variation of the experiment.

      Returns string

      string the decided variation for the user, or the default variation.

    • Determine the variation to expose to the user for experiment, and returns an object that describes the way the variation was determined.

      Parameters

      • experimentKey: number

        the unique key of the experiment.

      • Optionaluser: string | User

        the user to participate in the experiment. MUST NOT be null. (e.g. { id: "userId"} )

      • OptionaldefaultVariation: string

        the default variation of the experiment. MUST NOT be null.

      Returns Decision

      object

    • Determine whether the feature is turned on to the user.

      Parameters

      • featureKey: number

        the unique key for the feature.

      • Optionaluser: string | User

        the user requesting the feature.

      Returns boolean

      boolean True if the feature is on. False if the feature is off.

      2.0.0

    • Determine whether the feature is turned on to the user, and returns an object that describes the way the value was determined.

      Parameters

      • featureKey: number

        the unique key for the feature.

      • Optionaluser: string | User

        the identifier of user.

      Returns FeatureFlagDecision

      2.0.0

    • Records the event performed by the user.

      Parameters

      • event: string | HackleEvent<string>

        the unique key of the event. MUST NOT be null.

      • Optionaluser: string | User

        the identifier of user that performed the event. id MUST NOT be null. (e.g. { id: "userId"} )

      Returns void

    • Parameters

      Returns void

      trackPageView is deprecated and do nothing.

      Use the setCurrentPage method to track the page view.

    • Tracking the page manually This method always triggers page events regardless of whether the page has changed

      Parameters

      • page: HacklePage

      Returns void

    • Return a instance of Hackle Remote Config.

      Parameters

      • Optionaluser: string | User

        the identifier of user.

      Returns HackleRemoteConfig

    • Show User Explorer.

      Returns void

    • Hide User Explorer.

      Returns void

    • Fetch dashboard config data.

      Returns Promise<void>

    • Set InAppMessage listener.

      Parameters

      • listener: HackleInAppMessageListener

        The listener to be set.

      Returns void

    • Get displayed InAppMessage view.

      Returns HackleInAppMessageView

      if there is no displayed InAppMessage, return null.