{"id":15354909,"url":"https://github.com/capaj/mobx-location","last_synced_at":"2025-07-29T20:34:30.499Z","repository":{"id":57299651,"uuid":"78931991","full_name":"capaj/mobx-location","owner":"capaj","description":"just location as a mobx observable. Very minimal wrapper around browser location utilizing popstate event of HTML5 history api","archived":false,"fork":false,"pushed_at":"2020-08-18T23:37:34.000Z","size":236,"stargazers_count":26,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-24T21:16:41.298Z","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/capaj.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-01-14T09:44:30.000Z","updated_at":"2022-12-20T23:58:46.000Z","dependencies_parsed_at":"2022-08-26T17:00:53.890Z","dependency_job_id":null,"html_url":"https://github.com/capaj/mobx-location","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/capaj/mobx-location","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fmobx-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fmobx-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fmobx-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fmobx-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capaj","download_url":"https://codeload.github.com/capaj/mobx-location/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fmobx-location/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267754779,"owners_count":24139435,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-01T12:21:37.440Z","updated_at":"2025-07-29T20:34:30.443Z","avatar_url":"https://github.com/capaj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mobx-location\n\na browser location as a mobx observable. Minimal wrapper around browser history utilizing popstate event and HTML5 history api. Package [history-events](https://github.com/xpepermint/history-events) is used for monkeypatching.\n\nPrime usage is in your mobx observers. You can directly access the location and your app will rerender itself without the need for react-router or similar solution.\n\n```javascript\nimport makeMobxLocation from './mobx-location'\nimport { autorun, toJS } from 'mobx'\n\nconst mobxLocation = makeMobxLocation({ hashHistory: false }) // default\nconst mobxLocation = makeMobxLocation({ hashHistory: true }) // when you use hash history instead of html5 history APIs\n\nconst mobxLocation = makeMobxLocation({ arrayFormat: 'bracket' }) // default\nconst mobxLocation = makeMobxLocation({ arrayFormat: 'index' }) // will index array params in the url, refer to https://www.npmjs.com/package/query-string#arrayformat\n\nautorun(() =\u003e {\n  toJS(mobxLocation) // runs every time browser location changes\n})\n```\n\nlocation has all the standard properties:\n\n```\nhash\nhost\nhostname\nhref\norigin\npathname\nport\nprotocol\nsearch\n```\n\nplus one extra- `query`. Query is just parsed `location.search`. Query is always there even if no search params are in your location.\n\nIf you modify the query object, it will propagate back to the window location so you don't have to construct the search params yourself when modifying.\nKeep in mind that any newly added property in `query` won't be picked up-you must use `set` from `import {set} from 'mobx'` to set new props.\n\n## Browser support\n\nsame as html5 history api-so with that shim even IE9\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fmobx-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapaj%2Fmobx-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fmobx-location/lists"}