{"id":37902414,"url":"https://github.com/loadingio/polling","last_synced_at":"2026-01-16T17:05:41.506Z","repository":{"id":61249225,"uuid":"198026466","full_name":"loadingio/polling","owner":"loadingio","description":"tiny vanilla JS Polling library","archived":false,"fork":false,"pushed_at":"2023-07-19T23:51:50.000Z","size":116,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-08T19:05:42.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"LiveScript","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/loadingio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-21T07:29:04.000Z","updated_at":"2024-05-11T08:39:12.000Z","dependencies_parsed_at":"2022-10-13T13:55:57.578Z","dependency_job_id":null,"html_url":"https://github.com/loadingio/polling","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/loadingio/polling","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fpolling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fpolling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fpolling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fpolling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loadingio","download_url":"https://codeload.github.com/loadingio/polling/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadingio%2Fpolling/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-16T17:05:41.255Z","updated_at":"2026-01-16T17:05:41.496Z","avatar_url":"https://github.com/loadingio.png","language":"LiveScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @loadingio/polling\n\nPromise based, vanilla JS polling library. Features:\n\n - Implemented via setTimeout\n - Polling paused when page is not visible ( checked with page visibility api )\n - Promise based ( resolved when polling ends. )\n - Object-aware, can be used in object member function.\n\n\n## Usage\n\n\ninstall via npm:\n\n    npm install --save @loadingio/polling\n\nor include directly the dist file:\n\n    \u003cscript src=\"path/to/polling/index.js\"\u003e\u003c/script\u003e\n\nTo periodically invoke a function with certain interval(in millisecond): `polling(function, interval)()` or `polling(interval, function)()`\n\nexample:\n\n    poll = polling(function() { console.log(\"print every 2 seconds.\"); }, 2000)\n    poll();\n\nReturn true in your function to stop the polling, which will be used to resolve the pending promise:\n\n    polling(function() {\n      if(Math.random() \u003e 0.9) { return \"hit!\"; }\n    }, 1000)()\n    .then(function(msg) {\n      console.log(\"message: \", msg);\n    })\n\n\nYou can also force it to stop by calling \"stop\" on the returned object directly:\n\n    var poll = polling(f, 1000);\n    poll();\n    poll.stop();\n\n\nIt also works as a member function of object:\n\n    var myobj = {\n      poll: polling(function() {\n        if(this.data == true) {\n          return true;\n        } else {\n          console.log(\"polling\");\n        }\n        return false;\n      },\n      data: false\n    };\n    myobj.poll();\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadingio%2Fpolling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floadingio%2Fpolling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadingio%2Fpolling/lists"}