-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathplugin.ts
More file actions
37 lines (30 loc) · 1.02 KB
/
plugin.ts
File metadata and controls
37 lines (30 loc) · 1.02 KB
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
import { Application, IPlugin } from '@phosphor/application';
import { Widget } from '@phosphor/widgets';
import { IJupyterWidgetRegistry } from '@jupyter-widgets/base';
import { MODULE_VERSION, MODULE_NAME } from './version';
const EXTENSION_ID = 'matplotlib-jupyter:main';
/**
* The plugin.
*/
const jupyterMatplotlibPlugin: IPlugin<Application<Widget>, void> = {
id: EXTENSION_ID,
requires: [IJupyterWidgetRegistry],
activate: activateWidgetExtension,
autoStart: true,
} as unknown as IPlugin<Application<Widget>, void>;
// the "as unknown as ..." typecast above is solely to support JupyterLab 1
// and 2 in the same codebase and should be removed when we migrate to Lumino.
export default jupyterMatplotlibPlugin;
/**
* Activate the widget extension.
*/
function activateWidgetExtension(
app: Application<Widget>,
registry: IJupyterWidgetRegistry,
): void {
registry.registerWidget({
name: MODULE_NAME,
version: MODULE_VERSION,
exports: (): any => import('./index'),
});
}