{"id":16186217,"url":"https://github.com/zenflow/obs-router","last_synced_at":"2025-06-12T07:32:54.654Z","repository":{"id":28133980,"uuid":"31633332","full_name":"zenflow/obs-router","owner":"zenflow","description":"Mutable observable abstraction of url as route with parameters **Deprecated**","archived":false,"fork":false,"pushed_at":"2015-06-03T15:40:00.000Z","size":956,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T15:04:57.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://zenflow.github.io/obs-router/","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/zenflow.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":"2015-03-04T02:19:57.000Z","updated_at":"2019-02-24T07:28:56.000Z","dependencies_parsed_at":"2022-09-20T23:22:07.510Z","dependency_job_id":null,"html_url":"https://github.com/zenflow/obs-router","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/zenflow/obs-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenflow%2Fobs-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenflow%2Fobs-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenflow%2Fobs-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenflow%2Fobs-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenflow","download_url":"https://codeload.github.com/zenflow/obs-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenflow%2Fobs-router/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259420615,"owners_count":22854618,"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":"2024-10-10T07:17:36.682Z","updated_at":"2025-06-12T07:32:54.638Z","avatar_url":"https://github.com/zenflow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# obs-router\nMutable observable abstraction of url as route with parameters **Deprecated in favor of [routeemitter](https://github.com/zenflow/routeemitter)**\n\n[![build status](https://travis-ci.org/zenflow/obs-router.svg?branch=master)](https://travis-ci.org/zenflow/obs-router?branch=master)\n[![dependencies](https://david-dm.org/zenflow/obs-router.svg)](https://david-dm.org/zenflow/obs-router)\n[![dev-dependencies](https://david-dm.org/zenflow/obs-router/dev-status.svg)](https://david-dm.org/zenflow/obs-router#info=devDependencies)\n\n[![npm](https://nodei.co/npm/obs-router.svg?downloads=true\u0026downloadRank=true\u0026stars=true)](https://www.npmjs.com/package/obs-router)\n\n## description\n\nObsRouter provides a two-way mapping between urls (rather pathname + query) and named routes with parameters, given a named set of pathname patterns. \n\nInstances are EventEmitters \u0026 optionally (\u0026 by default) bind to document location in the browser, using [html5-history](https://www.npmjs.com/package/html5-history) polyfill.\n\nAlso exposes static methods, `routeToUrl` and `urlToRoute`, which both take the patterns as their first argument.\n\nUses [route-parser](http://github.com/zenflow/route-parser) to match and obtain parameters from pathnames, and node native 'querystring' for query parameters.\n\nCheck out the [documentation](https://zenflow.github.io/obs-router).\n\n## links\n\n- [npm](https://npmjs.org/package/obs-router)\n- [github](https://github.com/zenflow/obs-router)\n- [documentation](https://zenflow.github.io/obs-router)\n\n## installation\n\n```\nnpm install --save obs-router\n```\n\n## example\n\n```js\nvar ObsRouter = require('obs-router');\nvar presenter = require('./presenter');\nvar api = require('./api');\n\nvar router = new ObsRouter({\n    home: '/',\n    blog: '/blog(/tag/:tag)(/:slug)',\n    contact: '/contact'\n}, {\n    //bindToWindow: false, // would prevent binding to document location on the browser\n    initialEmit: true // cause to emit events after nextTick even though nothing has changed\n});\n\nrouter.on('route', function(route, params, old_route, old_params){\n    presenter.updatePage(route, params);\n});\n\nrouter.on('blog', function(params){\n    if (params){\n        if (params.tag){\n            api.getBlogsByTag(params.tag).then(function(blogs){\n                presenter.updateBlogQuery(blogs);\n            });\n        } else if (params.slug){\n            api.getBlogBySlug(params.slug).then(function(blog){\n                presenter.updateBlog(blog);\n            });\n        }\n    }\n});\n```\n\n## changelog\n\n### 2.0.5\n\n* Fixed readme\n* Deprecated\n\n### 2.0.4\n\n* One dependency for lodash utilities\n\n### 2.0.3\n\n* Added commit task to docs gulpfile using [gh-pages-commit](https://github.com/zenflow/gh-pages-commit)\n\n### 2.0.2\n\n* Improved documentation\n* fixed google analytics for docs\n\n### 2.0.1\n\n* Improved documentation\n* fixed package.json scripts.test command for unix","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenflow%2Fobs-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenflow%2Fobs-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenflow%2Fobs-router/lists"}