{iconNode && iconNode()}
{!description && iconNode ? (
) : null}
{typeof message === 'function' ? message() : message}
{typeof description === 'function' ? description() : description}
{btn ? (
{typeof btn === 'function' ? btn() : btn}
) : null}
),
duration,
closable: true,
onClose: args.onClose,
onClick: args.onClick,
key: args.key,
style: args.style || {},
class: args.class
});
}
);
}
const api: any = {
open: notice,
close(key) {
Object.keys(notificationInstance).forEach(cacheKey =>
notificationInstance[cacheKey].removeNotice(key)
);
},
config: setNotificationConfig,
destroy() {
Object.keys(notificationInstance).forEach(cacheKey => {
notificationInstance[cacheKey].destroy();
delete notificationInstance[cacheKey];
});
}
};
['success', 'info', 'warning', 'error'].forEach(type => {
api[type] = args =>
api.open({
...args,
type
});
});
api.warn = api.warning;
export default api;