{"_id":"shutdown-handler-krlpatch","_rev":"3-cd86b0e1edb8864cf3248c8917a87e96","name":"shutdown-handler-krlpatch","description":"Gives the ability to execute code upon closing a Node.js application.","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"shutdown-handler-krlpatch","version":"1.0.1","author":{"name":"Robert Böhm"},"description":"Gives the ability to execute code upon closing a Node.js application.","main":"shutdown-handler.js","repository":{"type":"git","url":"git+https://github.com/rynti/node-shutdown-handler.git"},"keywords":["shutdown","handler","hook","event","events","exit","sigterm","sigkill","ctrl","terminate","kill","process","stop"],"license":"MIT","engines":{"node":"*"},"gitHead":"6b0d6af4ed42b21bf5d206e2af3deaeaab87b66e","bugs":{"url":"https://github.com/rynti/node-shutdown-handler/issues"},"homepage":"https://github.com/rynti/node-shutdown-handler#readme","_id":"shutdown-handler-krlpatch@1.0.1","scripts":{},"_shasum":"2c05b68ff4792d8b3d8c667ea85667b25d83825f","_from":".","_npmVersion":"2.9.1","_nodeVersion":"0.10.35","_npmUser":{"name":"krlkrl","email":"kristoffer@rymdkoloni.se"},"dist":{"shasum":"2c05b68ff4792d8b3d8c667ea85667b25d83825f","tarball":"https://registry.npmjs.org/shutdown-handler-krlpatch/-/shutdown-handler-krlpatch-1.0.1.tgz","integrity":"sha512-g3fHrd9xWCBgzWFkOiQxdWXUsr5Vy6KAEVdERoaf2YZPHxTIaGTAHg7QnSdqx0rxsb7JvhOdrY9xOJrIJ8lABA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDaX+FKk7sENP+lR4Rn2WO0hV3s2Kj+f2LJGOe0KBwnjAIhAJskxkvtVVJuDhABSeFZswwVJrCAcTzPIaYYMbZ+QhsI"}]},"maintainers":[{"name":"krlkrl","email":"kristoffer@rymdkoloni.se"}]}},"readme":"Node.js Shutdown Handler\n========================\n\nCreates the ability to execute code upon closing a Node.js application.\n\n## Installation\n\n```sh\n$ npm install shutdown-handler\n```\n\n\n## Usage\n\nIn order to simply execute code prior to closing the application, add an event listener for the `exit` event:\n\n```js\nrequire('shutdown-handler').on('exit', function() {\n  console.log(\"Shutdown...\");\n});\n```\n\nBy default however, the application gets automatically closed after the events have been triggered. In order to avoid this default behaviour, simply execute the `preventDefault` function on the passed event object:\n\n```js\nrequire('shutdown-handler').on('exit', function(e) {\n  e.preventDefault();\n  console.log(\"This application shall not be closed!\");\n});\n```\n\n\n## Windows CTRL+C behaviour\n\nThe original usage for this module was to immediately close the application when I were to press CTRL+C in my console. Usually the console then asks if I'm sure whether I want to stop the current batch and that kind of annoyed me. So, in case you're sharing my opinion about this, you may use this module in order to make CTRL+C work properly.\n\n\n## License\n\nCopyright (c) 2013 Robert Böhm\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","maintainers":[{"name":"krlkrl","email":"kristoffer@rymdkoloni.se"}],"time":{"modified":"2022-06-26T19:12:59.648Z","created":"2015-06-05T11:56:04.029Z","1.0.1":"2015-06-05T11:56:04.029Z"},"homepage":"https://github.com/rynti/node-shutdown-handler#readme","keywords":["shutdown","handler","hook","event","events","exit","sigterm","sigkill","ctrl","terminate","kill","process","stop"],"repository":{"type":"git","url":"git+https://github.com/rynti/node-shutdown-handler.git"},"author":{"name":"Robert Böhm"},"bugs":{"url":"https://github.com/rynti/node-shutdown-handler/issues"},"license":"MIT","readmeFilename":"README.md"}