{"_id":"@addr/debouncer","_rev":"5-6812bad6ca3e271b8ec87b29588b76e0","name":"@addr/debouncer","dist-tags":{"latest":"0.8.4"},"versions":{"0.8.0":{"name":"@addr/debouncer","version":"0.8.0","description":"This library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time. The instance won't start the timer unless you call the right function. It also provides several events to help you trace ","main":"index.js","scripts":{"test":"mocha tests/**/*.test.js"},"keywords":["debouncer"],"author":{"name":"Amaro Duarte"},"license":"ISC","dependencies":{"lodash":"^4.17.11"},"devDependencies":{"chai":"^4.2.0","mocha":"^6.1.4","sinon":"^7.3.2"},"gitHead":"27a4e736cbf57410683e90fb0812ff8ba340a390","_id":"@addr/debouncer@0.8.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"addr","email":"amarito93@gmail.com"},"dist":{"integrity":"sha512-xDV1BwR+NjPIGfX4+FU2GmLKWrMYXWUNLj5iuZ7o7hbFeCSppi5ziOJkx2bSjHTvVZ2aZW15GZ8PHLP2lyitVA==","shasum":"294795bd4c3fa250e5ade5a14ec31ba9570d2b7b","tarball":"https://registry.npmjs.org/@addr/debouncer/-/debouncer-0.8.0.tgz","fileCount":7,"unpackedSize":32170,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdJMQgCRA9TVsSAnZWagAAKsMP/jnhJ+Tq7pF2Ex05YSLy\n0TnGX3OkYxFZDZsMpZFR2vw74GsTdVrWtk9LTki+ZJ384jtkyvbI8ov+YHJI\nxLYj35n1hi4lKg1J0F9ZnadjqqpzjGE9yu3v4mXGCv8IwjpRGT615C2NeIvg\nBPl/+EwRNt2PGuF8oNRE3T9F+deF8TsHJ8fZr4uInk4A/OFRckanJDe06Yvp\np+0TZEH/jR5c//sYpWgVBQp3brfH/FcCxW1IROiX9YdevuhSjE/CNcS/V3tf\nXQk6RrHg+thJd/oHUIIUZO335vO9Xhy1FsFFVNsD1tyAYxEz1e/XgzJ9wTwx\nnP5SkHtKLKRwI87bekffW3cJUGuK+XYWRJ12Z4wggjOcRCc5TTONl8EokXg6\nz19g+kKXCT8vDXK/Qv3dOANgUgm1N+nGJOB18XI2Rh7/iw4tdGD3yLoeuSzE\nAiIeNhwKDKXu6Ke4ZWmt0CVjsC5YdPZHNbYpVBdwnK14F4hZV5c9jc4r1h2A\nrpd8A1X+SZ72mZugkYNceULAXXvl0y5cOgjv1FvcpeRVGh8X7Mf5ctn74OZ/\nMSZkcLYz7Lav9FfUAkF7toIQXi9Y/6TcgsILhx/nqDzsQ3CBa0UED8eYDSRQ\nMTpIskU3WD0djEsXL9c2J0DVdeOG2jzwXuFHxpYxJlyGG0erG0FavgtAUipG\nrRfs\r\n=Unws\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHEblQwQgSCazCEvS1iauXxsv2g7h5+K6oDCeN8eyse8AiEAijzs4/jeWR9elUxDFdOQOFK6bCWk49e5yQZvF06pUXI="}]},"maintainers":[{"name":"addr","email":"amarito93@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debouncer_0.8.0_1562690591832_0.9749094608312352"},"_hasShrinkwrap":false},"0.8.1":{"name":"@addr/debouncer","version":"0.8.1","description":"This library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time. The instance won't start the timer unless you call the right function. It also provides several events to help you trace ","main":"index.js","scripts":{"test":"mocha tests/**/*.test.js"},"keywords":["debouncer"],"author":{"name":"Amaro Duarte"},"license":"ISC","dependencies":{"lodash":"^4.17.11"},"devDependencies":{"chai":"^4.2.0","mocha":"^6.1.4","sinon":"^7.3.2"},"gitHead":"b7b250eb258479c6b7af9b127a1c3550a843e951","_id":"@addr/debouncer@0.8.1","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"addr","email":"amarito93@gmail.com"},"dist":{"integrity":"sha512-kjYYc2FdpvaPU0CGqziTqqd4ePIhg9a1n09u1atjlR0WN8JNLaaReZIsQssnlVNgR2MIVAkxukP2jkevVi7nYw==","shasum":"419db950fb46b5fdb0be6d21d660a186cc1ed94d","tarball":"https://registry.npmjs.org/@addr/debouncer/-/debouncer-0.8.1.tgz","fileCount":7,"unpackedSize":32670,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdJMXMCRA9TVsSAnZWagAAzCcP/id6lE6oy67Gv5pETk9J\nxXsLUIK3H/i4GGaBhuLNINmFPAQeCL7UBUkqjLRNV85Iq7dGP4OWxy29qyqY\nkm3amCWEIYwPvqrKHnHbOiKs00MKWAeLsfvFUFDi9kre5FwuUpxJz3KAC5OV\njxVzC7S0e+MRr1EOZFVawfN/JYV6Xn+z8f9AIYs8hv1RJB4OrFT1pjIZ2m48\nPcAdHk3nQmsX0TgVt5yBultEPltYvqXPiYdt3Tz/qL9vKTkNCJz6UGe7Ipnj\nFbdiZkJnIyZd3gCehsqX/J1jEwbH3UMuKfadzTpgFJva1o3xIuhAq9FIYqNp\nnzyk/rEheO0oEwW+pKRYw+kFJ84oqRSp6TdCOK6gYQHQ5GVBqXz7nWuKQd9R\n61GcmVRs6T8C0PVm+vGrmm5mmUBIcctUILeE000+KdBPU5wCiCroiLflvrQJ\nO6Fg/8sfKPym+u8a0lyLIi2sF5CinxiVv+vq78/caqiMpCeIOthXvqh01XHB\nbK+aasQJXURW0PND4wjzn0lqWdf3kirQ6zoRK12DRq3QeyJCyyAoQXlJzdts\nU3U0l9zTayoRyrOh5qRaunzhTlhEqrXMeYNSe0Em99GvnZGFTVED/82iggp/\nZ7Gh9pceFezl3v7nwg4Qgef/L0al362MQb1cdn6+sPDlsGixDSqdMwDEhVBL\nz9MX\r\n=twgn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDIyi+KxEB4ENdFfbxndqHS0O+uEfioNxYFGh14NtHQUAiEAhdEyIpbrricQF2njLGAUoNxqU0HKcz1N7igy1w8GcqE="}]},"maintainers":[{"name":"addr","email":"amarito93@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debouncer_0.8.1_1562691019999_0.49169367344044446"},"_hasShrinkwrap":false},"0.8.2":{"name":"@addr/debouncer","version":"0.8.2","description":"This library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time. The instance won't start the timer unless you call the right function. It also provides several events to help you trace ","main":"index.js","scripts":{"test":"mocha tests/**/*.test.js"},"keywords":["debouncer"],"author":{"name":"Amaro Duarte"},"license":"ISC","dependencies":{"lodash":"^4.17.11"},"devDependencies":{"chai":"^4.2.0","mocha":"^6.1.4","sinon":"^7.3.2"},"gitHead":"c99a02e2f97364869273eec7dec168bd615da98c","_id":"@addr/debouncer@0.8.2","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"addr","email":"amarito93@gmail.com"},"dist":{"integrity":"sha512-G74HU2VKgP7/Sdha8sRb2MvVqWp9zlZocfCPLTW4Y7FYtWDNs//2tHpaSKpN/MZd/NERJxg0JOyRTIntN1nKFA==","shasum":"6f2b9124d60b8c11750e30db3df712a42a892943","tarball":"https://registry.npmjs.org/@addr/debouncer/-/debouncer-0.8.2.tgz","fileCount":7,"unpackedSize":32726,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdJMeFCRA9TVsSAnZWagAAcxEP/2BHZSARglek5tAHL1tB\nqvCCWWktzzl4+e3ad5DgGM64aodp7LZd4WNgLEKXrkZhS81wi+VauDMAVvwc\njf+miRkvZLVShS/XojFaSa9HDDnNvlpc3r7K7AOFDV9qhbRYEV2nrfybIID3\n6hpo42xQldcTXDLGitEMvXpZhm0hJGsxSaST1ALn2lrxHZjvHv+b32qsnFba\nnVphC71lWUvS9+cm/8BOb7rL89O8LVq2EUS6MLrTiu6UpC6SS/MrnVxxdVsP\nx+vedLZl2mySnR4kagBQuYFxsH4V7+dWeGB0rCp2xk7/4P7soYWx5Ywxnak0\nR1jdfQXYu3GUWynwmWn3FF/jcG3jEJgnG19cXyr0+4wpLitHGp6QUYOhv4xP\nfwIQKu/uxNol7O8BszxMo3wJACAEz8YvDamps3HzHxZ0o6fqqqqd3aeF1anm\nVv9hs/6z/gfoJP0QO5mvpSJFu6Lb5EdU2cKoBITDCTGpPhGFLJn2CEg8edNZ\n6Cn6oRI8rQkoLElz+Gt1tE1Vp3TA+tsywH1ODpS8YqatlBY07dgU4gilKWcR\nGs/fy+6Kr0IHdvhHKf50zpHOt4wvYroyObVtFQq7pF3Sxglay3GsciqrIlLa\nSLbwYUK6ckiO++D6ACs7Ijmlnl6049h1lVjKyl59YPD6IEZrlVxi5bz5AxgG\nECz+\r\n=8E45\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEitDANXu/7O1vvj1b9k6HLhyJEtBI0P5mKJ0LxMHKt0AiEAr9kvmH4KxbFIQHOKif58+MZZGxi5hf0EFCEr/lMt5kY="}]},"maintainers":[{"name":"addr","email":"amarito93@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debouncer_0.8.2_1562691461090_0.6466155012912813"},"_hasShrinkwrap":false},"0.8.3":{"name":"@addr/debouncer","version":"0.8.3","description":"This library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time. The instance won't start the timer unless you call the right function. It also provides several events to help you trace ","main":"index.js","scripts":{"test":"mocha tests/**/*.test.js"},"keywords":["debouncer"],"author":{"name":"Amaro Duarte"},"license":"ISC","dependencies":{"lodash":"^4.17.11"},"repository":{"type":"git","url":"git+https://github.com/ADDR2/debouncer.git"},"devDependencies":{"chai":"^4.2.0","mocha":"^6.1.4","sinon":"^7.3.2"},"gitHead":"e21b9c8ca828719abbf680d69e815f7093083e6b","bugs":{"url":"https://github.com/ADDR2/debouncer/issues"},"homepage":"https://github.com/ADDR2/debouncer#readme","_id":"@addr/debouncer@0.8.3","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"addr","email":"amarito93@gmail.com"},"dist":{"integrity":"sha512-4Ff5EEjUHeKfXKs40wSEmgFahXm+Lbxulv9imQfFVqKvGfTqA8U7lowDUCBQhEbdMx0geDUaEN1mRUoZcd0IEA==","shasum":"8e47f24d205c7bb4cd141d5c388f998ca93d5487","tarball":"https://registry.npmjs.org/@addr/debouncer/-/debouncer-0.8.3.tgz","fileCount":7,"unpackedSize":33211,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdJOdDCRA9TVsSAnZWagAAG4gP/1p8EC+OBWPCb0W+NZnx\nXannBNCQ2B/MNVNDQni1avb29RxocxWr+aSSkDK/2OGwF00AZutWaogcRwry\nxRfAf2sq8Uzy2NLbLF0ymaAO6MpofqIn3SFSqBWHK6OFTDtQMJhwJjsDy/fK\nWuAxyRE+eDLjLP0/QgHWr16SNIfsuBi0Yl4POQMQ1C/gnRJBc8MYlu0D0gEY\nMGPsqOYWAbY5vhePf+0vhINYR2dWJRL2SKgTEGEl37uwqSNvh6/xezMY7ffS\noeBb6NaHVefUwCeTAHCji7OymYn32HWINqc9cPHP/lFmedq22lfFqwIrBgiJ\n/7e4gUN95q1hKLw9IEGw7YhoOSGJb3LOlcaOBGH3NbwYFn6x3sjoLVQP+oIJ\ndVpvP4Cu+n9PXvxaUoTTK2+3SX1reu7dHmiK/hzNqPWSM1dvHCKX410e4PKr\n+t4JCQnBrZMRenET8Cr2cUShFChEUCqpGz7Rcvo4uViOR6gQjVp+Au3V4zMK\nbf9TRgTnShKktsUBw3vYagiemQQ9HR1F05iBt7Eko53SbNC+C3Y1XhbtskXS\nAKmH5UVhIGeR58JXHVicLlENyVm4fzJaddDNV6rR98irAkmB4K6eebs8LBrf\nEs9SYwSZMio5q+fU+3Hb8zWiIobNXnt11dH8to5ArPite5X8KNOH9MoeZ+RN\n/qyl\r\n=UqsZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAGFzpt1vJaYaIkOMB+4ZwT5GId4gao6ElEWYu2+fGqBAiEAt8xXH2GUxhLDmsA8c/H5Cz2cRBrt7Rm1VtEkU3hixto="}]},"maintainers":[{"name":"addr","email":"amarito93@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debouncer_0.8.3_1562699586928_0.006145387558167847"},"_hasShrinkwrap":false},"0.8.4":{"name":"@addr/debouncer","version":"0.8.4","description":"This library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time. The instance won't start the timer unless you call the right function. It also provides several events to help you trace ","main":"index.js","scripts":{"test":"mocha tests/**/*.test.js"},"keywords":["debouncer"],"author":{"name":"Amaro Duarte"},"license":"ISC","dependencies":{"lodash":"^4.17.11"},"repository":{"type":"git","url":"git+https://github.com/ADDR2/debouncer.git"},"devDependencies":{"chai":"^4.2.0","mocha":"^6.1.4","sinon":"^7.3.2"},"gitHead":"d258c1e086724f74884c648297d99c4bd06c5e86","bugs":{"url":"https://github.com/ADDR2/debouncer/issues"},"homepage":"https://github.com/ADDR2/debouncer#readme","_id":"@addr/debouncer@0.8.4","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"addr","email":"amarito93@gmail.com"},"dist":{"integrity":"sha512-3tVytLK3cNv+05W1ySa12jhsEfwyJHT0TudZNWhSl9i3B05Lay0n+yXCwxYLUaWxugbXMQw6A4ysd8PZcEVvWA==","shasum":"cb2eec7a136d592c6e7c6e0c63b3132a3f391b11","tarball":"https://registry.npmjs.org/@addr/debouncer/-/debouncer-0.8.4.tgz","fileCount":7,"unpackedSize":33695,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdJRHMCRA9TVsSAnZWagAAJzsP/Aso7hKLefcLV+jllRVN\nuc7CCHggbW7A81DT1o4oFW8UB0tPqr2qfNykGr+FBLvdtCQhrjVqiiYhbwTH\nBErZExw7A4gNWnVV3nakygxUXA44kcJokIf7Hj6pxD5iTYmM4L5Za9Pzhb+H\nYMVSs7dpa3+EAQyw6hxHCKJAJJLyD1wk9RM0QOmzykIYdjifdajqpfpGUGFn\nb5w3gvmfA+rutxl7IxGpL6aCfhNjHNt60klVP4F3OgSv0LZEXHOG+tCkeLCE\n2qa/rns5eq2cnoQCngodyaEkvdMwGhZkeP0SVc1ER7SSxIrbYTA2+8/5fGhf\neWeuCH6qnuHvgl/Xbe+aOuvDQtTgvhlJX178w481Ug3QHhKFlGKh3umawzx3\nI/mcCY4CHp3cSvZi7Uve7CcegtJDQTyjEXUONauJ4SIeK7b48rDPGQA7PX7x\n67vYjuEsDuqYqceLCgDIolhSFEIsFmFieYcrE1MiQ90mQdNIq7SKGyfymz/d\n805B90W1dq2RXRE9c1Kn6s7d28IBkvnpv8gU6aKZ8cgniELNpq6k1tXKOlmT\nb7Rf2TSKPA19mFYOcpT+S41w5KeJVCKxSiMNLn55HddNOhtP1cUnfT1jgb2q\noA5fSkMiwJ7L8xIgLL3+otTqRr6eV/Ci2ihNXxwTBGOwAmSzO6Z31lhZgOAB\ntTsG\r\n=woIy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBNdBSltT5YzeW9fVBPvE4E7gsYA04ur/KmiV6LNEK+dAiEAo95vyFe3tPbXjQv/jxXU1JYzQusWy4xe9bbTCVPj2LM="}]},"maintainers":[{"name":"addr","email":"amarito93@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debouncer_0.8.4_1562710476024_0.7740663499886076"},"_hasShrinkwrap":false}},"time":{"created":"2019-07-09T16:43:11.576Z","0.8.0":"2019-07-09T16:43:12.001Z","modified":"2022-04-04T11:28:11.910Z","0.8.1":"2019-07-09T16:50:20.224Z","0.8.2":"2019-07-09T16:57:41.216Z","0.8.3":"2019-07-09T19:13:07.064Z","0.8.4":"2019-07-09T22:14:36.206Z"},"maintainers":[{"name":"addr","email":"amarito93@gmail.com"}],"description":"This library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time. The instance won't start the timer unless you call the right function. It also provides several events to help you trace ","keywords":["debouncer"],"author":{"name":"Amaro Duarte"},"license":"ISC","readme":"# Debouncer\n\nThis library provides a class that creates a recursive timer. You can specify the time and a callback to be executed after that time.\nThe instance won't start the timer unless you call the right function. It also provides several events to help you trace your code.\n\n## How to use it\n\nThere are many things you can do with this library, but I'll begin explaning the basic usage.\n\nFirst you need to create an instance of the Debouncer, then you'll be able to start the timer and the timer won't stop until some conditions are satisfied.\nIn short, this Debouncer is like a `setInterval` but every iteration waits for the execution of your callback (and also has other cool options).\n\n```js\nconst Debouncer = require('@addr/debouncer');\n\nconst instance = new Debouncer(\n    4000,\n    myData => console.log(\"I'm being executed after 4s with\", myData)\n);\n\ninstance.debounce('My data');\n\n// After 4 seconds your callback will be executed\n// The timer will still be running but after 8 seconds it won't execute your callback\n// It won't execute it because the data has not changed\n// The purpose of this debouncer is that you can change your data as many times as you want, but it will be processed\n// only if the data changed and after the time you passed.\n```\n\nThat code will run for 16 seconds. After the first 4 seconds it will execute your callback. After the second 4 seconds it won't execute\nyour callback, but this iteration is called a `null iteration`. It will run another 4 seconds without executing your callback 2 times (4*4 = 16).\n\nThe code will be executed for 16 seconds because these are the default options of the Debouncer:\n\n```js\nconst baseOptions = {\n    nullIterationsToShutdown: 3,\n    onlyCountContiguousIterations: true,\n    shutdownAfterError: true,\n    events: [\n        'shutdown',\n        'shutdownAfterCurrentIteration',\n        'errorInCurrentIteration',\n        'activeIteration',\n        'nullIteration',\n        'reboot',\n        'responseFromCallback'\n    ]\n};\n```\n\nSo, atfter 3 `null iterations` it will shutdown, but only if those iterations are contiguous (one followed by another one).\n\nIf you want to modify those options, you can pass new options like this:\n\n```js\nconst Debouncer = require('@addr/debouncer');\n\nconst instance = new Debouncer(\n    4000,\n    myData => console.log(\"I'm being executed after 4s with\", myData),\n    {\n        nullIterationsToShutdown: 5,\n        onlyCountContiguousIterations: false,\n        shutdownAfterError: false\n    }\n);\n```\n\nNow, the Debouncer will shutdown after 5 `null iterations`, but they can be separated. Also, it won't shutdown if there's an error.\n\nYou can change any of those options (even the `events` option). If you don't specify an option, it will be replaced by a default option.\n\n```js\nconst Debouncer = require('@addr/debouncer');\n\n// This instance will have the following options:\n/*\nconst baseOptions = {\n    nullIterationsToShutdown: 5,\n    onlyCountContiguousIterations: false,\n    shutdownAfterError: false,\n    events: [\n        'shutdown',\n        'shutdownAfterCurrentIteration',\n        'errorInCurrentIteration',\n        'activeIteration',\n        'nullIteration',\n        'reboot',\n        'responseFromCallback'\n    ]\n};\n*/\nconst instance = new Debouncer(\n    4000,\n    myData => console.log(\"I'm being executed after 4s with\", myData),\n    {\n        nullIterationsToShutdown: 5,\n        onlyCountContiguousIterations: false,\n        shutdownAfterError: false\n    }\n);\n```\n\n### Available functions\n\nYou can manipulate the behavior of your Debouncer by calling these functions:\n\n```js\ndebounce(data);\n\nshutdownNow();\n\nshutdownAfterCurrentIteration();\n\nreboot(time = 1000, callback = () => {}, options = {});\n\nchangeTime(newTime = 1000);\n\nchangeCallback(newCallback = () => {});\n\nchangeOptions(newOptions = {});\n```\n\n#### debounce\n\nThis function will start the timer and receives the data you want to receive in your callback.\n\n#### shutdownNow\n\nThis function will shutdown the timer even if there's a pending iteration to be executed.\n\n#### shutdownAfterCurrentIteration\n\nThis function will shutdown the timer after the next pending iteration (even `null iterations`);\n\n#### reboot\n\nIf your Debouncer got shutted down, you can use this function to restart it. It will shutdown any previous timer and iterations.\n\n```\nNote: If you shutdown a Debouncer, you must call this function in order to use it again.\n```\n\n#### changeTime\n\nThis function will allow you to change the time of your Debouncer. Any pending iterations will still use the previous time.\n\n#### changeCallback\n\nThis function will allow you to change the callback of your Debouncer. Any pending iterations will use the new callback.\n\n#### changeOptions\n\nThis function will allow you to change the options of your Debouncer. Any pending iterations will use the new options.\n\n```\nNote: Please be aware when you call this function and change the events. If you change those, then be sure to reomve all the listeners registered before.\n```\n\n## Advanced usage\n\n* The `events` option is an array so you can use whatever names for those events. You only need to maintain the same order for those events. The purpose is to\nbe flexible for already started and big projects. So, if you have already declared any of those names for another Emitter, then you can use another name.\n\n* The `shutdownAfterCurrentIteration` will also start the timer. So, if you want to only do one iteration, then you can do something like:\n\n```js\nconst Debouncer = require('@addr/debouncer');\n\nconst instance = new Debouncer(\n    4000,\n    myData => console.log(\"I'm being executed after 4s with\", myData)\n);\n\ninstance.shutdownAfterCurrentIteration();\n```\n\nThis will shutdown the timer right after the iteration, but can't pass any data. The data received in your callback will be `undefined`.\n\n* You can also call these 3 functions by emitting events like so:\n\n```\ninstance.emit('shutdown');                                // Same as instance.shutdownNow();\ninstance.emit('shutdownAfterCurrentIteration');           // Same as instance.shutdownAfterCurrentIteration();\ninstance.emit('reboot');                                  // Same as instance.reboot();\n```\n\nThe purpose is to have the abillity to listen for these events. So, if you have many places in which you do `instance.shutdownNow()` and you want to trace\nthe one tha is being executed, you can replace the calls for `instance.emit('shutdown')` and listen to that event as follows:\n\n```\ninstance.on('shutdown', () => {\n    console.trace();\n})\n```\n\nAnd it will print the precise line that emits the event.\n\n* Your callback can return a promise. To get the response (returned value) of your callback, you can listen to the event called `responseFromCallback` like this:\n\n```js\nconst Debouncer = require('@addr/debouncer');\n\nconst instance = new Debouncer(\n    4000,\n    myData => new Promise(resolve => resolve(\"I'm being executed after 4s with \" + myData))\n);\n\ninstance.on('responseFromCallback', console.log); // this will print I'm being executed after 4s with My data\n\ninstance.debounce('My data');\n```\n\n* You can prevent the Debouncer from shutting down atomatically by passing `nullIterationsToShutdown` in `0` or any falsy value. Example:\n\n```js\nconst Debouncer = require('@addr/debouncer');\n\nconst instance = new Debouncer(\n    4000,\n    myData => new Promise(resolve => resolve(\"I'm being executed after 4s with \" + myData)),\n    { nullIterationsToShutdown: null } // Any falsy value....undefined, null, 0, '', \"\", etc\n);\n\ninstance.debounce('My data');\n\n// This will never stop\n```\n\n## Tests\n\nTo run the tests you just need to run this command:\n\n```\n$> npm test\n```\n\n```\nNote: Currently I'm still working on the tests. This note will disappear once I have finished all tests.\n```\n\n## Examples of use\n\nThis library is really useful for auto saving forms. So, if you need an auto save strategy for your app, then you could use this library.","readmeFilename":"README.md","homepage":"https://github.com/ADDR2/debouncer#readme","repository":{"type":"git","url":"git+https://github.com/ADDR2/debouncer.git"},"bugs":{"url":"https://github.com/ADDR2/debouncer/issues"}}