{"_id":"@eightnineight/polling-alarm","_rev":"8-de1d305752ccd493c24b16880d56eea6","name":"@eightnineight/polling-alarm","dist-tags":{"latest":"1.1.6"},"versions":{"1.0.0":{"name":"@eightnineight/polling-alarm","version":"1.0.0","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.0.0","gitHead":"52a29c5bd25681a55a16f74c018cfdb531a5b34c","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-k4A65NP+PebAnKgVutqEYnuhE0d3PPvUF+y+6pFAEu2bTN8zUoGyXMSu5zRicaEKma4+Egnk7yoK/rzjknsa2Q==","shasum":"3fd2b04f20ead476ccb8a97bd50205a35d17393f","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.0.0.tgz","fileCount":4,"unpackedSize":5439,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4Wtb5D6b0O7ED6/tkIiHLfohkDaCaSgvmFet0MD284wIhALGS/6DtXw2ba+NJgPB97uFlykc7gahs6RXjQ+KlnJSX"}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.0.0_1699251748596_0.48012125575891673"},"_hasShrinkwrap":false},"1.0.1":{"name":"@eightnineight/polling-alarm","version":"1.0.1","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.0.1","gitHead":"8dc60455d26cf7a6af6393b97177fa42ae51624b","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-qCQp5jWw3X/EYfvUZJRKobhwSjzJo13F/P9dk1PwB+GKNwX6XBMFg7q0xYNG52/3igQx2JDSdwbTd9pOsFPUoA==","shasum":"34591d7397f88d898deb1175d0458e6a5c3f4e65","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.0.1.tgz","fileCount":4,"unpackedSize":5467,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHCKx6huKRBTbmzPU234BgvqJwIrX8KNLKgVTsAAeeq/AiEAzyoZxfwQJ/EqyxBw2YFpw74fKRap2DG64FNKaeDjEnQ="}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.0.1_1699252844130_0.2103202511553912"},"_hasShrinkwrap":false},"1.1.0":{"name":"@eightnineight/polling-alarm","version":"1.1.0","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.0","gitHead":"37b6217b13689084a7d49356c7b9eb3c473024f7","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-n80olc9KB1Hw4nlkjZlOF+YTR+OnnT+UnmTvmK5C021u9h1pNtXTgSUUCp/tPoEM7XkvPyJpEYPiA7VgLkIOMw==","shasum":"81cf3c38979a3273a882b2fb8a69ab5e6788e98d","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.0.tgz","fileCount":4,"unpackedSize":8557,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEtvyyYEDnzz5gc7TuLJRcK8By/GmMJZgwRSH+3wjH6wIgHgzTsXp7Jb/UhTPCQggZy3CPBbo19z6iKwGFVXDmwII="}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.0_1699425902666_0.975817212216233"},"_hasShrinkwrap":false},"1.1.1":{"name":"@eightnineight/polling-alarm","version":"1.1.1","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.1","gitHead":"97bf5fd97243a64a99495568551e79bb585d529a","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-uAIeKCvaixV48XfDS0nNSQb4HH7+tcTw0Zt9SuNWtfik0SmUc3MYeIN/52nZc4C6JoTjzVabU9RvkVckPDAesQ==","shasum":"a10156fd847bfc77d20a9f7dffcd5e129b90aa68","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.1.tgz","fileCount":4,"unpackedSize":8541,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBCgFYYjmL0Iv1NBW4+1II3v8pKcXawkOtbezfdzeFKzAiEA8ydDtDyvOZoVqz9AWFD7qNMLRGlBjwTYB3uDNi07UgY="}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.1_1699426614187_0.30329899624059475"},"_hasShrinkwrap":false},"1.1.2":{"name":"@eightnineight/polling-alarm","version":"1.1.2","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.2","gitHead":"f11b21c0e4e055bbd84c71fb6d3eea82789cb384","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-JEzdnrYdM4pN2RG5z+wAY7X50mXCgV2XAaZQqFe0B4a8Qpdx/EyIhAvlpuUQHzVIOuKYrtDH+VX7Xyqx5buseg==","shasum":"d0989bee0e52353af58d39afed6619b10dd8d8c0","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.2.tgz","fileCount":4,"unpackedSize":8545,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHST4cFmU9OkZrJ1mj2cz3smzA+CHSpipGWbDxjNojB6AiEAxc9Bw2pz7jbAWh+3wR5kjHTlNlycQWDSaY/zECh+NhM="}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.2_1699426737603_0.5552595368722879"},"_hasShrinkwrap":false},"1.1.3":{"name":"@eightnineight/polling-alarm","version":"1.1.3","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.3","gitHead":"350114cb9d4323231ec7a4ea657aefedbcd2beea","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-BmsYl9w1NtS7RY4X+c0ugcrO1zVECJ9duLX066V0nx6NjuU+m/QKXEjYwTQPbc+9lJ8VzS4Vaixce8fZpTuOBw==","shasum":"df75e957d8696b08c805338e050fc49d64ba0b50","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.3.tgz","fileCount":4,"unpackedSize":8807,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH0H+7839aBgG2Ye1UTj4xqEekM0LTQhSnNuqLMiKSpEAiEAjlkY5OIU+VQJo2+BjMMSgjPykEaN43+/vcPD7lWizvg="}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.3_1699427478212_0.20743568471015394"},"_hasShrinkwrap":false},"1.1.4":{"name":"@eightnineight/polling-alarm","version":"1.1.4","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.4","gitHead":"f3a5d49f16f1cf5c334185d33adb2b7c371cfd63","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-dCvXrPgJiEoynY+wZGb7hBVAB6AO/qVBg4FyuzAKT6c15sJ0q28pxJ/BMeAxf69PFWygNBwNMbyYHhXouttJrA==","shasum":"99230e7845e8516c61d5f7abe919f76c28a7572d","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.4.tgz","fileCount":4,"unpackedSize":8922,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICKwa3KTmID4HZpX7Hlns+6XeSgds1Rz6JenKksR7V9/AiEA5pooDUajY8i3Zm2YKU0HREAvpx4uXqnfs433yrPiSs8="}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.4_1699428466374_0.8595468762749863"},"_hasShrinkwrap":false},"1.1.5":{"name":"@eightnineight/polling-alarm","version":"1.1.5","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.5","gitHead":"d2bfd029eb0d4bf7a0aedee521f12c5c0b990794","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-5+koaIoZb3QN1jZ7HVt0HpKEf39uVcq80EQIdU24/Kc+N5BmzcC+DUG370XiJI4ySBsJStq1cybKk4SgFAdJBg==","shasum":"5bd7602ac821ea6d02d292174d21510ccc480b82","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.5.tgz","fileCount":4,"unpackedSize":8898,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzwnvRAYirK7/QY3ondHVRU8q+nphlhS0s7yLEV/3zSgIhAKKicyaLIdZ2PzBpYUYdbs5eFXrFXTmMtWjuJT6WQi7t"}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.5_1700226689422_0.2757701594855344"},"_hasShrinkwrap":false},"1.1.6":{"name":"@eightnineight/polling-alarm","version":"1.1.6","description":"polling alarm","main":"index.js","type":"module","scripts":{"start":"node index.js","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"keywords":["alarm","polling","timer"],"author":{"name":"CHIH-HSIN HSU"},"license":"MIT","bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"homepage":"https://github.com/eightnineight/polling-alarm#readme","dependencies":{"moment":"^2.29.4"},"_id":"@eightnineight/polling-alarm@1.1.6","gitHead":"c605d2557bf8f85ec44f3d4030f3c05c9ad8e417","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-01uRccVNV4By4fnms5NaB0O+I/wh7eUZAc8O9umiTX1hcrLkMOPmgHizNQX8CmIgjK6tL8pVzmZnojZNk+do3A==","shasum":"e6910772adb3d6fbf41f8add18b1fada11ad6c47","tarball":"https://registry.npmjs.org/@eightnineight/polling-alarm/-/polling-alarm-1.1.6.tgz","fileCount":4,"unpackedSize":10105,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfnHjFzXhIUwjZcJAXvvZ2kVGC/XtQA3nooFV1DCaMcgIhAMuh9ZbWvYGDFP/8uMFXEJdTiRBNigCKTLgfcSp77PuM"}]},"_npmUser":{"name":"eightnineight","email":"eightnineight@gmail.com"},"directories":{},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polling-alarm_1.1.6_1709003671873_0.5388387529678835"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-06T06:22:28.520Z","1.0.0":"2023-11-06T06:22:28.801Z","modified":"2024-02-27T03:14:32.675Z","1.0.1":"2023-11-06T06:40:44.307Z","1.1.0":"2023-11-08T06:45:02.870Z","1.1.1":"2023-11-08T06:56:54.341Z","1.1.2":"2023-11-08T06:58:57.757Z","1.1.3":"2023-11-08T07:11:18.371Z","1.1.4":"2023-11-08T07:27:46.564Z","1.1.5":"2023-11-17T13:11:29.563Z","1.1.6":"2024-02-27T03:14:32.024Z"},"maintainers":[{"name":"eightnineight","email":"eightnineight@gmail.com"}],"description":"polling alarm","homepage":"https://github.com/eightnineight/polling-alarm#readme","keywords":["alarm","polling","timer"],"repository":{"type":"git","url":"git+https://github.com/eightnineight/polling-alarm.git"},"author":{"name":"CHIH-HSIN HSU"},"bugs":{"url":"https://github.com/eightnineight/polling-alarm/issues"},"license":"MIT","readme":"# polling-alarm\n\n#### Use polling instead of callback for more precise control of the flow process.\n\n## Install\n\n```\nnpm install @eightnineight/polling-alarm\n```\n\n## Usage\n\n### alarmOnce\n\n```js\nimport { alarmOnce } from \"@eightnineight/polling-alarm\";\n\nlet alarm = alarmOnce(500); // 500 ms\n\nlet count = 0;\nwhile (count < 10) {\n    if (alarm.isStop()) {\n        // before you call isAlarm(), Even if alarm has already stopped, isRunningOrRinging will be true\n        if (alarm.isRunningOrRinging()) {\n            console.log(\"still running or ringing\"); // this will be printed.\n        }\n    }\n    if (alarm.isAlarm()) {\n        console.log(\"alarm once \", count + 1); // print every 500ms\n\n        if (alarm.isStop()) {\n            console.log(\"alarm stop\"); // this will be printed.\n        }\n        if (alarm.isRunningOrRinging()) {\n            console.log(\"still running or ringing\"); // this won't be printed.\n        }\n\n        alarm.restart();\n        ++count;\n    }\n}\n\nif (alarm.isRunningOrRinging()) {\n    console.log(\"still running or ringing\"); // this won't be printed.\n}\n```\n\n### alarmInterval\n\n```js\nimport { alarmInterval } from \"@eightnineight/polling-alarm\";\n\nlet alarm = alarmInterval(500); // 500 ms\n\nlet count = 0;\nwhile (count < 10) {\n    if (alarm.isStop()) {\n        console.log(\"stop\"); // this won't be printed.\n    }\n    if (alarm.isAlarm()) {\n        console.log(\"alarm interval \", count + 1); // print every 500ms\n\n        if (alarm.isStop()) {\n            console.log(\"alarm stop in while\"); // this won't be printed.\n        }\n        if (alarm.isRunningOrRinging()) {\n            console.log(\"still running or ringing\"); // this will be printed.\n        }\n\n        ++count;\n    }\n}\n\nif (alarm.isRunningOrRinging()) {\n    console.log(\"still running or ringing\"); // this will be printed.\n}\n\n// if you don't call stop(), it will keep running.\nalarm.stop();\n\nif (alarm.isStop()) {\n    console.log(\"alarm stop\"); // this will be printed.\n}\nif (alarm.isRunningOrRinging()) {\n    console.log(\"still running or ringing\"); // this won't be printed.\n}\n```\n\n### alarmCount\n\n```js\nimport { alarmCount } from \"@eightnineight/polling-alarm\";\n\nlet alarm = alarmCount(500, 10); // alarm once every 500 ms, for a total of 10 times.\n\nlet n = 0;\n\n// this will print 'alarm count' 10 times.\nwhile (1) {\n    if (alarm.isAlarm()) {\n        console.log(\"alarm count \", ++n); // print every 500ms\n    }\n    if (alarm.isStop()) {\n        break;\n    }\n}\n\nif (alarm.isStop()) {\n    console.log(\"alarm stop\"); // this will be printed.\n}\n```\n","readmeFilename":"README.md"}