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" | "state" | ConnectionState | "connection error" | "doc" | "pong" | "receive" | "send"

    Parameters

    Returns this

  • Returns void

  • Type Parameters

    • T = any

    Parameters

    • collectionName: string
    • query: any
    • Optional options: Object
    • Optional callback: Object

    Returns Query<T>

  • Type Parameters

    • T = any

    Parameters

    • collectionName: string
    • query: any
    • Optional options: Object
    • Optional callback: Object

    Returns Query<T>

  • Type Parameters

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

    Parameters

    Returns boolean

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

  • 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" | "state" | ConnectionState | "connection error" | "doc" | "pong" | "receive" | "send"

    Returns number

  • Type Parameters

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

    Parameters

    Returns this

  • Type Parameters

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

    Parameters

    Returns this

  • Type Parameters

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

    Parameters

    Returns this

  • Returns void

  • Type Parameters

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

    Parameters

    Returns this

  • Parameters

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

    Returns this

  • Type Parameters

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

    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

    See

    hasPending