From 13e98f152f79ce173db05686222b153da8d1cd79 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Thu, 15 Feb 2024 11:06:00 +0100 Subject: [PATCH] Add YDocument.providers attribute --- javascript/src/ydocument.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/javascript/src/ydocument.ts b/javascript/src/ydocument.ts index c923c12..576d184 100644 --- a/javascript/src/ydocument.ts +++ b/javascript/src/ydocument.ts @@ -4,11 +4,22 @@ |----------------------------------------------------------------------------*/ import { JSONExt, JSONObject, JSONValue } from '@lumino/coreutils'; +import { IDisposable } from '@lumino/disposable'; import { ISignal, Signal } from '@lumino/signaling'; import { Awareness } from 'y-protocols/awareness'; import * as Y from 'yjs'; import type { DocumentChange, ISharedDocument, StateChange } from './api.js'; +/** + * An interface for a document provider. + */ +export interface IDocumentProvider extends IDisposable { + /** + * Returns a Promise that resolves when the document provider is ready. + */ + readonly ready: Promise; +} + /** * Generic shareable document. */ @@ -200,6 +211,7 @@ export abstract class YDocument private _awareness: Awareness; private _isDisposed = false; private _disposed = new Signal(this); + providers: IDocumentProvider[] = []; } /**