• Set a conflict handler that will be used to resolve conflicts that may emerge when matching events with synced messages.

    Parameters

    Returns void

    Remark

    The conflict handler is not persisted across app restarts and so must be set again before dispatching an event for any custom handling to take effect.

    Throws

    validation: InAppMessagingValidationErrorCode - Thrown when the provided parameters or library configuration is incorrect, or if In App messaging hasn't been initialized.

    Example

    // Sync messages before dispatching an event
    await syncMessages();

    // Example custom conflict handler
    const myConflictHandler = (messages) => {
    // Return a random message
    const randomIndex = Math.floor(Math.random() * messages.length);
    return messages[randomIndex];
    };

    // Set the conflict handler
    setConflictHandler(myConflictHandler);

    // Dispatch an event
    await dispatchEvent({ name: 'test_event' });