MCPcopy
hub / github.com/tdewolff/minify / getNotificationInstance

Function getNotificationInstance

_benchmarks/sample_antd.js:16807–16856  ·  view source on GitHub ↗
(args, callback)

Source from the content-addressed store, hash-verified

16805}
16806
16807function getNotificationInstance(args, callback) {
16808 var _args$placement = args.placement,
16809 placement = _args$placement === void 0 ? defaultPlacement : _args$placement,
16810 top = args.top,
16811 bottom = args.bottom,
16812 _args$getContainer = args.getContainer,
16813 getContainer = _args$getContainer === void 0 ? defaultGetContainer : _args$getContainer,
16814 _args$closeIcon = args.closeIcon,
16815 closeIcon = _args$closeIcon === void 0 ? defaultCloseIcon : _args$closeIcon,
16816 customizePrefixCls = args.prefixCls;
16817
16818 var _globalConfig = Object(_config_provider__WEBPACK_IMPORTED_MODULE_12__[/* globalConfig */ "e"])(),
16819 getPrefixCls = _globalConfig.getPrefixCls;
16820
16821 var prefixCls = getPrefixCls('notification', customizePrefixCls || defaultPrefixCls);
16822 var cacheKey = "".concat(prefixCls, "-").concat(placement);
16823 var cacheInstance = notificationInstance[cacheKey];
16824
16825 if (cacheInstance) {
16826 Promise.resolve(cacheInstance).then(function (instance) {
16827 callback({
16828 prefixCls: "".concat(prefixCls, "-notice"),
16829 instance: instance
16830 });
16831 });
16832 return;
16833 }
16834
16835 var closeIconToRender = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__["createElement"]("span", {
16836 className: "".concat(prefixCls, "-close-x")
16837 }, closeIcon || /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__["createElement"](_ant_design_icons_es_icons_CloseOutlined__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
16838 className: "".concat(prefixCls, "-close-icon")
16839 }));
16840 var notificationClass = classnames__WEBPACK_IMPORTED_MODULE_6___default()("".concat(prefixCls, "-").concat(placement), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({}, "".concat(prefixCls, "-rtl"), rtl === true));
16841 notificationInstance[cacheKey] = new Promise(function (resolve) {
16842 rc_notification__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].newInstance({
16843 prefixCls: prefixCls,
16844 className: notificationClass,
16845 style: getPlacementStyle(placement, top, bottom),
16846 getContainer: getContainer,
16847 closeIcon: closeIconToRender
16848 }, function (notification) {
16849 resolve(notification);
16850 callback({
16851 prefixCls: "".concat(prefixCls, "-notice"),
16852 instance: notification
16853 });
16854 });
16855 });
16856}
16857
16858var typeToIcon = {
16859 success: _ant_design_icons_es_icons_CheckCircleOutlined__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"],

Callers 2

notifyFunction · 0.85
noticeFunction · 0.85

Calls 3

getPlacementStyleFunction · 0.85
callbackFunction · 0.70
resolveFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…