UNPKG

796 BJavaScriptView Raw
1import OriginModal, { destroyFns } from './Modal';
2import confirm, { withWarn, withInfo, withSuccess, withError, withConfirm } from './confirm';
3
4function modalWarn(props) {
5 return confirm(withWarn(props));
6}
7
8var Modal = OriginModal;
9
10Modal.info = function infoFn(props) {
11 return confirm(withInfo(props));
12};
13
14Modal.success = function successFn(props) {
15 return confirm(withSuccess(props));
16};
17
18Modal.error = function errorFn(props) {
19 return confirm(withError(props));
20};
21
22Modal.warning = modalWarn;
23Modal.warn = modalWarn;
24
25Modal.confirm = function confirmFn(props) {
26 return confirm(withConfirm(props));
27};
28
29Modal.destroyAll = function destroyAllFn() {
30 while (destroyFns.length) {
31 var close = destroyFns.pop();
32
33 if (close) {
34 close();
35 }
36 }
37};
38
39export default Modal;
\No newline at end of file