phoenix_live_view
    Preparing search index...

    Class LiveSocket

    Index
    • Creates a new LiveSocket instance.

      Parameters

      • url: string

        The WebSocket endpoint URL, e.g., "wss://example.com/live", or "/live" to inherit the host and protocol.

      • phxSocket: typeof Socket

        The required Phoenix Socket class imported from "phoenix". For example:

        import {Socket} from "phoenix"
        import {LiveSocket} from "phoenix_live_view"
        let liveSocket = new LiveSocket("/live", Socket, {...})
      • opts: Partial<LiveSocketOptions> = {}

        Optional configuration.

      Returns LiveSocket

    buffers: Readonly<
        {
            RenderingBuffer: typeof RenderingBuffer;
            ReportingBuffer: typeof ReportingBuffer;
        },
    > = BUFFERS

    The buffer base classes, for tooling holding only a LiveSocket handle: they are not otherwise reachable from a page it did not bundle.

    currentHistoryPosition: number
    disconnectedTimeout: number
    domCallbacks: {
        jsQuerySelectorAll: (
            sourceEl: HTMLElement,
            query: string,
            defaultQuery: () => Element[],
        ) => Element[];
        onBeforeElUpdated: (fromEl: Element, toEl: Element) => void;
        onDocumentPatch?: (start: () => void) => void;
        onNodeAdded: (node: Node) => void;
        onPatchEnd: (container: HTMLElement) => void;
        onPatchStart: (container: HTMLElement) => void;
    }
    loaderTimeout: number
    localStorage: Storage
    main: default
    params: (el: Element) => Record<string, unknown>
    RenderingBuffer: typeof RenderingBuffer
    socket: Socket
    unloaded: boolean = false
    uploaders: any
    • Internal

      Parameters

      • promise: any

      Returns void

    • Internal

      Installs a rendered buffer: what the renderer writes rendered HTML through.

      A buffer can observe or annotate the output — for example to mark which HEEx function components re-rendered, for a debugging overlay. See RenderingBuffer for the protocol a buffer implements.

      It applies to views that are already mounted as well as to views that join later, and nothing is re-rendered to install it: it sees each part of the page the next time a patch renders that part, so a buffer that annotates the output leaves whatever is already in the DOM untouched until then.

      const previous = liveSocket.attachDebugBuffer(MyBuffer)
      

      Parameters

      Returns typeof RenderingBuffer

      The class installed until now, to restore it with.

    • Internal

      Type Parameters

      • E extends Record<string, keyof HTMLElementEventMap>

      Parameters

      • events: E
      • callback: (
            e: HTMLElementEventMap[E[keyof E]],
            type: keyof E & string,
            view: default,
            targetEl: Element,
            phxEvent: string,
            phxTarget: "window",
        ) => void

      Returns void

    • Internal

      Returns void

    • Internal

      Returns void

    • Internal

      Returns void

    • Internal

      Parameters

      • kind: any

      Returns string

    • Internal

      Returns void

    • Internal

      Parameters

      • __namedParameters: { dead?: boolean } = {}

      Returns void

    • Internal

      Returns void

    • Internal

      Parameters

      • topic: any
      • params: any

      Returns Channel

    • Internal

      Parameters

      • linkRef: any

      Returns boolean

    • Connects to the LiveView server.

      Returns void

    • Internal

      Parameters

      • el: any
      • event: any
      • eventType: any
      • callback: any

      Returns any

    • Internal

      Returns void

    • Internal

      Parameters

      • el: any

      Returns void

    • Disables debugging.

      Returns void

    • Disables latency simulation.

      Returns void

    • Disables profiling.

      Returns void

    • Disconnects from the LiveView server.

      Parameters

      • Optionalcallback: () => void

      Returns void

    • Internal

      Parameters

      • detail: any

      Returns any

    • Internal

      Parameters

      • e: any
      • clickStartedAt: any

      Returns void

    • Internal

      Parameters

      • event: any
      • payload: {} = {}

      Returns void

    • Internal

      Parameters

      • events: any

      Returns void

    • Internal

      Parameters

      • view: any

      Returns void

    • Enables debugging.

      When debugging is enabled, the LiveView client will log debug information to the console. See Debugging client events for more information.

      Returns void

    • Enables latency simulation.

      When latency simulation is enabled, the LiveView client will add a delay to requests and responses from the server. See Simulating Latency for more information.

      Parameters

      • upperBoundMs: number

      Returns void

    • Enables profiling.

      When profiling is enabled, the LiveView client will log profiling information to the console.

      Returns void

    • Internal

      Parameters

      • eventName: any
      • e: any
      • targetEl: any

      Returns any

    • Executes an encoded JS command, targeting the given element.

      See Phoenix.LiveView.JS for more information.

      Parameters

      • el: Element
      • encodedJS: EncodedJS
      • eventType: string = null

      Returns void

    • Internal

      Returns Element

    • Internal

      Returns string

    • Internal

      Parameters

      • name: any

      Returns any

    • Internal

      Returns string

    • Returns the current latency simulation upper bound.

      Returns number

    • Internal

      Parameters

      • id: any

      Returns default

    • Returns the Phoenix Socket instance.

      Returns Socket

    • Internal

      Parameters

      • el: any

      Returns any

    • Internal

      Returns boolean

    • Internal

      Parameters

      • href: any
      • linkState: any
      • linkRef: number = ...

      Returns void

    • Internal

      Parameters

      • e: Event
      • href: string
      • linkState: "replace" | "push"
      • flash: string
      • OptionaltargetEl: Element

      Returns void

    • Internal

      Returns boolean

    • Returns true if debugging is disabled. See enableDebug and disableDebug.

      Returns boolean

    • Returns true if debugging is enabled. See enableDebug and disableDebug.

      Returns boolean

    • Internal

      Parameters

      • newLocation: any

      Returns boolean

    • Internal

      Parameters

      • el: any

      Returns boolean

    • Internal

      Returns boolean

    • Internal

      Returns void

    • Internal

      Returns boolean

    • Internal

      Parameters

      • sourceEl: any
      • query: any
      • defaultQuery: any

      Returns any

    • Internal

      Parameters

      • name: any

      Returns Hook<any, any>

    • Internal

      Parameters

      • name: any

      Returns any

    • Internal

      Parameters

      • scroll: any

      Returns void

    • Internal

      Parameters

      • el: any
      • Optionalflash: any
      • OptionalliveReferer: any

      Returns default

    • Internal

      Type Parameters

      • K extends string

      Parameters

      • event: K
      • callback: (
            e: K extends keyof HTMLElementEventMap
                ? HTMLElementEventMap[K]
                : CustomEvent<any>,
        ) => void

      Returns void

    • Internal

      Parameters

      • channel: any
      • event: any
      • cb: any

      Returns void

    • Internal

      Parameters

      • childEl: Element
      • Optionalcallback: (view: default) => any

      Returns any

    • Internal

      Parameters

      • e: any
      • href: any
      • linkState: any
      • targetEl: any

      Returns void

    • Internal

      Parameters

      • to: string
      • flash: string
      • reloadToken: string

      Returns void

    • Internal

      Parameters

      • newLocation: any

      Returns boolean

    • Internal

      Parameters

      • view: any
      • Optionallog: any

      Returns void

    • Internal

      Parameters

      • href: string
      • flash: string
      • callback: (linkRef: number) => void = null
      • linkRef: number = ...

      Returns void

    • Can be used to replace the transport used by the underlying Phoenix Socket.

      Parameters

      • transport: any

      Returns void

    • Internal

      Parameters

      • callback: any

      Returns void

    • Internal

      anytime we are navigating or connecting, drop reload cookie in case we issue the cookie but the next request was interrupted and the server never dropped it

      Returns void

    • Internal

      Returns void

    • Internal

      Parameters

      • href: any

      Returns number

    • Internal

      Parameters

      • callback: any

      Returns void

    • Internal

      Parameters

      • name: any
      • func: any

      Returns any

    • Internal

      Parameters

      • time: any
      • onStart: any
      • onDone: () => void = ...

      Returns void

    • Internal

      Parameters

      • elements: any
      • view: default
      • Optionalcallback: any

      Returns void

    • Internal

      Parameters

      • kind: any
      • args: any

      Returns void

    • Internal

      Returns void

    • Returns the version of the LiveView client.

      Returns string

    • Internal

      Parameters

      • childEl: any
      • callback: (view: default, targetCtx: Element) => unknown

      Returns void

    • Internal

      Parameters

      • info: any
      • Optionalcallback: any

      Returns any