Ver código fonte

Reconcile notebook plugin to new pattern.

Afshin Darian 8 anos atrás
pai
commit
733ce23c39
1 arquivos alterados com 6 adições e 5 exclusões
  1. 6 5
      src/notebook/plugin.ts

+ 6 - 5
src/notebook/plugin.ts

@@ -192,22 +192,23 @@ function activateNotebookHandler(app: JupyterLab, registry: IDocumentRegistry, s
     tracker.add(widget);
     // Add the notebook path to the state database.
     let key = `${NAMESPACE}:${widget.context.path}`;
-    state.save(key, widget.context.path);
+    state.save(key, { path: widget.context.path });
     // Remove the notebook path from the state database on disposal.
     widget.disposed.connect(() => { state.remove(key); });
     // Keep track of path changes in the state database.
     widget.context.pathChanged.connect((sender, path) => {
       state.remove(key);
       key = `${NAMESPACE}:${path}`;
-      state.save(key, path);
+      state.save(key, { path });
     });
   });
 
   // Reload any notebooks whose state has been stored.
-  Promise.all([state.fetchNamespace(NAMESPACE), app.started])
-    .then(([paths]) => {
+  Promise.all([state.fetchNamespace(NAMESPACE), app.started, services.ready()])
+    .then(([coll]) => {
+      let { values } = coll;
       let open = 'file-operations:open';
-      paths.forEach(path => { app.commands.execute(open, { path }); });
+      values.forEach(args => { app.commands.execute(open, args); });
     });
 
   // Add main menu notebook menu.