本文整理匯總了TypeScript中@jupyterlab/coreutils.PageConfig.setOption方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript PageConfig.setOption方法的具體用法?TypeScript PageConfig.setOption怎麽用?TypeScript PageConfig.setOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/coreutils.PageConfig
的用法示例。
在下文中一共展示了PageConfig.setOption方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
activate: async (app: JupyterLab, router: IRouter) => {
const resolver = new WindowResolver();
const match = router.current.path.match(Patterns.workspace);
const workspace = (match && decodeURIComponent(match[1])) || '';
const candidate = workspace
? URLExt.join(
PageConfig.getOption('baseUrl'),
PageConfig.getOption('workspacesUrl'),
workspace
)
: app.info.defaultWorkspace;
try {
await resolver.resolve(candidate);
} catch (error) {
console.warn('Window resolution failed:', error);
// Return a promise that never resolves.
return new Promise<IWindowResolver>(() => {
Private.redirect(router);
});
}
PageConfig.setOption('workspace', resolver.name);
return resolver;
}
示例2: it
it('should add a new option', () => {
expect(PageConfig.setOption('bar', 'foo')).to.equal('');
});
示例3: after
after(() => {
PageConfig.setOption('notebookVersion', prevNotebookVersion);
});
示例4: before
before(() => {
prevNotebookVersion = PageConfig.setOption(
'notebookVersion',
JSON.stringify([5, 1, 0])
);
});
示例5:
.then(() => {
PageConfig.setOption('workspace', resolver.name);
return resolver;
});