{"id":24493070,"url":"https://github.com/open-node/ticker","last_synced_at":"2025-10-16T08:31:49.345Z","repository":{"id":57133378,"uuid":"224414349","full_name":"open-node/ticker","owner":"open-node","description":"server availability status uphold, auto dependency detection","archived":false,"fork":false,"pushed_at":"2019-11-27T11:34:57.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T14:50:48.454Z","etag":null,"topics":["availability","dependency-detection","heartbeat","high-availability"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/open-node.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}},"created_at":"2019-11-27T11:23:34.000Z","updated_at":"2022-03-25T07:07:20.000Z","dependencies_parsed_at":"2022-09-03T13:52:20.161Z","dependency_job_id":null,"html_url":"https://github.com/open-node/ticker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/open-node/ticker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-node%2Fticker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-node%2Fticker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-node%2Fticker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-node%2Fticker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-node","download_url":"https://codeload.github.com/open-node/ticker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-node%2Fticker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265802003,"owners_count":23830506,"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":["availability","dependency-detection","heartbeat","high-availability"],"created_at":"2025-01-21T19:19:02.241Z","updated_at":"2025-10-16T08:31:44.305Z","avatar_url":"https://github.com/open-node.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @open-node/ticker\nserver availability status uphold, auto dependency detection\n\n[![Build status](https://travis-ci.com/open-node/ticker.svg?branch=master)](https://travis-ci.org/open-node/ticker)\n[![codecov](https://codecov.io/gh/open-node/ticker/branch/master/graph/badge.svg)](https://codecov.io/gh/open-node/ticker)\n\n# Installation\n\u003cpre\u003enpm i @open-node/ticker --save\u003c/pre\u003e\n\n# Usage\n\u003cpre\u003e\nconst Ticker = require('@open-node/ticker');\n\nconst ticker = Ticker(['server1', 'server2', 'server3']);\n\n// Upload server1 status with call checkServer1AsyncFn per 2 second\nticker.tock(checkServer1AsyncFn, 'server1', 2 * 1000);\n\ncosnt server1Availability = ticker.status('server1'); // server1Availability is true or false\n\nconst fn1IfServer1Availability = ticker.runner(fn1, 'server1');\n\nawait fn1IfServer1Availability(); // fn1 be called when server1 is enabled unless fn1 will be wait, unit server1 is enabled\n\u003c/pre\u003e\n\n\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n-   [Ticker][1]\n    -   [Parameters][2]\n    -   [status][3]\n        -   [Parameters][4]\n    -   [tock][5]\n        -   [Parameters][6]\n    -   [runner][7]\n        -   [Parameters][8]\n\n## Ticker\n\n### Parameters\n\n-   `_keys` **[Array][9]\u0026lt;[string][10]\u003e** Dependency server's names\n\nReturns **[Ticker][11]** Instance\n\n### status\n\nread/write status value\n\n#### Parameters\n\n-   `key` **[string][10]** server's unique key\n-   `value` **[boolean][12]?** server's status value\n\nReturns **[boolean][12]** server's current status value\n\n### tock\n\nDependency detection runner\n\n#### Parameters\n\n-   `hitFn` **AsyncFunction** detection function return true or false\n-   `key` **[string][10]** server‘s key\n-   `sleepMS` **[number][13]** two times called interval ms\n\nReturns **AsyncFunction** detection runner be called by async.forever\n\n### runner\n\nFor a function add dependency detection\n\n#### Parameters\n\n-   `fn` **[function][14]** Orig function, it will be add dependency detection\n-   `key` **[string][10]** dependency server's key\n-   `sleepMS` **[number][13]** dependency detection interval ms (optional, default `100`)\n\nReturns **[function][14]** 返回处理后的函数\n\n[1]: #ticker\n\n[2]: #parameters\n\n[3]: #status\n\n[4]: #parameters-1\n\n[5]: #tock\n\n[6]: #parameters-2\n\n[7]: #runner\n\n[8]: #parameters-3\n\n[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\n\n[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n\n[11]: #ticker\n\n[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n\n[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\n\n[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-node%2Fticker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-node%2Fticker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-node%2Fticker/lists"}