{"id":48656607,"url":"https://github.com/ryuever/cronr","last_synced_at":"2026-04-10T09:17:01.515Z","repository":{"id":43584949,"uuid":"120197363","full_name":"ryuever/cronr","owner":"ryuever","description":" Time-based job scheduler in millisecond precision running on browser(webWorkers support) and Node.js","archived":false,"fork":false,"pushed_at":"2022-12-10T20:32:08.000Z","size":5716,"stargazers_count":17,"open_issues_count":20,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-15T03:25:42.174Z","etag":null,"topics":["browser","cron","crontab","job-scheduler","millisecond","node-cron","webworker"],"latest_commit_sha":null,"homepage":"https://ryuever.github.io/cronr/","language":"TypeScript","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/ryuever.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}},"created_at":"2018-02-04T15:32:06.000Z","updated_at":"2025-03-19T16:30:13.000Z","dependencies_parsed_at":"2023-01-26T10:46:39.176Z","dependency_job_id":null,"html_url":"https://github.com/ryuever/cronr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ryuever/cronr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryuever%2Fcronr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryuever%2Fcronr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryuever%2Fcronr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryuever%2Fcronr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryuever","download_url":"https://codeload.github.com/ryuever/cronr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryuever%2Fcronr/sbom","scorecard":{"id":793207,"data":{"date":"2025-08-11","repo":{"name":"github.com/ryuever/cronr","commit":"fd3dda76299a3389468a5ed9b8eff9dda24c4f73"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"119 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-vfrc-7r7c-w9mx","Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-ccrp-c664-8p4j","Warn: Project is vulnerable to: GHSA-4wx3-54gh-9fr9","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-r6rj-9ch6-g264","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-wvhm-4hhf-97x9","Warn: Project is vulnerable to: GHSA-h4hr-7fg3-h35w","Warn: Project is vulnerable to: GHSA-gj77-59wh-66hg","Warn: Project is vulnerable to: GHSA-hqhp-5p83-hx96","Warn: Project is vulnerable to: GHSA-3949-f494-cm99","Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-5q6m-3h65-w53x","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-w5hq-hm5m-4548","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442","Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc","Warn: Project is vulnerable to: GHSA-rqff-837h-mm52","Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2","Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j","Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T08:09:55.563Z","repository_id":43584949,"created_at":"2025-08-23T08:09:55.563Z","updated_at":"2025-08-23T08:09:55.563Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31636199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"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":["browser","cron","crontab","job-scheduler","millisecond","node-cron","webworker"],"created_at":"2026-04-10T09:17:00.927Z","updated_at":"2026-04-10T09:17:01.505Z","avatar_url":"https://github.com/ryuever.png","language":"TypeScript","readme":"# cronr \u0026middot; [![npm version](https://img.shields.io/npm/v/cronr.svg?style=flat)](https://www.npmjs.com/package/cronr) [![NPM downloads](https://img.shields.io/npm/dm/cronr.svg?style=flat-square)](http://www.npmtrends.com/cronr)\n\nInspired from unix `cron`, `cronr` is served as an time-based job scheduler which runs on `browser` and `Node.js`. It follows the basic standard macro pattern and makes somehow enhancement.\n\n---\n\n## Feature\n\n- More time control support, even to `millisecond`\n- Works on browser and `Node.js`\n- By default, jobs control support five available actions : `start`, `stop`, `stop`, `resume` and `clear`.\n- Standalone module to help calculate `nextTick` only, which provide a `Iterator` object to fetch.\n- Add `webWorkers` support, to avoid the `onmessage` handle trigger delay due to the nature of Javascript's single thread.\n\n## Online demo\n\n[Cronr stroies -- online samples](https://ryuever.github.io/cronr/)\n\n## Installation\n\n- use `npm` to install\n\n```bash\nnpm install cronr\n```\n\n- or use `yarn` with\n\n```bash\nyarn add cronr\n```\n\n## Running on browser\n\n- Downloading the `Cronr.umd.min.js(for time job scheduler)` or `CronrCounter.umd.min.js(to fetch the nextTick only)` from './lib/minified';\n- Add an `\u003cscript\u003e` tag which includes the `bundle` file on your page\n- Refer to [Cronr](#cronr) or [CronrCounter](#cronrcounter) for usage detail\n\n## Cronr\n\nJob scheduler, which support `cron` macro pattern and has lots of handful methods.\n\n### - Cronr(pattern: string, callback: function, opts: obj)\n\n| Property | Description | Type | Required|\n| -------- | ----------- | ---- | --- |\n| pattern  | `cron` macro format string | string | yes|\n| callback | Function will be triggerd when time hit `nextTick` | function | yes|\n\nopts has following available `parameters`\n\n| Property | Description | Type | Required| Default |\n| -------- | ----------- | ---- | --- | ---- |\n| startTime | Starting point, when to start calculate the `nextTick` | Date | false | `new Date()` |\n| endTime | Ending point, the schedulerd jobs will be canceled after this time | Date | false | none |\n| immediate | When to trigger `callback` immediately when you start the job | boolean | false | false |\n\n#### methods\n\n| Method | Description | Signature |\n| ------ | ----------- | ---- |\n| start  | Start the `initial` job | (): void =\u003e {} |\n| stop  | Suspend the `running` job | (): void =\u003e {} |\n| resume  | Resume the `suspend` job | (): void =\u003e {} |\n| clear  | Clear the job | (): void =\u003e {} |\n| restart  | Restart the register job | (): void =\u003e {} |\n\nHowever, every method invoke has an order restriction.\n\n- `start` only could be followed by `stop` and `clear` method.\n\n| Method | Followed By |\n| ------ | ----------- |\n| start  | `[\"stop\", \"clear\"]` |\n| stop   | `[\"resume\", \"clear\"]` |\n| clear  | `[\"restart\"]` |\n\n#### Basic Usage\n\n```js\nimport Cronr from 'cronr';\n// trigger on every second, 10, 20, 30, 40, 50, 00\nconst pattern = '*/10 * * * * *';\nlet count = 1;\nconst cb = () =\u003e count++;\n\nconst job = new Cronr(pattern, cb, {\n    startTime: new Date(2018, 3, 23, 10, 23, 36),\n});\n\njob.start();\n```\n\n## CronrCounter\n\nIt mainly consists of :\n\n- Parsing `cron` macro pattern\n- A `Iterator` property which to provide the `nextTick` value.\n\n### - CronrCounter(opts: obj)\n\nopts has the following avaible properties.\n\n| Property | Description | Type | Required| Default |\n| -------- | ----------- | ---- | --- | --- |\n| name | Module name | string | false | undefined |\n| pattern | `cron` macro pattern | string | true | -- |\n| ts   | Time Starting point, which means all the `nextTick` is calculated based on this value | Date | false | `new Date()`|\n\n### - Basic Usage\n\n```js\nimport CronrCounter from 'cronr/CronrCounter';\nconst counter = new CronrCounter({\n  name: 'testing',\n  pattern: '2,5 * * 3-12 3 *',\n  ts: new Date(2018, 7, 22, 10, 23, 16),\n});\n\nconst data = counter.result;\nconst result = data.next().value;  // '3/3/2019, 12:00:02 AM'\nconst result2 = data.next().value; // '3/3/2019, 12:00:05 AM'\n```\n\n## CronrWorker\n\nThis is an experimental `feature` which is integrated with `webWorkers`. It coulb be considered as an alternate of `Crorn` module。\n\n### Why using `webWorkers`\n\n```js\nlet i = 1;\nconst fn = (ts) =\u003e {\n  const id = setTimeout(() =\u003e {\n    const executedAt = new Date();\n    const diff = executedAt - ts;\n    window.clearTimeout(id);\n    console.log('executedAt ', executedAt, diff);\n    if (i \u003c 10) {\n      fn(ts);\n    }\n    i++;\n  }, 500)\n}\n\n// result\n\n// executedAt  Mon May 07 2018 00:33:38 GMT+0800 (CST) 502\n// executedAt  Mon May 07 2018 00:33:38 GMT+0800 (CST) 1007\n// executedAt  Mon May 07 2018 00:33:39 GMT+0800 (CST) 1509\n// executedAt  Mon May 07 2018 00:33:39 GMT+0800 (CST) 2015\n// executedAt  Mon May 07 2018 00:33:40 GMT+0800 (CST) 2521\n// executedAt  Mon May 07 2018 00:33:40 GMT+0800 (CST) 3027\n// executedAt  Mon May 07 2018 00:33:41 GMT+0800 (CST) 3529\n// executedAt  Mon May 07 2018 00:33:41 GMT+0800 (CST) 4037\n// executedAt  Mon May 07 2018 00:33:42 GMT+0800 (CST) 4538\n// executedAt  Mon May 07 2018 00:33:42 GMT+0800 (CST) 5040\n// executedAt  Mon May 07 2018 00:33:43 GMT+0800 (CST) 5546\n// executedAt  Mon May 07 2018 00:33:43 GMT+0800 (CST) 6052\n// executedAt  Mon May 07 2018 00:33:44 GMT+0800 (CST) 6555\n// executedAt  Mon May 07 2018 00:33:44 GMT+0800 (CST) 7059\n// executedAt  Mon May 07 2018 00:33:45 GMT+0800 (CST) 7564\n// executedAt  Mon May 07 2018 00:33:45 GMT+0800 (CST) 8068\n// executedAt  Mon May 07 2018 00:33:46 GMT+0800 (CST) 8573\n// executedAt  Mon May 07 2018 00:33:46 GMT+0800 (CST) 9080\n// executedAt  Mon May 07 2018 00:33:47 GMT+0800 (CST) 9586\n// executedAt  Mon May 07 2018 00:33:47 GMT+0800 (CST) 10092\n```\n\nAccording to the running result, As the counter become bigger, the delay will become much longer.\n\nFor example, if `count === 10`, the delay is only `40ms`, but when the count become `20`, the delay is `92`. It is due to the nature of Javascript's single thread, `setTimeout` jobs could not running on concurrency. instead, they could be blockded if the `main thread` is busy on other things.\n\n`webWorkers` provide a method to do a single job in a seperate thread. This job will not be affected by main thread's blocking. Then it also has a hand-on method `postMessage` to communiate with `main thread`.\n\n### -CronrWorker(pattern: string)\n\n| Property | Description | Type | Required|\n| -------- | ----------- | ---- | --- |\n| pattern  | `cron` macro format string | string | yes|\n\n### Basic `CronrWorker` Usage\n\n```js\nimport CronrWorker from 'cronr/CronrWorker'\n\nconst worker = CronrWorker(pattern);\nworker.onmessage = (e) =\u003e {\n  const data = e.data;\n  const { nextTick, triggerAt, hit, status, action } = data;\n\n  if (action === 'trigger') {\n    this.store.set(hit, {\n      triggerAt,\n      nextTick,\n    });\n    this.setState({\n      count: this.state.count + 1,\n      status,\n    });\n  }\n\n  if (action === 'updateStatus') {\n    this.setState({\n      status,\n    });\n  }\n};\n\nworker.onerror = (e) =\u003e {\n  const { message } = e;\n  console.log(e.message);\n};\n```\n\n## Cronr Macro Pattern\n\nIt mainly inspired from [Cron - Wikipedia](https://en.wikipedia.org/wiki/Cron). Comparing with original format, it follows the basic `syntax`; For example, Every pattern is seperated by space; It still support special meaning characters(`-`, `,` and `*` etc);\n\nHowever, it has addtional enhancement. Recently, it support time format till milliseconds. Just as follows showing.\n\n```bash\n*   *   *   *   *   *   *\n┬   ┬   ┬   ┬   ┬   ┬   ┬\n|   |   |   |   |   |   |\n|   |   |   |   |   |   |_________  day of week (0 - 6)\n|   |   |   |   |   |_____________  month (1 - 12)\n|   |   |   |   |_________________  day of month (1 - 31)\n|   |   |   |_____________________  hour (0 - 23)\n|   |   |_________________________  minute (0 - 59)\n|   |_____________________________  second (0 - 59, optional)\n|_________________________________  milliSecond (0 - 999, optional)\n```\n\n### How to write an valid macro pattern\n\nYou must provide a string which combines with at least `5` valid macro token(`*` or `1,2,4-5` will be considered as a token); It means if the token length is less than `7`, it will has an auto-completion on the heading position.\n\n```js\nconst patten = '* * 5 * * * *'   // retain the same\nconst pattern = '5 * * * *';     // =\u003e '* * 5 * * * *'\nconst pattern2 = '5 * * * * *';  // =\u003e '* 5 * * * * *'\n```\n\n### Simple macro samples\n\n- _Pay attention to the token length_\n\n```js\n'* * * * * * *'       // running on every millisecond\n\n'*/10 * * * * *'      // running on every 10 seconds\n\n'30 4 1,15 * 5'       // run at 4:30 am on the 1st and 15th of each month, plus every Friday\n\n'15 14 1 * *'         // run at 2:15pm on the first of every month\n\n'5 4 * * sun'         // run at 5 after 4 every sunday\n```\n\n\u003e if both \"day of month\" and \"day of week\" are restricted (not \"*\"), then one or both must match the current day.\n\n## Todo\n\n### Nonstandard predefined scheduling definitions\n\nTo support `preset` macro pattern, such as `@yearly` which means run once a year at midnight of 1 Jan.\n\n## Futher Reading for Cron Macro\n\n### Online tools to simulate cron pattern\n\n- [Free Online Cron Expression Generator and Describer - FreeFormatter.com](https://www.freeformatter.com/cron-expression-generator-quartz.html)\n\n- [Describes Cron expressions as human readable text](https://cronexpressiondescriptor.azurewebsites.net/)\n\n### Wikis\n\n- [Cron - Wikipedia](https://en.wikipedia.org/wiki/Cron)\n- [crontab(5)](https://www.freebsd.org/cgi/man.cgi?query=crontab\u0026sektion=5\u0026manpath=freebsd-release-ports)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryuever%2Fcronr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryuever%2Fcronr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryuever%2Fcronr/lists"}