本文整理汇总了TypeScript中@jupyterlab/application.IRouter.reload方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IRouter.reload方法的具体用法?TypeScript IRouter.reload怎么用?TypeScript IRouter.reload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/application.IRouter
的用法示例。
在下文中一共展示了IRouter.reload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
execute: async () => {
const global = true;
try {
await commands.execute(CommandIDs.recoverState, { global });
} catch (error) {
/* Ignore failures and redirect. */
}
router.reload();
}
示例2: DisposableDelegate
execute: (args: IRouter.ILocation) => {
const { hash, path, search } = args;
const query = URLExt.queryStringToObject(search || '');
const reset = 'reset' in query;
const clone = 'clone' in query;
if (!reset) {
return;
}
// If a splash provider exists, launch the splash screen.
const loading = splash
? splash.show()
: new DisposableDelegate(() => undefined);
// If the state database has already been resolved, resetting is
// impossible without reloading.
if (resolved) {
return router.reload();
}
// Empty the state database.
resolved = true;
transform.resolve({ type: 'clear', contents: null });
// Maintain the query string parameters but remove `reset`.
delete query['reset'];
const silent = true;
const hard = true;
const url = path + URLExt.objectToQueryString(query) + hash;
const cleared = commands
.execute(CommandIDs.recoverState)
.then(() => router.stop); // Stop routing before new route navigation.
// After the state has been reset, navigate to the URL.
if (clone) {
void cleared.then(() => {
router.navigate(url, { silent, hard });
});
} else {
void cleared.then(() => {
router.navigate(url, { silent });
loading.dispose();
});
}
return cleared;
}