![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/node_modules/sweetalert2/src/enhancers/ |
import { warnOnce } from '../utils/utils' import { showWarningsForParams } from '../utils/params' const deprecationWarning = `\ "setDefaults" & "resetDefaults" methods are deprecated in favor of "mixin" method and will be removed in the next major release. \ For new projects, use "mixin". For past projects already using "setDefaults", support will be provided through an additional package.` let defaults = {} export function withGlobalDefaults (ParentSwal) { class SwalWithGlobalDefaults extends ParentSwal { _main (params) { return super._main(Object.assign({}, defaults, params)) } static setDefaults (params) { warnOnce(deprecationWarning) if (!params || typeof params !== 'object') { throw new TypeError('SweetAlert2: The argument for setDefaults() is required and has to be a object') } showWarningsForParams(params) // assign valid params from `params` to `defaults` Object.keys(params).forEach(param => { if (ParentSwal.isValidParameter(param)) { defaults[param] = params[param] } }) } static resetDefaults () { warnOnce(deprecationWarning) defaults = {} } } // Set default params if `window._swalDefaults` is an object if (typeof window !== 'undefined' && typeof window._swalDefaults === 'object') { SwalWithGlobalDefaults.setDefaults(window._swalDefaults) } return SwalWithGlobalDefaults }