{"id":28509845,"url":"https://github.com/choojs/choo-hooks","last_synced_at":"2025-06-16T22:06:06.554Z","repository":{"id":57198262,"uuid":"100531096","full_name":"choojs/choo-hooks","owner":"choojs","description":"🎣 - Hook into Choo's events and timings","archived":false,"fork":false,"pushed_at":"2020-03-25T22:43:14.000Z","size":17,"stargazers_count":12,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-08T22:39:42.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/choojs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-16T20:44:49.000Z","updated_at":"2020-06-19T06:09:47.000Z","dependencies_parsed_at":"2022-09-16T13:11:00.412Z","dependency_job_id":null,"html_url":"https://github.com/choojs/choo-hooks","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/choojs/choo-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choojs%2Fchoo-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choojs%2Fchoo-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choojs%2Fchoo-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choojs%2Fchoo-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/choojs","download_url":"https://codeload.github.com/choojs/choo-hooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choojs%2Fchoo-hooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260249957,"owners_count":22980763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-08T22:37:30.147Z","updated_at":"2025-06-16T22:06:06.545Z","avatar_url":"https://github.com/choojs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# choo-hooks [![stability][0]][1]\n[![npm version][2]][3] [![build status][4]][5]\n[![downloads][8]][9] [![js-standard-style][10]][11]\n\nHook into Choo's events and timings. Useful to create loggers, analytics and\nmore.\n\n## Usage\n```js\nvar Hooks = require('choo-hooks')\nvar choo = require('choo')\n\nvar app = choo()\napp.use(function (state, emitter) {\n  var hooks = Hooks(emitter)\n  hooks.on('event', function (eventName, timing, data) {\n    console.log(eventName + ':', timing.duration + 'ms', data)\n  })\n\n  hooks.on('unhandled', function (eventName, data) {\n    console.error('No listeners for ' + eventName)\n  })\n})\n```\n\n## API\n### hooks = Hooks(emitter)\nCreate a new Choo Hooks instance.\n\n### `hook.on('log:trace', cb(…args))`\n### `hook.on('log:debug', cb(…args))`\n### `hook.on('log:info', cb(…args))`\n### `hook.on('log:warn', cb(…args))`\n### `hook.on('log:error', cb(…args))`\n### `hook.on('log:fatal', cb(…args))`\nListen for log events.\n\n### `hook.on('service-worker', cb(data))`\nListen for service worker event.\n\n### `hook.on('event', cb(eventName, timing, data))`\nCalled for events implemented at the application layer.\n\n### `hook.on('unhandled', cb(eventName, data))`\nCalled whenever an event is emitted, and there is no handler available.\n\n### `hook.on('DOMContentLoaded', cb(timing))`\nCalled whenever the DOM has loaded. Returns the `window.performance.timing`\nobject.\n\n### `hook.on('render', cb(timings))`\nCalled whenever Choo renders. Returns an object with the `render` and `morph`\nproperties.\n\n### `hook.on('resourceTimingBufferFull', cb())`\nCalled whenever the browser's resource timing buffer has filled up.\n\n## License\n[MIT](https://tldrlegal.com/license/mit-license)\n\n[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square\n[1]: https://nodejs.org/api/documentation.html#documentation_stability_index\n[2]: https://img.shields.io/npm/v/choo-hooks.svg?style=flat-square\n[3]: https://npmjs.org/package/choo-hooks\n[4]: https://img.shields.io/travis/choojs/choo-hooks/master.svg?style=flat-square\n[5]: https://travis-ci.org/choojs/choo-hooks\n[6]: https://img.shields.io/codecov/c/github/choojs/choo-hooks/master.svg?style=flat-square\n[7]: https://codecov.io/github/choojs/choo-hooks\n[8]: http://img.shields.io/npm/dm/choo-hooks.svg?style=flat-square\n[9]: https://npmjs.org/package/choo-hooks\n[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[11]: https://github.com/feross/standard\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoojs%2Fchoo-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchoojs%2Fchoo-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoojs%2Fchoo-hooks/lists"}