{"id":13508804,"url":"https://github.com/krasimir/navigo","last_synced_at":"2025-05-14T02:08:56.338Z","repository":{"id":44404510,"uuid":"44522216","full_name":"krasimir/navigo","owner":"krasimir","description":"A simple vanilla JavaScript router.","archived":false,"fork":false,"pushed_at":"2023-08-04T08:49:48.000Z","size":25636,"stargazers_count":2781,"open_issues_count":41,"forks_count":248,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-05-06T07:40:26.418Z","etag":null,"topics":["history","javascript","router"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/krasimir.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-10-19T08:50:36.000Z","updated_at":"2025-05-05T03:24:52.000Z","dependencies_parsed_at":"2022-07-17T04:30:31.657Z","dependency_job_id":"736d27ec-15ab-489f-a31f-8acff3be0089","html_url":"https://github.com/krasimir/navigo","commit_stats":{"total_commits":393,"total_committers":29,"mean_commits":"13.551724137931034","dds":0.1323155216284987,"last_synced_commit":"863eef742be008150f5561ec04ee0ed43c771869"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasimir%2Fnavigo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasimir%2Fnavigo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasimir%2Fnavigo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krasimir%2Fnavigo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krasimir","download_url":"https://codeload.github.com/krasimir/navigo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253381671,"owners_count":21899749,"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":["history","javascript","router"],"created_at":"2024-08-01T02:00:58.704Z","updated_at":"2025-05-14T02:08:51.327Z","avatar_url":"https://github.com/krasimir.png","language":"TypeScript","readme":"# Navigo\n\nA simple dependency-free minimalistic JavaScript router\n\n[![npm downloads](https://img.shields.io/npm/dm/navigo.svg?style=flat-square)](https://www.npmjs.com/package/navigo)\n![size](https://badgen.net/bundlephobia/minzip/react)\n\n* [v.8+ documentation](./DOCUMENTATION.md)\n* [v.7 documentation](./README_v7.md)\n* [Examples](./examples)\n* [Changelog](./CHANGELOG.md)\n* Using React? Checkout [navigo-react](https://github.com/krasimir/navigo-react) package.\n* 🎮  Online playground here [codesandbox.io/s/navigo-example-jrui8](https://codesandbox.io/s/navigo-example-jrui8);\n\n- [Navigo](#navigo)\n  - [Selling points](#selling-points)\n  - [Installation](#installation)\n  - [Quick start](#quick-start)\n  - [Development](#development)\n  - [Building](#building)\n  - [Tests](#tests)\n  - [MISC](#misc)\n\n## Selling points\n\n* Dependency free\n* ~10KB minified, ~4KB gzipped\n* Based on [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) so it does update the URL of the page\n* Supports hash based routing too\n* Simple mapping of route to a function call\n* Parameterized routes\n* Navigating between routes\n* Hooks (_before_, _after_, _leave_, _already_)\n* Not-found and default handler\n* Easy integration with HTML links via `data-navigo` HTML attribute\n\n---\n\n## Installation\n\nDrop the following into your page:\n\n```html\n\u003cscript src=\"//unpkg.com/navigo\"\u003e\u003c/script\u003e\n``` \n\nor via npm/yarn:\n\n```bash\n\u003e npm install navigo --save\n\u003e yarn add navigo -S\n```\n\n## Quick start\n\n```js\nimport Navigo from 'navigo'; // When using ES modules.\n\nconst router = new Navigo('/');\n```\n\nThe constructor of the library accepts a single argument - the root path of your app. If you host your project at `https://site.com/my/awesome/app`, your root path is `/my/awesome/app`. Then you have to define your routes.\n\n```js\nrouter.on('/my/awesome/app', function () {\n  // do something\n});\n```\n\nAt the end you have to trigger the resolving logic:\n\n```js\nrouter.resolve();\n```\n\nAfter that when you need a page change call the `navigate` method. This one changes the URL and (by default) triggers `resolve`.\n\n```js\nrouter.navigate('/about');\n```\n\nAdd `data-navigo` attribute to your page links and they'll be transformed into `navigate` callers.\n\n```html\n\u003ca href=\"/about/contacts\" data-navigo\u003eContacts\u003c/a\u003e\n```\n\nCheckout the [online playground](https://codesandbox.io/s/navigo-example-jrui8) to see it in action.\n\n## Development\n\n```\n\u003e yarn dev\n```\n\n## Building\n\n```\n\u003e yarn build\n```\n\n## Tests\n\n```\n\u003e yarn test\n\u003e yarn test-watch\n```\n\n## MISC\n\n* [A modern JavaScript router in 100 lines](http://krasimirtsonev.com/blog/article/A-modern-JavaScript-router-in-100-lines-history-api-pushState-hash-url)\n","funding_links":[],"categories":["JavaScript","TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasimir%2Fnavigo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrasimir%2Fnavigo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrasimir%2Fnavigo/lists"}