-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathplugin.ts
45 lines (36 loc) · 1.14 KB
/
plugin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) Jeremy Tuloup
// Distributed under the terms of the Modified BSD License.
import {
JupyterFrontEndPlugin,
JupyterFrontEnd,
ILabShell
} from '@jupyterlab/application';
import { ICommandPalette } from '@jupyterlab/apputils';
import { IJupyterWidgetRegistry } from '@jupyter-widgets/base';
import * as widgetExports from './widget';
import { MODULE_NAME, MODULE_VERSION } from './version';
const EXTENSION_ID = 'ipylab:plugin';
const extension: JupyterFrontEndPlugin<void> = {
id: EXTENSION_ID,
autoStart: true,
requires: [IJupyterWidgetRegistry, ILabShell],
optional: [ICommandPalette],
activate: (
app: JupyterFrontEnd,
registry: IJupyterWidgetRegistry,
shell: ILabShell,
palette: ICommandPalette
): void => {
// add globals
widgetExports.JupyterFrontEndModel._app = app;
widgetExports.ShellModel._shell = shell;
widgetExports.CommandRegistryModel._commands = app.commands;
widgetExports.CommandPaletteModel._palette = palette;
registry.registerWidget({
name: MODULE_NAME,
version: MODULE_VERSION,
exports: widgetExports
});
}
};
export default extension;