Przeglądaj źródła

Couldn't check IModelDBFactory.ready on document creation, and it should
be handled by waiting for the IServiceManager to be ready.

Ian Rose 8 lat temu
rodzic
commit
51ae6dd11e

+ 0 - 19
packages/coreutils/src/modeldb.ts

@@ -268,25 +268,6 @@ interface IModelDB extends IDisposable {
   dispose(): void;
 }
 
-export
-interface IModelDBFactory {
-  /**
-   * The IModelDB backend may require some setup before
-   * it can be used (e.g., loading external APIs, authorization).
-   * This promise is resolved when the services are ready to
-   * be used.
-   */
-  ready: Promise<void>;
-
-  /**
-   * Create an IModelDB for use with a document or other
-   * model.
-   *
-   * @param path: a path that identifies the location of the
-   *   store in the backend.
-   */
-  createModelDB(path: string): IModelDB;
-}
 
 /**
  * A concrete implementation of an `IObservableValue`.

+ 4 - 4
packages/docmanager/src/manager.ts

@@ -34,7 +34,7 @@ import {
 } from '@jupyterlab/apputils';
 
 import {
-  IModelDBFactory
+  IModelDB
 } from '@jupyterlab/coreutils';
 
 import {
@@ -409,7 +409,7 @@ class DocumentManager implements IDisposable {
   private _contexts: Private.IContext[] = [];
   private _opener: DocumentManager.IWidgetOpener = null;
   private _activateRequested = new Signal<this, string>(this);
-  private _modelDBFactory: IModelDBFactory = null;
+  private _modelDBFactory: (path: string) => IModelDB = null;
 }
 
 
@@ -439,9 +439,9 @@ namespace DocumentManager {
     opener: IWidgetOpener;
 
     /**
-     * An `IModelDB backend factory`.
+     * An `IModelDB` backend factory method.
      */
-    modelDBFactory?: IModelDBFactory;
+    modelDBFactory?: (path: string) => IModelDB;
   }
 
   /**

+ 4 - 4
packages/docregistry/src/context.ts

@@ -26,7 +26,7 @@ import {
 } from '@jupyterlab/apputils';
 
 import {
-  PathExt, URLExt, IModelDB, IModelDBFactory
+  PathExt, URLExt, IModelDB
 } from '@jupyterlab/coreutils';
 
 import {
@@ -53,7 +53,7 @@ class Context<T extends DocumentRegistry.IModel> implements DocumentRegistry.ICo
     let lang = this._factory.preferredLanguage(ext);
 
     if(options.modelDBFactory) {
-      this._modelDB = options.modelDBFactory.createModelDB(this._path);
+      this._modelDB = options.modelDBFactory(this._path);
       this._model = this._factory.createNew(lang, this._modelDB);
     } else {
       this._model = this._factory.createNew(lang);
@@ -499,9 +499,9 @@ export namespace Context {
     kernelPreference?: IClientSession.IKernelPreference;
 
     /**
-     * An IModelDB factory which may be used for the document.
+     * An IModelDB factory method which may be used for the document.
      */
-    modelDBFactory?: IModelDBFactory;
+    modelDBFactory?: (path: string) => IModelDB;
 
     /**
      * An optional callback for opening sibling widgets.