{"id":15648900,"url":"https://github.com/squidfunk/iframe-worker","last_synced_at":"2025-08-01T10:10:28.317Z","repository":{"id":36977611,"uuid":"244367817","full_name":"squidfunk/iframe-worker","owner":"squidfunk","description":"A tiny WebWorker shim for file://","archived":false,"fork":false,"pushed_at":"2024-04-08T05:59:31.000Z","size":1384,"stargazers_count":43,"open_issues_count":4,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-20T12:18:32.682Z","etag":null,"topics":["iframe","shim","webworker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/squidfunk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"squidfunk"}},"created_at":"2020-03-02T12:39:31.000Z","updated_at":"2024-11-05T12:49:25.000Z","dependencies_parsed_at":"2024-04-08T06:50:01.457Z","dependency_job_id":null,"html_url":"https://github.com/squidfunk/iframe-worker","commit_stats":{"total_commits":280,"total_committers":4,"mean_commits":70.0,"dds":"0.37142857142857144","last_synced_commit":"4096b5da50c15f34a376969228b376012977bc15"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squidfunk%2Fiframe-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squidfunk%2Fiframe-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squidfunk%2Fiframe-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squidfunk%2Fiframe-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squidfunk","download_url":"https://codeload.github.com/squidfunk/iframe-worker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230532443,"owners_count":18240792,"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":["iframe","shim","webworker"],"created_at":"2024-10-03T12:26:58.678Z","updated_at":"2024-12-20T04:07:10.736Z","avatar_url":"https://github.com/squidfunk.png","language":"TypeScript","readme":"[![Github Action][action-image]][action-link]\n[![Codecov][codecov-image]][codecov-link]\n[![npm][npm-image]][npm-link]\n\n  [action-image]: https://github.com/squidfunk/iframe-worker/workflows/ci/badge.svg?branch=master\n  [action-link]: https://github.com/squidfunk/iframe-worker/actions\n  [codecov-image]: https://img.shields.io/codecov/c/github/squidfunk/iframe-worker/master.svg\n  [codecov-link]: https://codecov.io/gh/squidfunk/iframe-worker\n  [npm-image]: https://img.shields.io/npm/v/iframe-worker.svg\n  [npm-link]: https://npmjs.com/package/iframe-worker\n\n# iframe-worker\n\nA tiny [WebWorker] shim for `file://` in `690b` – no dependencies.\n\n---\n\nSimilar to [pseudo-worker], but using an `iframe` instead of\n[`XMLHTTPRequest`][XMLHTTPRequest]. This shim should be mostly\nspec-compliant and supports [`importScripts`][importScripts].\n\n## Installation\n\n``` sh\nnpm install iframe-worker\n```\n\n## Usage\n\nYou can use the shim from [unpkg.com](https://unpkg.com) __(recommended)__:\n\n``` html\n\u003cscript src=\"https://unpkg.com/iframe-worker/shim\"\u003e\u003c/script\u003e\n```\n\n... or install and bundle the shim with your application:\n\n``` js\nimport \"iframe-worker/shim\"\n```\n\nThe shim will only mount if the document is served locally via `file://`. You\ncan also use `IFrameWorker` programmatically to customize the integration:\n\n``` js\nimport { IFrameWorker } from \"iframe-worker\"\n```\n\n## Caveats\n\nIn a WebWorker script, [`importScripts`][importScripts] is a synchronous\noperation, as it will block the thread until the script was fully loaded and \nevaluated. This is not supported in an `iframe`. For this reason, the shim for\n[`importScripts`][importScripts] included with this library will return a \n`Promise`, chaining all passed URLs into a sequence, making it awaitable. \n\nSince awaiting anything else than a `Promise` will wrap the awaited thing into\na `Promise`, calls to [`importScripts`][importScripts] should practically behave\nthe same way for all protocols other than `file://`. Thus, if you want to make\nsure that your WebWorker works for all protocols, always `await` all calls to \n[`importScripts`][importScripts].\n\n## License\n\n**MIT License**\n\nCopyright (c) 2020-2022 Martin Donath\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\n  [WebWorker]: https://www.w3.org/TR/workers/\n  [pseudo-worker]: https://github.com/nolanlawson/pseudo-worker\n  [XMLHTTPRequest]: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest\n  [importScripts]: https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts\n","funding_links":["https://github.com/sponsors/squidfunk"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquidfunk%2Fiframe-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquidfunk%2Fiframe-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquidfunk%2Fiframe-worker/lists"}