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BackHandlers/LoadingPostBackHandler.ts","webpack://playme_npm_config/webpack/bootstrap","webpack://playme_npm_config/./Resources/Scripts/initLoading.ts"],"sourcesContent":["export function initLoadingPostBackHandler() {\r\n const pendingClassName = 'button--loading';\r\n const successClassName = 'button--success';\r\n const failClassName = 'button--fail';\r\n const stateDuration = 2000;\r\n dotvvm.postbackHandlers[\"loading-style-postback-handler\"] = handlerOptions => ({\r\n async execute(callback, postbackOptions) {\r\n const button = (postbackOptions.sender as HTMLButtonElement);\r\n const showError = () => {\r\n button.classList.remove(pendingClassName);\r\n button.classList.add(failClassName);\r\n window.setTimeout(() => button.classList.remove(failClassName), stateDuration);\r\n };\r\n const showSuccess = () => {\r\n button.classList.remove(pendingClassName);\r\n button.classList.add(successClassName);\r\n return window.setTimeout(() => button.classList.remove(successClassName), stateDuration);\r\n };\r\n const handleException = e => {\r\n if (e.error === 'redirect') {\r\n showSuccess();\r\n } else if (e.error && e.error.message == \"Invalid action validationErrors\") {\r\n // ignore\r\n } else {\r\n console.error(e);\r\n showError();\r\n }\r\n };\r\n try {\r\n button.classList.add(pendingClassName);\r\n const postbackCommit = await callback();\r\n const removeSuccessTimeout = showSuccess();\r\n return (async () => {\r\n try {\r\n clearTimeout(removeSuccessTimeout);\r\n button.classList.remove(successClassName);\r\n button.classList.add(pendingClassName);\r\n const postbackResult = await postbackCommit();\r\n showSuccess();\r\n return postbackResult;\r\n } catch (e) {\r\n handleException(e);\r\n throw e;\r\n }\r\n });\r\n } catch (e) {\r\n handleException(e);\r\n throw e;\r\n }\r\n }\r\n });\r\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/// \r\n\r\nimport { initLoadingPostBackHandler } from '../../Controls/PostBackHandlers/LoadingPostBackHandler';\r\ndotvvm.events.init.subscribe(function () {\r\n initLoadingPostBackHandler();\r\n});\r\n\r\n\r\n"],"names":["pendingClassName","successClassName","failClassName","dotvvm","postbackHandlers","handlerOptions","execute","callback","postbackOptions","button","sender","showSuccess","classList","remove","add","window","setTimeout","handleException","e","error","message","console","postbackCommit","removeSuccessTimeout","clearTimeout","postbackResult","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","call","events","init","subscribe","initLoadingPostBackHandler"],"sourceRoot":""}