{"id":21291889,"url":"https://github.com/idea2app/event-submitter-polyfill","last_synced_at":"2025-06-25T04:44:12.606Z","repository":{"id":114520504,"uuid":"391626033","full_name":"idea2app/event-submitter-polyfill","owner":"idea2app","description":"A polyfill for submitter property of \u003cform /\u003e Submit Event, which is written in TypeScript.","archived":false,"fork":false,"pushed_at":"2024-08-02T18:15:45.000Z","size":150,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-03T21:24:24.276Z","etag":null,"topics":["event","form","polyfill","submit","submitter","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idea2app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-01T12:51:22.000Z","updated_at":"2024-08-02T18:14:45.000Z","dependencies_parsed_at":"2024-08-02T01:04:11.906Z","dependency_job_id":null,"html_url":"https://github.com/idea2app/event-submitter-polyfill","commit_stats":{"total_commits":6,"total_committers":3,"mean_commits":2.0,"dds":"0.33333333333333337","last_synced_commit":"249feca4f14e0713c3a79345c2590c9ff205177f"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/idea2app/event-submitter-polyfill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2Fevent-submitter-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2Fevent-submitter-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2Fevent-submitter-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2Fevent-submitter-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idea2app","download_url":"https://codeload.github.com/idea2app/event-submitter-polyfill/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idea2app%2Fevent-submitter-polyfill/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261807681,"owners_count":23212660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event","form","polyfill","submit","submitter","typescript"],"created_at":"2024-11-21T13:46:36.100Z","updated_at":"2025-06-25T04:44:12.566Z","avatar_url":"https://github.com/idea2app.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Event Submitter polyfill\n\nA polyfill for [`submitter` property of `\u003cform /\u003e` Submit Event][1], which is written in [TypeScript][2].\n\n[![CI \u0026 CD](https://github.com/idea2app/event-submitter-polyfill/actions/workflows/main.yml/badge.svg)][3]\n[![](https://data.jsdelivr.com/v1/package/npm/event-submitter-polyfill/badge?style=rounded)][4]\n\n[![NPM](https://nodei.co/npm/event-submitter-polyfill.png?downloads=true\u0026downloadRank=true\u0026stars=true)][5]\n\n## Installation\n\n### Bundled\n\n```javascript\nimport 'event-submitter-polyfill';\n```\n\n### CDN\n\n```html\n\u003chead\u003e\n    \u003cscript src=\"https://polyfill.web-cell.dev/feature/EventSubmitter.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\n## Usage\n\n### HTML 5\n\n```html\n\u003cbody\u003e\n    \u003cform\u003e\n        \u003cinput name=\"data\" /\u003e\n\n        \u003cbutton type=\"submit\" data-name=\"first\"\u003eFisrt\u003c/button\u003e\n        \u003cbutton type=\"submit\" data-name=\"second\"\u003eSecond\u003c/button\u003e\n    \u003c/form\u003e\n    \u003cscript\u003e\n        document.querySelector('form')?.addEventListener('submit', event =\u003e {\n            event.preventDefault();\n\n            const { name } = event.submitter.dataset,\n                { data } = event.target.elements;\n\n            fetch(`/api/${name}`, { data: data.value });\n        });\n    \u003c/script\u003e\n\u003c/body\u003e\n```\n\n### React\n\n```tsx\nimport React, { FormEvent } from 'react';\nimport { render } from 'react-dom';\n\nfunction handleSubmit(event: FormEvent\u003cHTMLFormElement\u003e) {\n    event.preventDefault();\n\n    const { name } = event.nativeEvent.submitter.dataset,\n        { data } = event.currentTarget.elements;\n\n    fetch(`/api/${name}`, { data: data.value });\n}\n\nrender(\n    \u003cform onSubmit={handleSubmit}\u003e\n        \u003cinput name=\"data\" /\u003e\n\n        \u003cbutton type=\"submit\" data-name=\"first\"\u003e\n            Fisrt\n        \u003c/button\u003e\n        \u003cbutton type=\"submit\" data-name=\"second\"\u003e\n            Second\n        \u003c/button\u003e\n    \u003c/form\u003e,\n    document.body\n);\n```\n\n## Roadmap\n\n-   [x] [`SubmitEvent` class in TypeScript][6]\n\n## Acknowledge\n\nWe rewrite the source code based on [Tobias Buschor's answer in StackOverflow][7].\n\n[1]: https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/submitter\n[2]: https://www.typescriptlang.org/\n[3]: https://github.com/idea2app/event-submitter-polyfill/actions/workflows/main.yml\n[4]: https://www.jsdelivr.com/package/npm/event-submitter-polyfill\n[5]: https://nodei.co/npm/event-submitter-polyfill/\n[6]: https://github.com/microsoft/TypeScript/issues/40811\n[7]: https://stackoverflow.com/a/61110260\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidea2app%2Fevent-submitter-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidea2app%2Fevent-submitter-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidea2app%2Fevent-submitter-polyfill/lists"}