Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const next = function() {
const hasNext = queue.length > 0
if (!hasNext) {
firstDispatched = false
} else if (hasNext && !t.isActive(toastId)) {
show(queue.shift())
}
}
notify = () => {
if (! toast.isActive(this.toastId)) {
this.toastId = toast("I cannot be duplicated !");
}
};
notifyDuplicate = () => {
if (!toast.isActive(this.toastId)) {
this.toastId = toast.error(
`There is already a repl or challenge with the name ${this.state.value}`
)
}
}
handleAddRepl = (e) => {
let onConnectionLost = (message) => {
if (!toast.isActive(this.toastId)) {
this.toastId = toast.error(message, { autoClose: 3000 })
}
}
this.setState(prevState => {
const { errors } = prevState;
const nonDockerErrors = _.find(errors, e => e.id !== 'docker');
if (toast.isActive('docker')) {
toast.dismiss('docker');
}
if (_.isUndefined(nonDockerErrors)) {
return { errors: {} };
}
return { errors: nonDockerErrors };
});
}
toastShareLink = (shareLink: string): void => {
if (!toast.isActive(this.toastId)) {
this.toastId = toast.error(
`Click to copy share link: ${shareLink}`, {
autoClose: false,
onClose: () => this.copyShareLink(shareLink),
}
)
}
}
copyShareLink = (shareLink) => {
componentWillUnmount() {
if (toast.isActive('loginFailed')) {
toast.dismiss('loginFailed');
}
}
static _showMessage(offline) {
const { BOTTOM_RIGHT } = toast.POSITION;
if (toast.isActive(this.toastId)) {
return;
}
return offline
? (this.toastId = toast(message, {
position: BOTTOM_RIGHT,
closeButton: false,
autoClose: false,
closeOnClick: false,
className: classNames("toast", { offline })
}))
: toast.dismiss();
}
const notify = (message, type = 'default', icon, options) => {
const settings = {
type,
...options,
};
const { id: lastToastId, ...lastToastProps } = lastToast;
const toastProps = { message, type, icon };
if (!toast.isActive(lastToast.id) || !_.isEqual(lastToastProps, toastProps)) {
const id = toast(, settings);
lastToast = { id, ...toastProps };
}
};
export const raiseNotificationToast = (notification: Notification) => {
const component = fetchComponent(notification);
const options: ToastOptions = {
bodyClassName: 'notification-toast-body',
closeButton: ,
position: toast.POSITION.TOP_RIGHT,
progressClassName: `notification-toast-progress-bar`,
toastId: notification.id,
type: ToastType.DEFAULT
};
if (notification.id && toast.isActive(notification.id)) {
const updateOptions = options as UpdateOptions;
updateOptions.render = component;
toast.update(notification.id, options);
}
else {
toast(component, options);
}
};