blob: 9cc453f972f8e967d303fc37a4ac04901cae22ce [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": "AAAA,AAYA,WAAoB,EAAkB,EAAiB,CACrD,GAAM,GAAO,SAAS,cAA+B,cAAc,QACnE,GAAI,CAAC,EACH,KAAM,OAAM,SAAS,iBAEvB,EAAK,OAAO,MAAQ,qBACpB,GAAM,GAAM,GAAI,gBAChB,EAAI,mBAAqB,UAAY,CACnC,AAAI,KAAK,YAAc,GACrB,CAAI,KAAK,QAAU,KAAO,KAAK,OAAS,IACtC,AAAI,EACF,SAAS,SAET,EAAK,OAAO,MAAQ,WAGtB,EAAK,OAAO,MAAQ,UAAY,KAAK,eAI3C,EAAI,KAAK,EAAK,OAAQ,EAAK,QAC3B,EAAI,KAAK,GAAI,UAAS,IAGxB,OAAO,WAAa",
"names": []
}