types/Sharedb - add an optional agent parameter to the client connection (#41955)

* add an optional agent to the client sharedb connection

* remove myself as a contributor, set agent to be agent or null

* add docs
This commit is contained in:
Eve Shum
2020-01-30 13:06:41 -08:00
committed by GitHub
parent cca9809877
commit 8123af1bee
+6
View File
@@ -1,9 +1,15 @@
/// <reference path="sharedb.d.ts" />
import * as WS from 'ws';
import * as ShareDB from './sharedb';
import Agent = require('./agent');
export class Connection {
constructor(ws: WebSocket | WS);
// This direct reference from connection to agent is not used internal to
// ShareDB, but it is handy for server-side only user code that may cache
// state on the agent and read it in middleware
agent: Agent | null;
get(collectionName: string, documentID: string): Doc;
createFetchQuery(collectionName: string, query: any, options: {results?: Query[]}, callback: (err: Error, results: any[]) => void): Query;
createSubscribeQuery(collectionName: string, query: any, options: {results?: Query[]}, callback: (err: Error, results: any[]) => void): Query;