{"id":32241909,"url":"https://github.com/skylark-appify/skylark-appify-routers","last_synced_at":"2026-02-20T20:01:54.834Z","repository":{"id":57362605,"uuid":"103039510","full_name":"skylark-appify/skylark-appify-routers","owner":"skylark-appify","description":"An Elaborate HTML5 Routing Framework.","archived":false,"fork":false,"pushed_at":"2021-07-11T12:25:32.000Z","size":779,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-10T23:38:42.125Z","etag":null,"topics":["framework","html","javascript","router","routing","skylark","skylarkjs"],"latest_commit_sha":null,"homepage":"http://www.skylarkjs.org","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/skylark-appify.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-09-10T15:18:48.000Z","updated_at":"2021-07-11T12:25:34.000Z","dependencies_parsed_at":"2022-08-31T01:00:19.734Z","dependency_job_id":null,"html_url":"https://github.com/skylark-appify/skylark-appify-routers","commit_stats":null,"previous_names":["skylarkjs/skylark-router"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skylark-appify/skylark-appify-routers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skylark-appify%2Fskylark-appify-routers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skylark-appify%2Fskylark-appify-routers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skylark-appify%2Fskylark-appify-routers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skylark-appify%2Fskylark-appify-routers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skylark-appify","download_url":"https://codeload.github.com/skylark-appify/skylark-appify-routers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skylark-appify%2Fskylark-appify-routers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29662567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T19:49:36.704Z","status":"ssl_error","status_checked_at":"2026-02-20T19:44:05.372Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["framework","html","javascript","router","routing","skylark","skylarkjs"],"created_at":"2025-10-22T15:49:10.218Z","updated_at":"2026-02-20T20:01:54.829Z","avatar_url":"https://github.com/skylark-appify.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# skylark-ajaxify-router\nAn elaborate front-end routing framework.\n\n## Features\n\n- Support Hashbang, HTML5 pushstate, internal implementation three routing mode, the routing mode can be set by attributes or automatically by  the framework, without affecting the implementation of the application.\n- Supports global events to implement hooker functions.\n- Lightweight, even if allinone is only 13k(minified),5k(gzip)\n\n## Dependences\n| Project | Status | Description |\n|---------|--------|-------------|\n| [skylark-langx](https://github.com/skylarklangx/skylark-langx)   | v0.9.1 | Javascript language extension library |\n\n##  Different builds\n|  | build | Description |\n|---------|--------|-------------|\n| full | skylark-ajaxify-router-all.js | included skylark-langx |\n| only router | skylark-ajaxify-router.js | not included skylark-langx |\n| full （development） | uncompressed/skylark-ajaxify-router-all.js | included skylark-langx |\n| only router （development）| uncompressed/skylark-ajaxify-router.js | not included skylark-langx |\n\n\n## Installation\nThere are multiple ways to install the skylark-ajaxify-router library. \n- cdn  \nhttp://registry.skylarkjs.org/packages/skylark-ajaxify-router/v0.9.2/skylark-ajaxify-router-all.js    or  \nhttp://registry.skylarkjs.org/packages/skylark-ajaxify-router/v0.9.2/uncompressed/skylark-ajaxify-router-all.js \n- npm  \nnpm install skylark-ajaxify-router --save\n- bower  \nbower install skylark-ajaxify-router\n\n## Usage\n\nRefence router module object.\n----------------------------\n\n- Using the skylark-ajaxify-router library for a AMD module.  \n```js\nrequire({\n  'paths': {\n     'skylark-langx': 'http://registry.skylarkjs.org/packages/skylark-langx/v0.9.1/skylark-langx',\n     'skylark-ajaxify-router': 'http://registry.skylarkjs.org/packages/skylark-ajaxify-router/v0.9.2/skylark-ajaxify-router' \n  }\n}, ['skylark-ajaxify-router'], function(srouter) {\n  // srouter.route(path,setting);\n});\n```\n\n- Using the skylark-ajaxify-router library for a global object named skylarkjs.  \n```js\n\u003cscript type=\"text/javascript\" src=\"http://registry.skylarkjs.org/packages/skylark-ajaxify-router/v0.9.2/skylark-ajaxify-router-all.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  // skylarkjs.router.route(path,setting);\n\u003c/script\u003e\n```\n\n- Using the skylark-ajaxify-router library for a AMD package.  \n```js\nrequire({\n  'packages': [\n    { 'name': 'skylark-langx', 'location': 'http://registry.skylarkjs.org/packages/skylark-langx/v0.9.1/skylark-langx/' },\n    { 'name': 'skylark-ajaxify-router', 'location': 'http://registry.skylarkjs.org/packages/skylark-ajaxify-router/v0.9.2/skylark-ajaxify-router/' }\n  ]\n}, ['skylark-ajaxify-router/router'], function(srouter) {\n  // srouter.route(path,setting);\n});\n```\nAdd route defines. \n-------------------\n```js\nvar homeRoute = router.route('home', { \n    pathto : '/', \n    entered (){ \n        $(\"#yield\").html($('#home').html()); \n    }      \n}); \n             \nvar pageRoute = router.route('page', { \n    pathto : '/page/:id', \n    entered(e){ \n        $(\"#yield\").html($('#page' + e.params.id).html()); \n    } \n}); \n```\n\nadd callback function for route.\n--------------------------------\n\nWhen the route is changed, the following event are triggered in order.\n\n1. exiting (for previous route) \n2. entering (for new route) \n3. entered (for new route) \n4. exited (for previous route) \n\nIn adding route at the same time, you can add the same name of the callback function, after the route is added,you can also add callback function for these events.\n\n```js\nhomeRoute.on(\"exited\",function(){ \n   console.log('good bye Home'); \n}); \n\npageRoute.on(\"exited\",function(){ \n    var field = $('[name=\"field\"]').val(); \n    if (field) { \n        return confirm('Are you sure you want to quit this page ?'); \n    }            \n}); \n```\n\nStart router.\n--------------\n```js\nsrouter.start(); \n```\n\n## Hooker\n\nThe router supports global events and you can implement hooker functions by listening to global events. \nBuilt-in global events have routing before current route change and routed after current route change.\n\n```js\nrouter.on(\"routed\",function(e){ \n    var links = $(\"a.active\"); \n\n    links.removeClass(\"active\"); \n\n    links = $(\"a[href=\\\"\" + e.current.path + \"\\\"]\"); \n    links.addClass(\"active\"); \n    links[0].focus(); \n}); \n```\n## Select engine\n\nThe router support the following three routing engines.\n\n1. html5 history API egine \n2. hash egine \n3. internal management engine \n\nThe useHistoryApi attribute and useHashbang attribute of router object are used to control which engine is used：\n\n- useHistoryApi === null \u0026\u0026 useHashbang===null （default）  \nThe router automatically determine which engine to use, if running on the web, he html5 history API egine is used; if running in the local file system, The internal egine is used.\n- useHistoryApi === true  \nThe html5 history API egine is used.\n- useHistoryApi !== true \u0026\u0026 useHashbang===true  \nThe hash egine is used.\n- useHistoryApi === false \u0026\u0026 useHashbang===false  \nThe internal management engine is used.\n\n## API Document\n- baseUrl()\n- current()\n- go()\n- map()\n- off()\n- on()\n- one()\n- path()\n- previous()\n- Route\n  * Route.prototype.match\n  * Route.prototype.path\n- route()\n- routes()\n- start()\n- trigger()\n\n## Examples\nPlease access the following site for the execution of each example program under the \"/examples\" directory.\n\n- http://examples.skylarkjs.org/skylark-ajaxify-router/\n\n\n## Building skylark-ajaxify-router\n\n- Ensure that Node.js is installed.\n- Run npm gulp -g to ensure gulp is installed.\n- Run npm install to ensure the required dependencies are installed.\n- change current directory to build/, and run gulp. The builds will be placed in the dist/ directory.\n\n## Integration\nThis library is completely built-in on [skylark-spa](https://github.com/skylark-ajaxify/skylark-ajaxify-spa), and when you use [skylark-ajaxify-spa](https://github.com/skylark-ajaxify/skylark-ajaxify-spa) or [skylark.js](https://github.com/skylarkjs/skylark) to develop an application, you do not have to use this library's API directly\n\n## License\n\nReleased under the [MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskylark-appify%2Fskylark-appify-routers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskylark-appify%2Fskylark-appify-routers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskylark-appify%2Fskylark-appify-routers/lists"}