Package Exports
- jupyterlab_toastify
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jupyterlab_toastify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
jupyterlab_toastify
Integrate 'react-toastify' nicely in JupyterLab.
Usage
import { INotification } from "jupyterlab_toastify";
// Error message notification - do not close automatically
INotification.error("Error");
// Warning message notification - do not close automatically
INotification.warning("Warning");
// Info message notification
INotification.info("Info");
// Success message notification
INotification.success("Success");
// Background task with progression animation
let id = INotification.inProgress("Task in progress!");
// -> Update text
INotification.update({
toastId: id,
message: "Updating task..."
});
// -> Update text, status and set closing delay (in ms)
INotification.update({
toastId: id,
message: "Task succeed",
type: "success",
autoClose: 3000
});
// Notification with two buttons
INotification.error("Error with button", {
buttons: [
{
label: "Action1",
callback: () => alert("Action1 was clicked")
},
{
label: "Action2",
callback: () => alert("Action2 was clicked")
}
]
});
// Close a toast specified by its id
INotification.dismiss(id);
// Close all toasts
INotification.dismiss();
// Default call using `toast` function
// See https://github.com/fkhadra/react-toastify#usage
INotification.notify("Default");
To close a notification, click on the close button.
Prerequisites
- JupyterLab 1.0
- react 0.16
- react-toastify 4.4
Installation
jupyter labextension install jupyterlab_toastify
Changelog
v2.3.1
- BUG
INotification.warning
does not accept options. - Respect latest extension cookiecutter parameters
v2.3.0
- Port to JupyterLab v1
v2.2.0
- Different corrections
buttons
optional inupdate
dismiss
is visible through theINotification
proxy
v2.1.0
- Update to JupyterLab 0.35
- Update to react-toastify 4.4 => change enum for notifications type to
react-toastify\TypeOptions
v2.0.0
- API change: helper functions accept options in addition to the message
- API change:
update
requires object as input and not a lot of arguments - New option
buttons
to add buttons with custom callback to the notification
v1.x
- First version using
react-toastify
- Five scenarii:
- Error
- Warning
- Info
- Success
- InProgress
Development
For a development install (requires npm version 4 or later), do the following in the repository directory:
npm install
npm run build
jupyter labextension install .
To rebuild the package and the JupyterLab app:
npm run build
jupyter lab build