{"_id":"timer","_rev":"12-0e68c475d7b77f6fa065b5f50cb28771","name":"timer","description":"timeout utilities (promisfied setTimeout, chained timeouts)","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.1":{"author":{"name":"Markus Sieber","email":"sieber.m@gmail.com"},"name":"timer","description":"simple utility to simplifiy and chain using setTimeout/setInterval","version":"0.0.1","repository":{"type":"git","url":"git://github.com/markussieber/timer.git"},"main":"timer.js","engines":{"node":">=0.0.1"},"dependencies":{},"devDependencies":{},"_id":"timer@0.0.1","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"37fb67f98dc1f995ceac2a56761915c726fbb1f8","tarball":"https://registry.npmjs.org/timer/-/timer-0.0.1.tgz","integrity":"sha512-b8RH9ESyaWteDyqsRWe8l190C7Tm5OkGBFZN9HIwNLjrYURX3Y6qVf0n31S8JW+z1iC6jGqPA96xLvFTGcZnlQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBGpxHTKGipeYqxYtnJpI1uLr/rMiM4/G80v1C+FUt1YAiEAofpq6CctaYoFPItd9OXIsWZ40E9hD4bWwvALHMi2ylk="}]},"scripts":{},"directories":{}},"0.0.2":{"author":{"name":"Markus Sieber","email":"sieber.m@gmail.com"},"name":"timer","description":"utility function to simplify using combinations of setTimeout/setInterval.","version":"0.0.2","repository":{"type":"git","url":"git://github.com/markussieber/timer.git"},"main":"timer.js","engines":{"node":">=0.0.1"},"dependencies":{},"devDependencies":{},"_id":"timer@0.0.2","_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"9b17b1445f7d1965075fa932f375936a2f8a2804","tarball":"https://registry.npmjs.org/timer/-/timer-0.0.2.tgz","integrity":"sha512-kdYrrdfrocHsoOjKcR5xZnb9F6LjXsJUhwv5m6YhUXOEB6qoAk/P3VMQpcDk9KCig2xlRJDgHztTxuaS1Ro1NA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgfIDS3/vVF2KfXphDoE/XZ4/lT8uua17OWQC6tw4c4AIgSTEK3bhDwdp0QdhI76hIjBefWkKojkYqeDVhIaXUj0A="}]},"scripts":{},"directories":{}},"1.0.0":{"name":"timer","version":"1.0.0","description":"timeout utilities (promisfied setTimeout, chained timeouts)","main":"timer.js","directories":{"example":"example","test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"ISC","_id":"timer@1.0.0","_nodeVersion":"12.3.1","_npmVersion":"6.9.0","dist":{"integrity":"sha512-ztqcilsJyvZuFvWF5OOIaF1fqusYSYnu0oludWhL5wtjheqRT4+u1e+3LANHndac1pDELmRo0D3hSKJyKuO4TA==","shasum":"2819b74f3c36d91d7fb45d1bde525964b9d929b1","tarball":"https://registry.npmjs.org/timer/-/timer-1.0.0.tgz","fileCount":11,"unpackedSize":16534,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpODZCRA9TVsSAnZWagAAvVAP/jU23G8YEzQKruya1Dib\nOPCa5/RxDdQpuPGUAw2P+pj8V9ZTzNZMbyPdgPHvpCtJn1VqKGorVajv65iG\nD124GG+XG5mx7upxW0ADGX+2bylaZnjpvoJTwlE1a6ZIKumyMHXB5iPWRCIJ\nbor1hoL+NkdRuV+tfjF7fQU60/cfv2mWUke64pEdwQgu7E6ONTkpniHBW+TD\nvM7oO/09K9q8T8gtyYLT6CLrCyD3/AEKd5Fg4BpqdbJQlJBjdO7xvvsbgw8K\n28aO+sD6xNXoOQ6u/f3MIuBIBXzAUOgusUUx34IGEwzxTDkw86pg83xtHRj9\np9bKEo7qxv+aksLj4LNcSUfL7M/6DQqc3qnenqFT1aO7kXwuOrVma/bwnMqB\n9ZGVTCApDjbd014gmf5YGEOv11O7YhisCyaRYOigArs4AjiAE40hCX8XRoAT\nBxqJPswyRLOXjZJIaRaCCky4c9G6K4Al0X0SKDtfJ1/1RPU9OLHozyrXvw5R\nOgH4bX+AjCkdGi92Q3gswUR7iolgPrZ+ngsGg0UfQtgQhq6FMAvypEgGWTVm\nU8lsIsTGfgmlx3yhj3+3+bslQFx1vEczSaIGsf9jvBy4+FkAwBciFOVnWKLs\nTO5K8CPpMp/H92j089FWLwtCtXhotVJrWmUehSvWQ9xPR79+wP2O1zZ45sHX\n4B7S\r\n=B1ms\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG+r/Nn4/7Eq/YSAWY1PUHp+4BtqyR9V5Vqe1+FYmupOAiBU61vvOUwqTcyWC4ksX1UTQkx7nyy5EeUbpzZalZ35VA=="}]},"maintainers":[{"name":"markussieber","email":"sieber.m@gmail.com"}],"_npmUser":{"name":"markussieber","email":"sieber.m@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timer_1.0.0_1571086552965_0.7301122525659942"},"_hasShrinkwrap":false},"1.0.1":{"name":"timer","version":"1.0.1","description":"timeout utilities (promisfied setTimeout, chained timeouts)","main":"timer.js","directories":{"example":"example","test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Markus Sieber"},"license":"ISC","keywords":["setTimeout","setInterval","Promise","Timeout","timer"],"_id":"timer@1.0.1","_nodeVersion":"12.3.1","_npmVersion":"6.9.0","dist":{"integrity":"sha512-sTkUaUaW3qc2aklbIkGYKPX4S4M5oneaIFroi/igorM+vSmKCBYwkfEjBK7bdgrStdR+M0GFgeGnxTG1FtJZ/w==","shasum":"98ffb7928e76c6c352ebf9b8943895c2eab07581","tarball":"https://registry.npmjs.org/timer/-/timer-1.0.1.tgz","fileCount":11,"unpackedSize":16647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpOHACRA9TVsSAnZWagAAE7MQAIrTj/zkFlkHkE0TNUI8\nQRTWpcyrENB3i4HopdscKkPmn+RMqz9wxClmg5i0hEXsZuavLKbiI/Vs008B\nukm8+fdmRSSm4182UPo7hJpmmfUGVBsH43WWG3/9zs+EEfw/GbFbdW2FLwYI\n4b/esoTTWReuuEFdwKHE/KOLu0i2rHo/Agn9ubZuvv6lhO2KSx5QzNKzyb52\nAUyZhkV1xA1QHx6GQdadw9hWuziarE+HefHWoL9yUnXHMr3DwW/1GkaPpmUz\nYnxTcoKB8lvJhKvsVgG2PvJkjGRz+8+Dzg0O5ik8LXFPz8JVRU0hv227IVDO\nSpG+N02qV8+Me4CVK/VdWXbkEUrCyRJiU57KCylLZmC/gS/8RlvmghJ8CqPQ\nltkC8ucrk1d5Csay0YBJT9JXks2/N+OsAc6KW8zy/JJhOAmNfnkUY/5jT4ud\neqKEWGk0iGvlFrHBjF+9g+7OBTJg88gkzFB1pu/MZeJ0NM46EenNj5/PF93a\n98/gcD9Ru57RKZot6TBagOU2A0z+zGp1GU0r4NeYjlbTmd4Y2wBsiX2iXbsh\n9ewKvNsSK5WzS+ugw9n09jE3z/TFXS2VsKs+du4LdkY2loKFprQ/p6clU6fX\nqaf92Ae1UyNlY8sYBLbrnp6rJknUHHTLkxes1PWn0HEKac9uB6mgL1sgocX+\n83mV\r\n=7TPP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHf7npFXqe8/FRhWbKTNfjcLGnQbirHGxmnfaGV4UUyHAiAYbvZv7n3QVwIA3dDR1dCZ56E7SqH8Fbs/OBZ53tjEAA=="}]},"maintainers":[{"name":"markussieber","email":"sieber.m@gmail.com"}],"_npmUser":{"name":"markussieber","email":"sieber.m@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timer_1.0.1_1571086783393_0.2927758622658272"},"_hasShrinkwrap":false}},"maintainers":[{"name":"markussieber","email":"sieber.m@gmail.com"}],"time":{"modified":"2022-06-27T06:49:25.585Z","created":"2011-05-31T15:59:00.646Z","0.0.1":"2011-05-31T15:59:01.349Z","0.0.2":"2011-05-31T21:24:53.179Z","1.0.0":"2019-10-14T20:55:53.158Z","1.0.1":"2019-10-14T20:59:43.548Z"},"users":{},"license":"ISC","readme":"\nthis package provides a utility function to promisify and unify setTimeout and \nsetInterval functions. \n\nIt also provides a comfortable way to chain multiple\nsetTimeouts with different timeouts and even a finally setInterval with\nthe same callback. \n\nAn additional feature is the auto interval function which applies\na simple setInterval which triggers at event time slots, ie\nif you call the timer.auto function with an interval of 15*60*1000 \n(15 minutes) your callback will be triggered at 00:15:00, 00:30:00, and so on.\n\n\n\nUSAGE EXAMPLE (JAVASCRIPT):\n\n    // as a promise in order to delay execution\n    await timer(300);\n\n    // use timer with Promise.race to define timeouts:\n    // timer.timeout will reject the promise after the given timeout\n    Promise.race( [otherPromise, timer.timeout(400)] );\n\n\t\n\t// simple setTimeout\n\t// same as setTimeout( cb, 200);\n\ttimer(200, cb);\n\t\n\t\n\t// setTimeout with same callback after 200ms and after 400ms\n\t// the second array element is also 200ms because it is set up after the first one (200ms+200ms = 400ms)\n\ttimer( [200,200], cb );\n\t// same as \n\t// setTimeout( 200, cb );\n\t// setTimeout( 400, cb );\n\n\t// simple setInterval\n\ttimer.interval(2000,cb);\n\t// same as setInterval(cb,2000);\n\t\n\t// setting up a interval after a timeout\n\ttimer(500,2000,cb);\n\t// this one will trigger cb after:\n\t//  500ms, 2500ms, 4500ms, 6500ms, ...\n\t\n\t\n\t// auto slot a interval (for example if you want your callback to be triggered at 00:15:00, 00:30:00, ..)\n\ttimer.auto(15*60*1000, cb);\n\t\n\t\n\t\n\t\n\t// clearing a timeout:\n\to = timer(500,cb);\n\to.clear();\n\t\n\t// if you use the clear() function on a timer with multiple timeouts or intevals, ALL of them will be cleared,\n\t// so your callback won't be triggered any more\n\t\n\n\n\t\nUSAGE EXAMPLE (COFFEESCRIPT):\n\t\n\t# with coffeescript the utility functions are even more handy\n\t\n\ttimer 200, -> console.log 'hello'\n\t\n\ttimer [500,200], -> console.log 'hello after 500ms and 700ms'\n\t\n\t# BONG every 30min at even time slots (0:00, 0:30, ..)\n\t{clear} = timer.auto 30*60*1000, -> console.log 'BONG'\n\t# end the BONG interval after 5h\n\ttimer 5*60*60*1000, clear\n\t\n\t\n\t\n\n\nQUESTIONS or feedback?\n\tyou are welcome, send me an email at sieber.m@gmail.com\n\t","readmeFilename":"README","keywords":["setTimeout","setInterval","Promise","Timeout","timer"],"author":{"name":"Markus Sieber"}}