{"id":16148466,"url":"https://github.com/kribblo/timeframer","last_synced_at":"2025-06-11T19:37:07.895Z","repository":{"id":142201399,"uuid":"82710489","full_name":"kribblo/timeframer","owner":"kribblo","description":"Background setTimeout and setInterval via Webworkers via iframe.","archived":false,"fork":false,"pushed_at":"2018-01-18T12:44:53.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T21:26:16.675Z","etag":null,"topics":["edge","ie10","setinterval","settimeout","webworker"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kribblo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-02-21T17:58:50.000Z","updated_at":"2022-11-17T09:11:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"8b7edc3d-954e-45b3-8f07-112212ed644e","html_url":"https://github.com/kribblo/timeframer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kribblo/timeframer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kribblo%2Ftimeframer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kribblo%2Ftimeframer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kribblo%2Ftimeframer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kribblo%2Ftimeframer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kribblo","download_url":"https://codeload.github.com/kribblo/timeframer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kribblo%2Ftimeframer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259325551,"owners_count":22841057,"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":["edge","ie10","setinterval","settimeout","webworker"],"created_at":"2024-10-10T00:33:46.155Z","updated_at":"2025-06-11T19:37:07.875Z","avatar_url":"https://github.com/kribblo.png","language":"JavaScript","readme":"# timeframer\n\n`setTimeout` and `setInterval` that keeps on ticking when a tab is in the background (they're otherwise throttled). Use with care and only when there's a good use-case.\n\nIt works by creating an invisible iframe with a WebWorker that does the actual timers and update ticks via a MessageChannel. This is just a way to make it real simple to avoid cross-domain issues, the iframe and the worker is hosted on the same origin. If you can host your own worker on your own domain, that's much easier. \n\nAll this trickery is due to the Microsoft browsers, all others make do fine with Blob URL's.\n\nThis is an initial proof-of-concept.\n\n## Usage\n\n### Include in webpage\n\nFrom a webpage, make a `\u003cscript\u003e` tag with `src` pointing to `timeframer.js` where it and `timeframer.html` is hosted.\n\n`setTimeout`, `clearTimeout`, `setInterval` and `clearInterval` will all be available on the global `window.timeframer`.\n\nYou can host it yourself (the `dist` folder), and it's also hosted on GitHub pages at \u003chttps://kribblo.github.io/timeframer/timeframer.js\u003e, example:\n\n```html\n\u003cscript src=\"https://kribblo.github.io/timeframer/timeframer.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    let i = 1;\n    let interval = timeframer.setInterval(function() {\n        console.log('Interval', i++)\n    }, 500)\n    timeframer.setTimeout(function() {\n        timeframer.clearInterval(interval)\n    }, 1600);\n\u003c/script\u003e\n```\n\n### Override window.setTimeout and friends\n\n```javascript\nwindow.setTimeout = timeframer.setTimeout;\nwindow.setInterval = timeframer.setInterval;\nwindow.clearTimeout = timeframer.clearTimeout;\nwindow.clearInterval = timeframer.clearInterval;\n```\n\nUse caution. If you do this, all timers and intervals in the page will run at full speed in the background, this should only be used where it is needed.\n\n## TODO\n\n* test case/example page\n\n## Development\n\n### Update dist\n\n    npm install\n    npm run build\n\n### Publish to gh-pages\n\n    npm run www\n    ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkribblo%2Ftimeframer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkribblo%2Ftimeframer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkribblo%2Ftimeframer/lists"}