Skip to content

Commit

Permalink
Merge pull request #1993 from vidartf/resolveurl
Browse files Browse the repository at this point in the history
Add utility function resolveUrl on manager
  • Loading branch information
jasongrout authored Mar 16, 2018
2 parents 8196606 + 31ad38f commit 45f2c3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/base/src/manager-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,16 @@ abstract class ManagerBase<T> {
this._models[i].then(model => { model.comm_live = false; });
});
}

/**
* Resolve a URL relative to the current notebook location.
*
* The default implementation just returns the original url.
*/
resolveUrl(url: string): Promise<string> {
return Promise.resolve(url);
}

/**
* The comm target name to register
*/
Expand Down
7 changes: 7 additions & 0 deletions packages/jupyterlab-manager/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ class WidgetManager extends ManagerBase<Widget> implements IDisposable {
this._context = null;
}

/**
* Resolve a URL relative to the current notebook location.
*/
resolveUrl(url: string): Promise<string> {
return this.context.resolveUrl(url);
}

/**
* Load a class and return a promise to the loaded object.
*/
Expand Down

0 comments on commit 45f2c3b

Please sign in to comment.