{"id":15138032,"url":"https://github.com/ossphilippines/ns-vue-nami","last_synced_at":"2025-09-07T03:33:13.288Z","repository":{"id":33165458,"uuid":"153789741","full_name":"OSSPhilippines/ns-vue-nami","owner":"OSSPhilippines","description":"Router companion for Nativescript-Vue's Manual Routing.","archived":false,"fork":false,"pushed_at":"2022-12-09T10:16:03.000Z","size":762,"stargazers_count":9,"open_issues_count":13,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-06T20:36:02.083Z","etag":null,"topics":["hacktoberfest","javascript","nativescript","nativescript-plugin","nativescript-vue","vue","vuejs","vuejs2"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OSSPhilippines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-19T13:47:36.000Z","updated_at":"2024-05-30T16:17:14.000Z","dependencies_parsed_at":"2023-01-14T23:45:43.125Z","dependency_job_id":null,"html_url":"https://github.com/OSSPhilippines/ns-vue-nami","commit_stats":null,"previous_names":["jofftiquez/ns-vue-nami"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/OSSPhilippines/ns-vue-nami","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSPhilippines%2Fns-vue-nami","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSPhilippines%2Fns-vue-nami/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSPhilippines%2Fns-vue-nami/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSPhilippines%2Fns-vue-nami/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OSSPhilippines","download_url":"https://codeload.github.com/OSSPhilippines/ns-vue-nami/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSSPhilippines%2Fns-vue-nami/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273992718,"owners_count":25203790,"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-09-07T02:00:09.463Z","response_time":67,"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":["hacktoberfest","javascript","nativescript","nativescript-plugin","nativescript-vue","vue","vuejs","vuejs2"],"created_at":"2024-09-26T07:04:25.653Z","updated_at":"2025-09-07T03:33:13.267Z","avatar_url":"https://github.com/OSSPhilippines.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/jofftiquez"],"categories":[],"sub_categories":[],"readme":"# ns-vue-nami [![CircleCI](https://circleci.com/gh/jofftiquez/ns-vue-nami.svg?style=shield)](https://circleci.com/gh/jofftiquez/ns-vue-nami) \u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://www.buymeacoffee.com/jofftiquez\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-green.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\nRouter companion for Nativescript-Vue 2.0's Manual Routing.\n\nYep, that's her, Nami from One Piece. Why? Coz she's a navigator.\n\n## Installation\n\n**npm**\n\n`npm install ns-vue-nami`\n\n**yarn**\n\n`yarn add ns-vue-nami`\n\n## Recommended Implementation\n\nCreate a `router` folder with an `index.js` file within your `app` folder.\n```\napp\n|- components\n|- router\n   |- index.js\n```\n\n**index.js**\n\n```javascript\nimport Vue from 'nativescript-vue';\nimport NsVueNami from 'ns-vue-nami';\nimport login from '~/components/login';\nimport dashboard from '~/components/dashboard';\nimport isAuthenticated from 'some-authentication-module';\n\nVue.use(NsVueNami);\n\nconst vm = new Vue();\n\nvm.$nami.authGuard((next) =\u003e {\n  if(isAuthenticated) {\n    next();\n  } else {\n    next('login');\n  }\n});\n\n// register all routes here.\nvm.$nami.init({\n  routes: [\n    {\n      name: 'login',\n      component: login,\n      noAuth: true,\n      entry: !isAuthenticated\n    },\n    {\n      name: 'dashboard',\n      component: dashboard,\n      entry: isAuthenticated\n    }\n  ]\n});\n```\n\n**main.js**\n\nJust invoke the router in your `main.js`.\n\n```javascript\nimport '@babel/polyfill';\nimport entry from './router';\n\nnew Vue({\n  store,\n  render: h =\u003e h('frame', [h(entry)])\n}).$start();\n```\n\n**Please note the import of the `babel/polyfill` above, this might be necessary to avoid this bug:\n`NativeScript encountered a fatal error: ReferenceError: Can't find variable: regeneratorRuntime` you can install the polyfill by running `npm install --save-dev @babel/polyfill` and importing it as seen above.**\n\n## Sample Usage\n\n**From the template**\n\n```vue\n\u003cbutton @tap=\"$nami.navigate('foo')\"\u003eGo to foo\u003c/button\u003e\n```\n\n**From script**\n\n```javascript\nexport default {\n  methods: {\n    someFunc() {\n      this.$nami.navigate('bar');\n    }\n  }\n}\n```\n\n## API\n\n**.init()**\n\n\u003e Sets all the routable components across the whole app.\n\u003e Returns the entry component to be used in main.js as frame entry.\n\nRouter properties:\n1. `name: String` - The component name of your choice.\n2. `component: Vue component` - The vue component.\n3. `noAuth: Boolean: default - false` - The component will NOT require authentication if set to true.\n4. `entry: Boolean` - Set a particular component as entry point.\n\n```javascript\nimport login from '~/components/login';\nimport dashboard from '~/components/dashboard';\n\nvm.$nami.init({\n  routes: [\n    {\n      name: 'login',\n      component: login,\n      entry: true\n    },\n    {\n      name: 'dashboard',\n      component: dashboard\n    }\n  ]\n})\n```\n\n**.authGuard()**\n\n\u003e Will decide whether the component is routable or not based on authentication status.\n\n```javascript\nimport Vue from 'nativescript-vue';\nimport NsVueNami from '../plugins/ns-vue-nami';\n\nimport login from '~/components/login';\nimport dashboard from '~/components/dashboard';\n\n// Dummy authentication status.\nconst isAuthenticated = true;\n\nVue.use(NsVueNami);\n\nconst vm = new Vue();\n\nvm.$nami.authGuard((next) =\u003e {\n  if(isAuthenticated) {\n    next();\n  } else {\n    next('login');\n  }\n});\n\nexport default vm.$nami.init({\n  routes: [\n    {\n      name: 'login',\n      component: login,\n      noAuth: true,\n      entry: !isAuthenticated // login will be the entry if isAuthenticated is false\n    },\n    {\n      name: 'dashboard',\n      component: dashboard,\n      entry: isAuthenticated // dashboard will be the entry if isAuthenticated is true\n    }\n  ]\n});\n```\n\n**.register()**\n\n\u003e Adds a new route to the list of routes on the fly.\n\n```javascript\nimport cat from '~/components/cat';\n\nvm.$nami.register({name: 'cat', component: cat});\n```\n\n**.navigate()**\n\n```javascript\n// Basic\nthis.$nami.navigate('cat-component');\n\n// With props\nthis.$nami.navigate('cat-component', {name: 'Kidlat', color: 'Black'});\n```\n\n```vue\n\u003cbutton @tap=\"$nami.navigate('cat-component', {name: 'Kidlat', color: 'Black'})\"\u003eView Cat\u003c/button\u003e\n```\n\n**.modal()** \n\n\u003e Just like `.navigate()` but shows the component on a modal.\n\n```javascript\n// Basic\nthis.$nami.modal('cat-component');\n\n// With props\nthis.$nami.modal('cat-component', {name: 'Kidlat', color: 'Black'});\n```\n\n```vue\n\u003cbutton @tap=\"$nami.modal('cat-component', {name: 'Kidlat', color: 'Black'})\"\u003eView Cat in a Modal\u003c/button\u003e\n```\n\n**.back()** \n\n\u003e Goes back to the previous component.\n\n```javascript\nthis.$nami.back();\n```\n\n```vue\n\u003cbutton @tap=\"$nami.back()\"\u003eGo back\u003c/button\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossphilippines%2Fns-vue-nami","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossphilippines%2Fns-vue-nami","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossphilippines%2Fns-vue-nami/lists"}