@twinfinity/core
    Preparing search index...

    Class LayerDefinition

    A Layer definition. Describes a layer and its permissions. To create a layer the corresponding layer definition must exist.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    id: string
    mask: bigint = permissionMask.none

    Permission bitmask. Since permissions are Uint64 bitmasks it must be represented as a bigint. Watch out for number type coercion if reading this property directly. While it is possible to use bitwise operations on the mask, to determine the permissions, it is better to use the provided methods such as hasAny and hasAll.

    notFound: Readonly<LayerDefinition> = ...

    Used to represent a layer definition that does not exist.

    Accessors

    • get exists(): boolean

      true if the layer definition exists, false otherwise.

      Returns boolean

    Methods

    • Checks if mask has all of the specified permissions.

      Parameters

      Returns boolean

      true if mask holds all of the specified permissions.

    • Checks if mask has any of the specified permissions.

      Parameters

      Returns boolean

      true if mask holds any of the specified permissions.

    • Converts the Permission object to a JSON representation.

      Returns string

      The JSON representation of the Permission object.

    • Converts to a human readable string.

      Returns string

      Human readable string.

    • Copies the permissions defined by permissions to the dst.permissions property.

      Type Parameters

      Parameters

      • permissions: Permission | Permissions | { json: string }

        Permission to copy to dst.permissions property.

      • dst: T

        Change to use.

      Returns T

      Reference to dst.

    • Create a Permissions instance from a permission mask represented as a bigint string. This is how permissions are represented in JSON as it is not possible to send 64bit integers in JSON.

      Parameters

      • permission: string

        If a real bigint string then it is converted to a Permissions instance. If it is a falsy returns a Permissions instance without any permissions. If it is a truthy but not a bigint string then a exception is generated.

      Returns Permissions

      Permissions instance.

    • Join one or more permissions into a single numeric permission mask. Permissions are bitwise OR:ed together.

      Parameters

      Returns bigint

      Numeric permission mask. Can be compared directly with mask. Can also be used in constructor of Permissions.

    • Converts a number of Permission instances into a human readable string.

      Parameters

      • ...permissions: Permission[]

        Permissions to convert.

      Returns string

      Human readable string.