{"_id":"@brycehanscomb/oversee-promise","_rev":"12-436556538449d5967a7de4f2a0092b08","name":"@brycehanscomb/oversee-promise","description":"Utility for working with JS promises throughout their lifecycle","dist-tags":{"latest":"2.1.1"},"versions":{"1.0.0":{"name":"@brycehanscomb/oversee-promise","version":"1.0.0","description":"Utility for working with JS promises throughout their lifecycle","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{"babel-runtime":"^6.5"},"devDependencies":{"dist-es6":"^0.2.2"},"_id":"@brycehanscomb/oversee-promise@1.0.0","_shasum":"addfc28ecf21a2d1d06ed60cfa82152860f82d8a","_from":"dist","_resolved":"file:dist","_npmVersion":"3.7.3","_nodeVersion":"5.9.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"addfc28ecf21a2d1d06ed60cfa82152860f82d8a","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.0.tgz","integrity":"sha512-As1yDfjVyCEIpwVqw18wirAdER59a4+YC2a+4cCmgukh/YcwDIIS/2pgQwGGiRry+t5QXNO/ZOzd/uWIHKh4Nw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkVR/E/mlGpSQqtF+0tKH0f01p6yc2epzQ2lsxPzNchgIhAMDiGhfOA09rnP3lesPoEQqGe7NI2hE7aBtE59gn9HHI"}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.0.tgz_1469541397033_0.5194048937410116"}},"1.0.1":{"name":"@brycehanscomb/oversee-promise","version":"1.0.1","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"4df810827e21f608c3be63a680f120ceb53f6212","_id":"@brycehanscomb/oversee-promise@1.0.1","_shasum":"2018ff9f193b0210041adf75adf42125048d8e91","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"2018ff9f193b0210041adf75adf42125048d8e91","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.1.tgz","integrity":"sha512-90hXwFfdHajTcszbssM9cKfVmwYLD+e2gRB55/YxMEnRciU1d1MwxHhBpht3IaZF9q24Pgu6CpMpZXlEUaRWcA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8mJX7XBjSF8RzDd1K1f+xM7aC+COFhXlBZZyeMMURhQIgbpX04HxxnvKhUx1ae38NKiViqEDytEwEvXA5+Ro8o8U="}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.1.tgz_1469577830136_0.5373517805710435"}},"1.0.2":{"name":"@brycehanscomb/oversee-promise","version":"1.0.2","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"5c7cd435940c3867ce286f843ec9f60a816d5598","_id":"@brycehanscomb/oversee-promise@1.0.2","_shasum":"edd9f895a4b22ea7de944b06c3ca10ba9f8e9b03","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"edd9f895a4b22ea7de944b06c3ca10ba9f8e9b03","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.2.tgz","integrity":"sha512-4y7DRfgpE/gch3jSGwsTCd3VgFN8kS6w6r+44fWhdWYlJ974K2i7brbzrddK5B6ut4lAVCOGP1WkwXOAXLDE5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHe2+VqD/191Xknrn1g/Uusjy6LgJRBkf9xC/3euVTEvAiAGZzs5/xW1UyMHtu36SihL8DRYtd01XOZmJLFWkTsGyw=="}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.2.tgz_1469577984607_0.7422147179022431"}},"1.0.3":{"name":"@brycehanscomb/oversee-promise","version":"1.0.3","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"2da3a6989d3b4ac1177248c907b78ff6510eafd4","_id":"@brycehanscomb/oversee-promise@1.0.3","_shasum":"1092d7c092d66e9889e28a2cb5d813e5aea5bf37","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"1092d7c092d66e9889e28a2cb5d813e5aea5bf37","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.3.tgz","integrity":"sha512-hYmUsmuAmfePvwxyjGmULokyw5JHkxEoimMXtGvmhL62iUH/QdDpMQ4BDYL+/M7EwtSPoWsQVrwqfTCph5lMBg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChso3P5SihsyfKUYLfJO/mJE+d6j5lgFxkjmzEnZ1dJgIhAJAXI8mTB5Vx0zlyEHzIIzECur8/aN/ZzMAFnbpxAl4E"}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.3.tgz_1469579525363_0.1578240047674626"}},"1.0.4":{"name":"@brycehanscomb/oversee-promise","version":"1.0.4","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"d485c157d4fb7904c57dcb49bfae262ff9fc3092","_id":"@brycehanscomb/oversee-promise@1.0.4","_shasum":"114f76dabd2997363be036d720aa3a44e0d538ed","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"114f76dabd2997363be036d720aa3a44e0d538ed","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.4.tgz","integrity":"sha512-eKy6Gwzi+6AZ82HXpKVSi8GmNDuCxV9raE9WqhAvlDJ0VtOuxcL+cFrcHmDuYAR6ss0eS9vYupRFXi5klpPVuw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRGdvP1Xy0yO31RU2/LWvTmhMyXvtlkyelUZI+HD7upAIhANGKEmjlGILS9cBKS01CUmzkC8LQ1XpXhJz1eCf/f3Ah"}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.4.tgz_1469579884439_0.5728121171705425"}},"1.0.5":{"name":"@brycehanscomb/oversee-promise","version":"1.0.5","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"64d89eb2b0b9a092706e9c52d21c5312f53787cd","_id":"@brycehanscomb/oversee-promise@1.0.5","_shasum":"48b21186911790e036691ff41478d09f612fe7f1","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"48b21186911790e036691ff41478d09f612fe7f1","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.5.tgz","integrity":"sha512-gcFbo7SWOOzouxNLQhfywuURbCQEQI9NLL6kRCp0x48+ueMi0vIHA0pqAcJPGluIwOBQvfote+syWSZYchI5+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChwOejkyD106jANMj4pDoZo1jRfjMkjNszBKOq0RE8EAiEAirP032J7lPYpnRNgk9KdhsRs9/qMMn6+pfgy4SGl/ac="}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.5.tgz_1469580290853_0.45787875656969845"}},"1.0.6":{"name":"@brycehanscomb/oversee-promise","version":"1.0.6","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist","src"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"0876fbc97a222c82167d2195c445c371b7695176","_id":"@brycehanscomb/oversee-promise@1.0.6","_shasum":"e0cc450b003a881f4ac1efaf898fd12ecf99f2e4","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"e0cc450b003a881f4ac1efaf898fd12ecf99f2e4","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.6.tgz","integrity":"sha512-MvDkSXOIksxnRbFRJ7eOmW/iC/3xoTkMb2JtdNxsQ04NQqdfU/yKRkmLgRZ+tlg2IS+ZI5DuYVL3ddbqDcnSEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkG+PoWJq5v8PNmjcYWexJi+MvFCvLn2mR4+FBSteHrAIhAODU3FmKPOOd9BD8pu46yc3CmSAazThf2hr3buYOfP9Z"}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.6.tgz_1469582200858_0.7679137031082064"}},"1.0.7":{"name":"@brycehanscomb/oversee-promise","version":"1.0.7","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist","src"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"0ff4ea22169fdd930ba80708fd888e060705add7","_id":"@brycehanscomb/oversee-promise@1.0.7","_shasum":"e42fef9c4779d0bd01337c72676ef2d9a8f372a7","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"e42fef9c4779d0bd01337c72676ef2d9a8f372a7","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-1.0.7.tgz","integrity":"sha512-AVOeeYnFYUglwsiVuLpXvXAgcAWF3zMMFmjUPJpRT5Z0iCAsIvTuxQoccwfofvE5YA3zLNkuSh32XwdjQm3cDw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEZUfxbONxPloXhgaXvvWv0kEepTG3vzjwbUIghPD1XkAiAeGpjRVHzrB+3q3hdbaO8ogN99skcSuY9vvkuemT1hZg=="}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/oversee-promise-1.0.7.tgz_1469582834426_0.5280010239221156"}},"2.1.0":{"name":"@brycehanscomb/oversee-promise","version":"2.1.0","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/overseer.js","scripts":{"test":"npm run build && mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist","src"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"e4c214ba0cb8974570a88e139f22550f855134a0","_id":"@brycehanscomb/oversee-promise@2.1.0","_shasum":"a7adefbf793258532c5b3cb5d8525912a5f26eb6","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"a7adefbf793258532c5b3cb5d8525912a5f26eb6","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-2.1.0.tgz","integrity":"sha512-/62n4ILVEOt0gausGBhvp7nM48lO9WgAYtzltGQqGaYqJDVV+3RIWm0pYHrDIJqlLoLVyn2ohaV1fPKiHNHU9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIIBkaHOggF8884MddSeb2dM5XWmj3P+zarnjC5W73xQIgRov89oMll770+tKemE7rP5fBoXTM3P1xahjRVXdOhDo="}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/oversee-promise-2.1.0.tgz_1470016428407_0.7455293270759284"}},"2.1.1":{"name":"@brycehanscomb/oversee-promise","version":"2.1.1","description":"Utility for working with JS promises throughout their lifecycle","main":"dist/index.js","scripts":{"test":"npm run build && mocha test/","build":"babel src -d dist","prepublish":"npm run build && npm run test"},"repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"license":"MIT","bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"files":["LICENSE","README.md","dist","src"],"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","dependencies":{},"devDependencies":{"babel-cli":"^6.11.4","babel-preset-es2015":"^6.9.0","chai":"^3.5.0","mocha":"^2.5.3"},"gitHead":"d895baa03810a3d40f60524e8d9b143c1a52f5dd","_id":"@brycehanscomb/oversee-promise@2.1.1","_shasum":"f30b892d91d4b3a731dddfe041de325692c8d8ed","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"},"dist":{"shasum":"f30b892d91d4b3a731dddfe041de325692c8d8ed","tarball":"https://registry.npmjs.org/@brycehanscomb/oversee-promise/-/oversee-promise-2.1.1.tgz","integrity":"sha512-TgEE22NHspVaVAYi4wh7wSa1TJD3JAty+3OYtKYyy9+dvuCzyJtc1wiidSRRx3AwQsUIPSI1AMT94wteV/cIfw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDW864VWp1bzU7VOzfNrIqZbxUEn7xCnemtBvzFrwnjQgIgLUrinbZ/F4nZJTJVZge42AI2Slx0B9iDOUUcxJHjXJ0="}]},"maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/oversee-promise-2.1.1.tgz_1470018160390_0.6570593588985503"}}},"readme":"# oversee-promise\n\nUtility for working with JS promises in an MVC web app.\n\n## Introduction\n\nWhen building SPAs on the web, one of the most common challenges is firing off\nAJAX events for external parties to deal with some data. Since these actions are\nasynchronous, the JS community has adopted the use of `Promise`s to keep track\nof the status and progress of these async requests.\n\nUnfortunately, managing each of these promises and reacting to their state in\nthe app's views requires a certain amount of overhead that increases with each\nnew asynchronous event required. This utility aims to reduce that amount of\nrequired boilerplate and provide handy utilities for making MVC apps simpler.\n\nThe wrapped promise can be analysed by the view to show the correct HTML based\non the following:\n\n* The status of the request (unstarted, executing, successful or errorred-out)\n* The final result of a successful request\n* The error and/or error message of an unsuccessful request\n\n## A Simple Example\n\nSuppose you have an angular app that displays the latest news items in a list.\nUsing `oversee-promise`, you wrap your promise call using this utiliy's default\nexport:\n\n### In Your `controller.js`\n\n```js\n/**\n* Import `oversee` for use in your code.\n*/\nimport oversee from '@brycehanscomb/oversee-promise';\n\n/**\n* `yourApi.getNewsItems()` is a function that returns a promise.\n*/\nconst newsItemsQuery = oversee( yourApi.getNewsItems )\n\n/**\n * Kickoff! Here we invoke the wrapped promise and fire off the AJAX request.\n */\nnewsItemsQuery.run();\n```\n\n### In Your `view.html`\n\nAssuming an Angular application, you can use the properties on the wrapped\npromise in various `ng-` directives:\n\n```html\n<p ng-if=\"newsItemsQuery.isExecuting\">\n    Loading your news items, please wait...\n</p>\n\n<div ng-if=\"newsItemsQuery.isSuccessful\">\n    <p ng-repeat=\"newsItem in newsItemsQuery.result\">\n        {{newsItem}}\n    </p>\n</div>\n\n<p ng-if=\"newsItemsQuery.hasMessage && newsItemsQuery.hasError\">\n    There was an error: {{ newsItemsQuery.message }}\n</p>\n```\n\nOf course, this pattern works just as well for other apps like React, Vue,\nAurelia, etc. Just keep in mind that some work might need to be done to hook up\ninto your library of choice. See the [Usage In Popular Frameworks](#usage-in-popular-frameworks)\nfor how to do this.\n\n## API Reference\n\n### Constructor Factory: `oversee(method)`\n\n* Parameters:\n  * `[function]` **`method`** (required)\n  The function that returns a promise when invoked.\n* Returns:\n  * `[Object]` **`overseenPromise`**\n  The wrapped promise with all the properties documented below.\n\nThe main method to wrap a promise. This does not affect the original `method` or\noverride any of its properties. Do not call with `new`, since this is a pure\nfactory function.\n\n### Instance Properties\n\n#### `state`\n\n* Type: `string`\n\nThe current progress of the wrapped promise's execution. Will be one of:\n\n* `'ready'` - The promise has not been invoked yet.\n* `'executing'` - The promise has been invoked and is currently pending.\n* `'success'` - The promise has successfully resolved.\n* `'error'` - The promise was rejected.\n\nNote that you should *probably* not mutate this value manually. If you want to\nchange or reset the instance, you should call [`instance.resetToReady()`](#api-resettoready)\nor [`instance.resetToExecuting()`](#api-resettoexecuting).\n\nIf you manually mutate `instance.state`, this will trigger invocation of any\ncallback passed to [`instance.subscribe`](#api-subscribe).\n\nThis utility does not support cancelling an in-progress promise.\n\n#### `message`\n\n* Type: `string`\n\nA human-readable account of what happened if the wrapped promise encountered an\nerror. By default, `message` will be set to either `error.message` (if\navailable) or simply by calling `error.toString()`. To override this behaviour,\nsee [`instance.setErrorParser`](#api-seterrorparser).\n\nIf you manually mutate `instance.message`, this will trigger invocation of any\ncallback passed to [`instance.subscribe`](#api-subscribe).\n\n#### `result`\n\n* Type: `undefined` or `any` or `Error`\n\nIf the wrapped promise was resolved successfully, `instance.result` will be set\nto whatever data it was resolved with. If the wrapped promise was rejected with\nan error, `instance.result` will be set to whatever error object it was rejected\nwith.\n\nIf the instance has not been invoked yet (with `instance.run()`) or it is\ncurrently executing (but has not resolved/rejected yet) then `instance.result`\nwill be `undfined`.\n\nIf you manually mutate `instance.result`, this will trigger invocation of any\ncallback passed to [`instance.subscribe`](#api-subscribe).\n\n#### isSuccessful\n\n* Type: `boolean`\n\nWhether the wrapped promise has resolved successfully.\n\n#### isNotSuccessful\n\n* Type: `boolean`\n\nWhether the wrapped promise has not resolved successfully. This could be for\nseveral reasons:\n\n* The request has not started yet (`instance.run()` has not been invoked).\n* The request is currently executing.\n* The request encountered an error.\n\n#### isReady\n\n* Type: `boolean`\n\nWhether the wrapped promise has not started yet (`instance.run()` has not been\ninvoked).\n\n#### isNotReady\n\n* Type: `boolean`\n\nWhether the wrapped promise is in a state other than `ready`. This could be for\nseveral reasons:\n\n* The request is currently executing.\n* The request has resolved successfully.\n* The request encountered an error.\n\n#### isExecuting\n\n* Type: `boolean`\n\nWhether the wrapped promise is currently in the process of running.\n\n#### isNotExecuting\n\n* Type: `boolean`\n\nWhether the wrapped promise is not currently running. This could be for several\nreasons:\n\n* The request has not started yet (`instance.run()` has not been invoked).\n* The request has resolved successfully.\n* The request encountered an error.\n\n#### hasError\n\n* Type: `boolean`\n\nWhether the wrapped promise has completed but has been rejected with an error.\n\n#### hasNoError\n\n* Type: `boolean`\n\nWhether the wrapped promise is not currently completed with an error. This could\nbe for several reasons:\n\n* The request has not started yet (`instance.run()` has not been invoked).\n* The request has resolved successfully.\n* The request is currently executing.\n\n#### hasMessage\n\n* Type: `boolean`\n\nWhether the wrapped promise has anything assigned to its `instance.message`\nproperty. This is usually the case if the request has encountered an error, but\nit can also be assigned at any time.\n\n#### hasNoMessage\n\n* Type: `boolean`\n\nWhether the wrapped promise does not have anything assigned to its\n`instance.message` property. This will usually be the case when the request has\nnot encountered an error, ie: it is unstarted, currently executing or has been\nresolved successfully. Be aware that `instance.result` can also be manually\nassigned at any time.\n\n#### hasResult\n\n* Type: `boolean`\n\nWhether the wrapped promise has anything assigned to its `instance.result`\nproperty. This will usually be the case if the request has completed\nsuccessfully (in which case, `instance.result` will be the response payload) or\nif the request was rejected with an error (in which case, `instance.result`)\nwill be the error that the request was rejected with. Be aware that\n`instance.result` can also be manually assigned at any time.\n\n#### hasNoResult\n\n* Type: `boolean`\n\nWhether the wrapped promise does not have anything assigned to its\n`instance.result` property. This is usually the case if the request is unstarted\nor currently executing, but it can also be assigned at any time.\n\n### Instance Methods\n\n#### `run()`\n\n* Parameters:\n  * `[any]` **`[arg1, [arg2, ...argN]]`** (optional)\n  Any arguments that should be passed to the original `method` when invoked.\n* Returns:\n  * `[Promise]` **`invokedPromise`**\n  A `then`-able promise that is the result of invoking the original `method`.\n\nIf the original `method` would take any arguments when invoking it normally,\npass them into `run`.\n\n#### <a name=\"api-subscribe\"></a>`subscribe(callback)`\n\n* Parameters:\n  * `[function]` **`[callback]`** (required)\n  A method to invoke when the internal state of the instance has changed.\n* Returns:\n  * `[overseenPromise]` **`this`**\n  The instance of the `overseenPromise` to which this method belongs.\n\nPassing a function into this method will act as a listener for updates to the\ninstance's internal state. `callback` will be invoked with the following\narguments:\n\n1. `[string]` **`event`**\n  The type of internal happening that just occurred. Will be one of:\n  * `BEGIN_EXECUTING` - The wrapped promise begins executing (usually in\n  reaction to `.run()` being invoked)\n  * `COMPLETED_SUCCESSFULLY` - The wrapped promise has finished executing and\n  there was no error. Any data that the promise was resolved with is now\n  available to be accessed at `instance.result`.\n  * `COMPLETED_UNSUCCESSFULLY` - The wrapped promise has finished executing but\n  there was an error. More information about the error is now available to be\n  accessed at `instance.result`, and human-readable error message is available\n  to be accessed at `instance.message`.\n  * `MESSAGE_CHANGED` - The user has manually set a new value of\n  `instance.message`. This event will not be fired any other time (even if some\n  other event causes the `message` property to be changed).\n  * `STATE_CHANGED` - The user has manually set a new value of\n  `instance.state`. This event will not be fired any other time (even if some\n  other event causes the `state` property to be changed).\n  * `RESULT_CHANGED` - The user has manually set a new value of\n  `instance.result`. This event will not be fired any other time (even if some\n  other event causes the `result` property to be changed).\n2. `[any]` **`meta`** (optional)\n  Any relevant metadata that is associated with the `event`.\n\nIf `instance.subscribe` is invoked more than once, only the last invocation will\nhave its callback registered -- other previous calls will be overwritten.\n\nTo stop listening to events / state changes, call [`instance.unsubscribe`](#api-unsubscribe).\n\n#### <a name=\"api-unsubscribe\"></a>`unsubscribe()`\n\n* Parameters: none\n* Returns:\n  * `[overseenPromise]` **`this`**\n  The instance of the `overseenPromise` to which this method belongs.\n\nRemoves the subscription to `callback` passed to [`instance.subscribe`](#api-subscribe).\nThe `callback` will no longer be invoked for any internal state change.\n\n#### <a name=\"api-resettoready\"></a>`resetToReady()`\n\n* Parameters: none\n* Returns:\n  * `[overseenPromise]` **`this`**\n  The instance of the `overseenPromise` to which this method belongs.\n\nCalling this method will reset the internal state of the `instance` to be as if\nit had not been called for the first time yet. This will set the following\nproperty values:\n\n* `instance.state` will now be `'ready'`\n* `instance.message` will now be `''`\n* `instance.result` will now be `undefined`\n\nThis method does not affect any functions passed to [`subscribe`](#api-subscribe)\nor [`setErrorHandler`](#api-seterrorhander).\n\n#### <a name=\"api-resettoexecuting\"></a>`resetToExecuting()`\n\n* Parameters: none\n* Returns:\n  * `[overseenPromise]` **`this`**\n  The instance of the `overseenPromise` to which this method belongs.\n\nCalling this method will reset the internal state of the `instance` to be as if\nit were currently executing the wrapped promise. This will set the following\nproperty values:\n\n* `instance.state` will now be `'executing'`\n* `instance.message` will now be `''`\n* `instance.result` will now be `undefined`\n\nThis method does not affect any functions passed to [`subscribe`](#api-subscribe)\nor [`setErrorHandler`](#api-seterrorhander).\n\n#### <a name=\"api-seterrorparser\"></a>`setErrorParser(parserFunction)`\n\n* Parameters:\n  * `[function]` **`[parserFunction]`** (required)\n  A method to invoke when an error has occurred to get an error message.\n* Returns:\n  * `[overseenPromise]` **`this`**\n  The instance of the `overseenPromise` to which this method belongs.\n\nFor the instance to automatically assign a `message` when the wrapped promise\nencounters an error, it needs to know how to parse the error that has occurred.\nBy default, `message` will be set to either `error.message` (if available) or\nsimply by calling `error.toString()`.\n\nIf your errors do not conform to this shape, you can tell the instance how to\nextract a human-readable error message from your specific error shapes.\n\nThe `errorHandler` function will be invoked with the `error` thrown by the\nrejected wrapped promise, and it must return a human-readable error message\nstring.\n\nFor example, if your errors look like this:\n\n```json\n{\n  \"data\": null,\n  \"whatWentWrong\": \"API is down for maintenance.\"\n}\n```\n\nThen you should pass in a function that extracts the `whatWentWrong` property:\n\n```js\n/**\n * A function that can extract the error message from your specific error objects\n */\nfunction myErrorParser(error) {\n  return error.whatWentWrong;\n}\n\n/**\n * Create the instance as usual\n */\nconst myInstance = oversee( api.getSomeInfo );\n\n/**\n * Register the error parser\n */\nmyInstance.setErrorParser(myErrorParser);\n```\n\n## <a name=\"usage-in-popular-frameworks\"></a>Usage In Popular Frameworks\n\nSince `oversee-promise` maintains its own internal state, you need to tell your\nlibrary/framework when it should ingest the new state and (potentially)\nre-render your view.\n\nTo do this, pass a callback function into the `subscribe` method of your wrapped\npromise. See below for common examples:\n\n### AngularJS (v1.x)\n\nIn your controller:\n\n```js\n/**\n* Wrap the promise as usual.\n*/\nconst newsItemsQuery = oversee( yourApi.getNewsItems );\n\n/**\n* Call `$scope.$apply()` when the internal state has updated.\n*/\nnewsItemsQuery.subscribe($scope.$apply);\n```\n\n### React\n\n```jsx\n/**\n * A method that calls React's `render`\n */\nfunction onRequestChanged() {\n    ReactDOM.render(<MyApp />, targetNode);\n}\n\n/**\n * Wrap the promise as usual.\n */\nconst newsItemsQuery = oversee( yourApi.getNewsItems );\n\n/**\n * Call your re-render method when the internal state has updated.\n */\nnewsItemsQuery.subscribe(onRequestChanged);\n```\n\n### Vue\n\nNo work should be necessary for Vue since it reacts to all watched property\nchanges. If you find a case where Vue isn't aware of a state change, please file\nan issue so we can get it working!\n\n### Other Frameworks\n\nThe steps required to alert your framework of choice that it needs to re-render\nare probably similar to one of the examples above.\n\nWhatever method you use to inform your framework that it's time to re-render,\nyou should pass that method into `subscribe` so it gets notified.","maintainers":[{"name":"brycehanscomb","email":"bryce@brycehanscomb.com"}],"time":{"modified":"2022-06-12T15:31:22.580Z","created":"2016-07-26T13:56:40.389Z","1.0.0":"2016-07-26T13:56:40.389Z","1.0.1":"2016-07-27T00:03:50.401Z","1.0.2":"2016-07-27T00:06:24.841Z","1.0.3":"2016-07-27T00:32:08.713Z","1.0.4":"2016-07-27T00:38:04.680Z","1.0.5":"2016-07-27T00:44:51.089Z","1.0.6":"2016-07-27T01:16:44.495Z","1.0.7":"2016-07-27T01:27:18.013Z","2.1.0":"2016-08-01T01:53:50.345Z","2.1.1":"2016-08-01T02:22:40.641Z"},"homepage":"https://github.com/brycehanscomb/oversee-promise#readme","repository":{"type":"git","url":"git+https://github.com/brycehanscomb/oversee-promise.git"},"author":{"name":"Bryce Hanscomb"},"bugs":{"url":"https://github.com/brycehanscomb/oversee-promise/issues"},"license":"MIT","readmeFilename":"README.md"}