blob: 5f586892b8b46ddc4d8a3a399e672f9d3f6b980d [file] [log] [blame]
{
"version": 3,
"sources": ["worker.ts"],
"sourcesContent": ["/*!\n * @license\n * Copyright 2021 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\ndeclare global {\n interface Window {\n submitForm: typeof submitForm;\n }\n}\n\nfunction submitForm(formName: string, reload: boolean) {\n const form = document.querySelector<HTMLFormElement>(`form[name=\"${formName}\" ]`);\n if (!form) {\n throw Error(`Form \"${formName}\" not found.`);\n }\n form.result.value = 'request pending...';\n const xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function () {\n if (this.readyState == 4) {\n if (this.status >= 200 && this.status < 300) {\n if (reload) {\n location.reload();\n } else {\n form.result.value = 'Success.';\n }\n } else {\n form.result.value = 'ERROR: ' + this.responseText;\n }\n }\n };\n xhr.open(form.method, form.action);\n xhr.send(new FormData(form));\n}\n\nwindow.submitForm = submitForm;\n\nexport {};\n"],
"mappings": "AAYA,SAASA,EAAWC,EAAkBC,EAAiB,CACrD,IAAMC,EAAO,SAAS,cAA+B,cAAcF,MAAa,EAChF,GAAI,CAACE,EACH,MAAM,MAAM,SAASF,eAAsB,EAE7CE,EAAK,OAAO,MAAQ,qBACpB,IAAMC,EAAM,IAAI,eAChBA,EAAI,mBAAqB,UAAY,CAC/B,KAAK,YAAc,IACjB,KAAK,QAAU,KAAO,KAAK,OAAS,IAClCF,EACF,SAAS,OAAO,EAEhBC,EAAK,OAAO,MAAQ,WAGtBA,EAAK,OAAO,MAAQ,UAAY,KAAK,aAG3C,EACAC,EAAI,KAAKD,EAAK,OAAQA,EAAK,MAAM,EACjCC,EAAI,KAAK,IAAI,SAASD,CAAI,CAAC,CAC7B,CAEA,OAAO,WAAaH",
"names": ["submitForm", "formName", "reload", "form", "xhr"]
}