Class AlpineComponentAbstract

Light-weight interface for class based components.

Provides property declarations for Alpine magics that will exist when used as an Alpine component.

Property declarations copied from @types/alpinejs.

https://www.npmjs.com/package/@types/alpinejs

Hierarchy

  • AlpineComponent

Implements

Constructors

Properties

Methods

Constructors

Properties

Access to current Alpine data.

$dispatch: ((event, data?) => void)

Type declaration

    • (event, data?): void
    • Dispatch browser events.

      Parameters

      • event: string

        the event name

      • Optional data: any

        an event-dependent value associated with the event, the value is then available to the handler using the CustomEvent.detail property

      Returns void

$el: HTMLElement

Retrieve the current DOM node.

$id: ((name, key?) => string)

Type declaration

    • (name, key?): string
    • Generate an element's ID and ensure that it won't conflict with other IDs of the same name on the same page.

      Parameters

      • name: string

        the name of the id

      • Optional key: string | number

        suffix on the end of the generated ID, usually helpful for the purpose of identifying id in a loop

      Returns string

$nextTick: ((callback?) => Promise<void>)

Type declaration

    • (callback?): Promise<void>
    • Execute a given expression AFTER Alpine has made its reactive DOM updates.

      Parameters

      • Optional callback: (() => void)

        a callback that will be fired after Alpine finishes updating the DOM

          • (): void
          • Returns void

      Returns Promise<void>

$refs: Record<string, HTMLElement>

Retrieve DOM elements marked with x-ref inside the component.

$store: AlpineData

Access registered global Alpine stores.

$watch: (<K, V>(property, callback) => void)

Type declaration

    • <K, V>(property, callback): void
    • Fire the given callback when the value in the property is changed.

      Type Parameters

      • K extends string

      • V extends any

      Parameters

      • property: K

        the component property

      • callback: ((newValue, oldValue) => void)

        a callback that will fire when a given property is changed

          • (newValue, oldValue): void
          • Parameters

            • newValue: V
            • oldValue: V

            Returns void

      Returns void

Methods

Generated using TypeDoc v0.25.1