Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

Functions

Type aliases

OnError

OnError: function

Type declaration

    • (error: Error): any
    • Parameters

      • error: Error

      Returns any

OnResult

OnResult<Model>: function

Type parameters

  • Model

Type declaration

    • (doc: Doc<Model>[]): any
    • Parameters

      • doc: Doc<Model>[]

      Returns any

Functions

onGetMany

  • onGetMany<Model>(collection: Collection<Model>, ids: keyof string[], onResult: OnResult<Model>, onError?: OnError): function
  • Subscribes to multiple documents from a collection.

    import { onGetMany, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    onGetMany(contacts, [
      '07yQrsPK6ENtdEV3eaCE',
      '0qasibfFGVOQ4QYqUaQh',
      '11FrkclBWXo2BgnSsJNJ',
    ], fewContacts => {
      console.log(fewContacts.length)
      //=> 3
      console.log(fewContacts[0].ref.id)
      //=> '07yQrsPK6ENtdEV3eaCE'
      console.log(fewContacts[0].data)
      //=> { name: 'Sasha' }
    })

    Type parameters

    • Model

    Parameters

    Returns function

    Function that unsubscribes the listener from the updates

      • (): void
      • Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc