Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit ea582e7

Browse files
committed
Port to JupyterLab v1
1 parent d947b62 commit ea582e7

File tree

3 files changed

+842
-515
lines changed

3 files changed

+842
-515
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab_toastify",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "Integrate 'react-toastify' nicely in JupyterLab.",
55
"keywords": [
66
"jupyter",
@@ -31,7 +31,7 @@
3131
"prepare": "npm run clean && npm run build"
3232
},
3333
"dependencies": {
34-
"@jupyterlab/application": "^0.19.1",
34+
"@jupyterlab/application": "^1.0.0",
3535
"react-toastify": "^4.4.3"
3636
},
3737
"peerDependencies": {

src/index.tsx

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,72 @@ import * as ReactDOM from "react-dom";
33

44
import { LabToastContainer, INotification } from "./ToastJupyterLab";
55

6-
import { JupyterLab, JupyterLabPlugin } from "@jupyterlab/application";
6+
import {
7+
JupyterFrontEndPlugin,
8+
JupyterFrontEnd
9+
} from "@jupyterlab/application";
710

811
import "../style/index.css";
912

1013
/**
1114
* Initialization data for the jupyterlab_toastify extension.
1215
*/
13-
const extension: JupyterLabPlugin<void> = {
16+
const extension: JupyterFrontEndPlugin<void> = {
1417
id: "jupyterlab_toastify",
1518
autoStart: true,
16-
activate: (app: JupyterLab) => {
19+
activate: (app: JupyterFrontEnd) => {
1720
app.restored.then(() => {
1821
const node = document.createElement("div");
1922
document.body.appendChild(node);
2023
ReactDOM.render(<LabToastContainer />, node);
2124

2225
// For testing
23-
// let id = INotification.inProgress("Task in progress!");
24-
// setTimeout(INotification.update, 2500, {
25-
// toastId: id,
26-
// message: "Updating task..."
27-
// });
28-
// setTimeout(INotification.update, 3500, {
29-
// toastId: id,
30-
// message: "Task succeed",
31-
// type: "success",
32-
// autoClose: 3000
33-
// });
34-
// INotification.error("Error");
35-
// setTimeout(
36-
// INotification.info,
37-
// 500,
38-
// "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis blandit tellus, non pulvinar justo."
39-
// );
40-
// setTimeout(INotification.warning, 1000, "Warning");
41-
// setTimeout(INotification.success, 1500, "Success");
42-
// setTimeout(INotification.notify, 2000, "Default");
26+
// let id = INotification.inProgress("Task in progress!");
27+
// setTimeout(INotification.update, 2500, {
28+
// toastId: id,
29+
// message: "Updating task..."
30+
// });
31+
// setTimeout(INotification.update, 3500, {
32+
// toastId: id,
33+
// message: "Task succeed",
34+
// type: "success",
35+
// autoClose: 3000
36+
// });
37+
// INotification.error("Error");
38+
// setTimeout(
39+
// INotification.info,
40+
// 500,
41+
// "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quis blandit tellus, non pulvinar justo."
42+
// );
43+
// setTimeout(INotification.warning, 1000, "Warning");
44+
// setTimeout(INotification.success, 1500, "Success");
45+
// setTimeout(INotification.notify, 2000, "Default");
4346

44-
// INotification.error("Error with button", {
45-
// buttons: [
46-
// {
47-
// label: "Action1",
48-
// callback: () => alert("Action1 was clicked")
49-
// },
50-
// {
51-
// label: "Action2",
52-
// callback: () => alert("Action2 was clicked")
53-
// }
54-
// ]
55-
// });
47+
// INotification.error("Error with button", {
48+
// buttons: [
49+
// {
50+
// label: "Action1",
51+
// callback: () => alert("Action1 was clicked")
52+
// },
53+
// {
54+
// label: "Action2",
55+
// callback: () => alert("Action2 was clicked")
56+
// }
57+
// ]
58+
// });
5659

57-
// let id2 = INotification.inProgress("Task2 in progress! But how long will it take to get it done?");
58-
// setTimeout(INotification.update, 4500, {
59-
// toastId: id2,
60-
// message: "Task2 succeed",
61-
// type: "success",
62-
// buttons: [
63-
// {
64-
// label: "Action3",
65-
// callback: () => alert("Action3 was clicked")
66-
// }
67-
// ]
68-
// });
60+
// let id2 = INotification.inProgress("Task2 in progress! But how long will it take to get it done?");
61+
// setTimeout(INotification.update, 4500, {
62+
// toastId: id2,
63+
// message: "Task2 succeed",
64+
// type: "success",
65+
// buttons: [
66+
// {
67+
// label: "Action3",
68+
// callback: () => alert("Action3 was clicked")
69+
// }
70+
// ]
71+
// });
6972
});
7073
}
7174
};

0 commit comments

Comments
 (0)