本文整理匯總了TypeScript中@jupyterlab/extensionmanager.ExtensionView類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ExtensionView類的具體用法?TypeScript ExtensionView怎麽用?TypeScript ExtensionView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ExtensionView類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
activate: async (
app: JupyterFrontEnd,
registry: ISettingRegistry,
labShell: ILabShell | null,
restorer: ILayoutRestorer | null
) => {
const settings = await registry.load(plugin.id);
let enabled = settings.composite['enabled'] === true;
const { serviceManager, shell } = app;
let view: ExtensionView | undefined;
const createView = () => {
const v = new ExtensionView(serviceManager);
v.id = 'extensionmanager.main-view';
v.title.iconClass = 'jp-ExtensionIcon jp-SideBar-tabIcon';
v.title.caption = 'Extension Manager';
if (restorer) {
restorer.add(v, v.id);
}
return v;
};
if (enabled) {
view = createView();
shell.add(view, 'left', { rank: 1000 });
}
// If the extension is enabled or disabled,
// add or remove it from the left area.
void app.restored.then(() => {
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && (!view || (view && !view.isAttached))) {
const accepted = await Private.showWarning();
if (!accepted) {
void settings.set('enabled', false);
return;
}
view = view || createView();
shell.add(view, 'left');
} else if (!enabled && view && view.isAttached) {
view.close();
}
});
});
addCommands(app, view, labShell);
}
示例2: async
activate: async (
app: JupyterLab,
registry: ISettingRegistry,
restorer: ILayoutRestorer,
router: IRouter
) => {
const settings = await registry.load(plugin.id);
let enabled = settings.composite['enabled'] === true;
const { shell, serviceManager } = app;
const view = new ExtensionView(serviceManager);
view.id = 'extensionmanager.main-view';
view.title.label = 'Extensions';
restorer.add(view, view.id);
if (enabled) {
shell.addToLeftArea(view);
}
// If the extension is enabled or disabled,
// add or remove it from the left area.
app.restored.then(() => {
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && !view.isAttached) {
const accepted = await Private.showWarning();
if (!accepted) {
settings.set('enabled', false);
return;
}
shell.addToLeftArea(view);
} else if (!enabled && view.isAttached) {
view.close();
}
});
});
addCommands(app, view);
}
示例3: if
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && !view.isAttached) {
const accepted = await Private.showWarning();
if (!accepted) {
settings.set('enabled', false);
return;
}
shell.addToLeftArea(view);
} else if (!enabled && view.isAttached) {
view.close();
}
});
示例4: createView
settings.changed.connect(async () => {
enabled = settings.composite['enabled'] === true;
if (enabled && (!view || (view && !view.isAttached))) {
const accepted = await Private.showWarning();
if (!accepted) {
void settings.set('enabled', false);
return;
}
view = view || createView();
shell.add(view, 'left');
} else if (!enabled && view && view.isAttached) {
view.close();
}
});