Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
activate: (app: JupyterLab) => {
const { commands } = app;
const base = PageConfig.getOption('pageUrl');
const router = new Router({ base, commands });
commands.addCommand(CommandIDs.tree, {
execute: (args: IRouter.ILocation) => {
const path = decodeURIComponent((args.path.match(Patterns.tree)[1]));
// File browser navigation waits for the application to be restored.
// As a result, this command cannot return a promise because it would
// create a circular dependency on the restored promise that would
// cause the application to never restore.
const opened = commands.execute('filebrowser:navigate-main', { path });
// Change the URL back to the base application URL without adding the
// URL change to the browser history.
opened.then(() => { router.navigate('', { silent: true }); });
}
});
activate: (app: JupyterFrontEnd, paths: JupyterFrontEnd.IPaths) => {
const { commands } = app;
const base = paths.urls.base;
const router = new Router({ base, commands });
app.started.then(() => {
// Route the very first request on load.
router.route();
// Route all pop state events.
window.addEventListener('popstate', () => {
router.route();
});
});
return router;
},
autoStart: true,
activate: (app: JupyterLab) => {
const { commands } = app;
const base = PageConfig.getOption('pageUrl');
const router = new Router({ base, commands });
commands.addCommand(CommandIDs.tree, {
execute: (args: IRouter.ILocation) => {
const path = decodeURIComponent((args.path.match(Patterns.tree)[1]));
// File browser navigation waits for the application to be restored.
// As a result, this command cannot return a promise because it would
// create a circular dependency on the restored promise that would
// cause the application to never restore.
const opened = commands.execute('filebrowser:navigate-main', { path });
// Change the URL back to the base application URL without adding the
// URL change to the browser history.
opened.then(() => { router.navigate('', { silent: true }); });
}
});
activate: (app: JupyterLab) => {
const { commands } = app;
const base = PageConfig.getOption('baseUrl');
const router = new Router({ base, commands });
app.started.then(() => {
// Route the very first request on load.
router.route();
// Route all pop state events.
window.addEventListener('popstate', () => {
router.route();
});
});
return router;
},
autoStart: true,
activate: (app: JupyterLab) => {
const { commands } = app;
const base = PageConfig.getOption('pageUrl');
const router = new Router({ base, commands });
commands.addCommand(CommandIDs.tree, {
execute: (args: IRouter.ILocation) => {
const path = decodeURIComponent((args.path.match(Patterns.tree)[1]));
// File browser navigation waits for the application to be restored.
// As a result, this command cannot return a promise because it would
// create a circular dependency on the restored promise that would
// cause the application to never restore.
const opened = commands.execute('filebrowser:navigate-main', { path });
// Change the URL back to the base application URL without adding the
// URL change to the browser history.
opened.then(() => { router.navigate('', { silent: true }); });
}
});
beforeEach(() => {
commands = new CommandRegistry();
router = new Router({ base, commands });
});