Prechádzať zdrojové kódy

async await SearchInstance

Andrew Schlaepfer 6 rokov pred
rodič
commit
53aea0f859

+ 1 - 0
packages/documentsearch-extension/package.json

@@ -35,6 +35,7 @@
     "@jupyterlab/codemirror": "^0.19.1",
     "@jupyterlab/docregistry": "^0.19.1",
     "@jupyterlab/notebook": "^0.19.2",
+    "@phosphor/disposable": "^1.1.2",
     "@phosphor/messaging": "^1.2.2",
     "@phosphor/signaling": "^1.2.2",
     "@phosphor/widgets": "^1.6.0",

+ 6 - 6
packages/documentsearch-extension/src/searchinstance.ts

@@ -116,20 +116,20 @@ export class SearchInstance implements IDisposable {
     return this._isDisposed;
   }
 
-  private _highlightNext() {
+  private async _highlightNext() {
     if (!this._displayState.query) {
       return;
     }
-    this._activeProvider.highlightNext().then(this.updateIndices.bind(this));
+    await this._activeProvider.highlightNext();
+    this.updateIndices();
   }
 
-  private _highlightPrevious() {
+  private async _highlightPrevious() {
     if (!this._displayState.query) {
       return;
     }
-    this._activeProvider
-      .highlightPrevious()
-      .then(this.updateIndices.bind(this));
+    await this._activeProvider.highlightPrevious();
+    this.updateIndices();
   }
 
   private _onCaseSensitiveToggled = () => {