Typed Emitter from: https://github.com/binier/tiny-typed-emitter/

MIT License Copyright (c) 2020 Zurab Benashvili (binier) zura.bena@gmail.com

Hierarchy (view full)

Constructors

Properties

agent: Agent<any>
canSend: boolean
collections: Record<string, Record<string, Doc<any>>>
debug: boolean
id: string
nextQueryId: number
nextSnapshotRequestId: number
queries: Record<string, Query<any>>
seq: number
state: string
defaultMaxListeners: number

Methods

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Returns void

  • Type Parameters

    • T = any

    Parameters

    • collectionName: string
    • query: any
    • Optionaloptions: Object
    • Optionalcallback: Object

    Returns Query<T>

  • Type Parameters

    • T = any

    Parameters

    • collectionName: string
    • query: any
    • Optionaloptions: Object
    • Optionalcallback: Object

    Returns Query<T>

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns boolean

  • Returns (
        | "error"
        | ConnectionState
        | "receive"
        | "doc"
        | "send"
        | "connection error"
        | "pong"
        | "state")[]

  • Parameters

    • collection: string
    • id: string
    • version: number
    • callback: Object

    Returns void

  • Parameters

    • collection: string
    • id: string
    • timestamp: number
    • callback: Object

    Returns void

  • Parameters

    • collectionName: string
    • documentID: string

    Returns Doc<any>

  • Parameters

    • collection: string
    • id: string

    Returns Presence<any>

  • Returns number

  • Parameters

    • channel: string

    Returns Presence<any>

  • Returns whether anything in this client is either:

    • In-flight, waiting on a response from the server
    • Pending (locally queued)

    Returns boolean

  • Parameters

    • type:
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Returns number

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Returns void

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Parameters

    • Optionalevent:
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Returns this

  • Type Parameters

    • U extends
          | "error"
          | ConnectionState
          | "receive"
          | "doc"
          | "send"
          | "connection error"
          | "pong"
          | "state"

    Parameters

    Returns this

  • Manually send a JSON-serializable message to the server.

    WARNING - This is mostly for internal use within sharedb.

    Prefer to use methods like Doc#submitOp, Doc#subscribe, Connection#createFetchQuery, etc., which will manage the necessary message exchanges.

    Parameters

    • message: Record<string, unknown>

    Returns void

  • Parameters

    • n: number

    Returns this

  • Invokes the callback once nothing on this client is in-flight or pending.

    Parameters

    • callback: Object

    Returns void

    hasPending