fake-permissions
    Preparing search index...

    Interface PermissionStoreParameters

    Parameters for creating a permission store.

    createPermissionStore to create a permission store.

    interface PermissionStoreParameters {
        dialogDefaultRemember?: boolean;
        dismissDenyThreshold?: number;
        initialStates?: Map<
            PermissionDescriptor,
            PermissionAccessStatus
            | PermissionAccessState,
        >;
        isMatchingDescriptor?: (
            a: PermissionDescriptor,
            b: PermissionDescriptor,
        ) => boolean;
        masks?: Map<PermissionDescriptor, Partial<PermissionMask>>;
    }
    Index

    Properties

    dialogDefaultRemember?: boolean

    Whether access request dialogs should remember the user's choice by default.

    false

    dismissDenyThreshold?: number

    The number of times an access request can be dismissed before the permission is automatically blocked.

    3

    initialStates?: Map<
        PermissionDescriptor,
        PermissionAccessStatus
        | PermissionAccessState,
    >

    The initial states of permissions in the store, as a map of permission descriptors to their initial access state.

    As well as setting the initial access states, this also defines the set of permissions that are known to the permission store.

    States can be specified in full by using PermissionAccessState objects, or alternatively a PermissionAccessStatus string can be used, in which case dismissCount will initialize to 0.

    The result of calling buildInitialPermissionStates.

    isMatchingDescriptor?: (
        a: PermissionDescriptor,
        b: PermissionDescriptor,
    ) => boolean

    A custom function to determine whether two permission descriptors match.

    Type declaration

    isMatchingDescriptor

    Permission masks to apply when mapping PermissionAccessStatus values to PermissionState values for various permissions.

    Internally, this library stores more granular statuses for permissions than what is exposed via the W3C Permissions API. This mapping defines how the internal PermissionAccessStatus values are exposed via the fake Permissions API's PermissionState values.

    For example, some browsers support allowing one-time access to a permission. This usually results in the PermissionState remaining as "prompt" even after access has been allowed or denied. In order to emulate this behavior, the default behavior of this library is to use a mask that maps both "ALLOWED" and "DENIED" to "prompt".

    If no explicit mappings are provided, the default mapping is:

    PermissionAccessStatus PermissionState
    "PROMPT" "prompt"
    "GRANTED" "granted"
    "BLOCKED" "denied"
    "BLOCKED_AUTOMATICALLY" "denied"
    "ALLOWED" "prompt"
    "DENIED" "prompt"