{"id":20420345,"url":"https://github.com/deepraining/orchids","last_synced_at":"2025-12-12T04:06:54.522Z","repository":{"id":58224739,"uuid":"78336209","full_name":"deepraining/orchids","owner":"deepraining","description":"让 Web App 有像 Native App 一样的体验. Make Web App be felt as Native App. ","archived":false,"fork":false,"pushed_at":"2020-01-17T01:28:36.000Z","size":337,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-28T10:30:53.266Z","etag":null,"topics":["app","native","page","spa","web"],"latest_commit_sha":null,"homepage":"http://senntyou.github.io/orchids/","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/deepraining.png","metadata":{"files":{"readme":"README.en.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}},"created_at":"2017-01-08T10:31:48.000Z","updated_at":"2020-01-17T01:28:39.000Z","dependencies_parsed_at":"2022-08-31T08:50:57.710Z","dependency_job_id":null,"html_url":"https://github.com/deepraining/orchids","commit_stats":null,"previous_names":["senntyou/orchids"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/deepraining/orchids","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraining%2Forchids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraining%2Forchids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraining%2Forchids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraining%2Forchids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepraining","download_url":"https://codeload.github.com/deepraining/orchids/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepraining%2Forchids/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003725,"owners_count":26083610,"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-10-10T02:00:06.843Z","response_time":62,"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":["app","native","page","spa","web"],"created_at":"2024-11-15T06:42:32.251Z","updated_at":"2025-10-10T11:11:40.216Z","avatar_url":"https://github.com/deepraining.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# orchids\n\n[中文文档](./README.md)\n\nCurrent version is `1.x`, [v0.x is here](https://github.com/senntyou/orchids/tree/0.x).\n\nMake Web App be felt as Native App.\n\n[Demo](http://senntyou.github.io/orchids/).\n\n[Demo Code](./view/demo).\n\n## Getting started\n\n```\nnpm install orchids --save\n\nimport { registerPage, startPage, ... } from 'orchids';\n```\n\n## api\n\n### registerPage: Register a Page\n\n```\nregisterPage(name, attributes, options);\n```\n\n- `name`: `string` Page name.\n- `attributes`: `{}` Page attributes.\n  - `beforeCreate`: Before page root element being created.\n  - `created`: After page root element being created.\n  - `beforeDestroy`: Before page root element being destroyed.\n  - `destroyed`: After page root element being destroyed.\n- `options`: `{}` Page options.\n  - `options.route`: `bool` `default: true` Whether to push a new hash to browser.\n  - `options.animate`: `bool` `default: true` Whether to use animation.\n  - `options.direction`: `string` `default: r2l` Animation direction: r2l(right to left), l2r(left to right), b2t(bottom to top), t2b(top to bottom).\n  - `options.backgroundColor`: `string` `default: #ffffff` Background color.\n  - `options.style`: `{}` Extra Css style.\n\n### startPage: Start a Page\n\n```\nstartPage(name, data, options);\n```\n\n- `name`: `string` Page name.\n- `data`: `*` Page data pass to `created` hook.\n\n### back: Back a Page\n\n```\nback();\n```\n\n### init: Init application\n\n```\ninit({ root });\n```\n\n- `root`: `DOM` `default: document.body` Root container.\n\n### getPage: Get Page by index\n\n```\nconst page = getPage(index);\n```\n\n- `index`: `int` `default: 0` Index(If index is negative integer, the sequence to get value is opposite direction. For example, `-1` is to get the last one, and `-2` is to get the second last one.).\n\n### getRoutePage: Get Page which have route by index\n\n```\nconst page = getRoutePage(index);\n```\n\n- `index`: `int` `default: 0` Index(If index is negative integer, the sequence to get value is opposite direction. For example, `-1` is to get the last one, and `-2` is to get the second last one.).\n\n### getPagesLength: Get pages' length\n\n```\nconst length = getPagesLength();\n```\n\n### getRoutePagesLength: Get route pages' length\n\n```\nconst length = getRoutePagesLength();\n```\n\n### getCurrentPage: Get current Page\n\n```\nconst page = getCurrentPage();\n```\n\n### getCurrentRoutePage: Get current route Page\n\n```\nconst page = getCurrentRoutePage();\n```\n\n### getPages: Get pages by name\n\n```\nconst pages = getPages(name);\n```\n\n- `name`: `string` Page name. If empty, all pages will return;\n\n### getRoutePages: Get route pages by name\n\n```\nconst pages = getRoutePages(name);\n```\n\n- `name`: `string` Page name. If empty, all route pages will return;\n\n## Page: Page instance and hooks\n\n- `Page.id`: Page id.\n- `Page.name`: Page name.\n- `Page.options`: Page options.\n- `Page.el`: Page root element(`beforeCreate` cant access to it).\n\n### beforeCreate: Before page root element being created\n\n```\nregisterPage('name', {\n  beforeCreate() {\n    this.id // ok\n    this.name // ok\n    this.options // ok\n    this.el // not ok\n  },\n});\n```\n\n### created: After page root element being created\n\n```\nregisterPage('name', {\n  created() {\n    this.id // ok\n    this.name // ok\n    this.options // ok\n    this.el // ok\n  },\n});\n```\n\n### afterAnimate: After page's animation finished\n\n```\nregisterPage('name', {\n  afterAnimate() {\n    this // ok\n  },\n});\n```\n\n### beforeDestroy: Before page root element being destroyed\n\n```\nregisterPage('name', {\n  beforeDestroy() {\n    this // ok\n  },\n});\n```\n\n### destroyed: After page root element being destroyed\n\n```\nregisterPage('name', {\n  destroyed() {\n    this // ok\n  },\n});\n```\n\n### beforeHide: When start another page.\n\n```\nregisterPage('name', {\n  beforeHide() {\n    this // ok\n  },\n});\n```\n\n### afterShow: When back from another page.\n\n```\nregisterPage('name', {\n  afterShow() {\n    this // ok\n  },\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepraining%2Forchids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepraining%2Forchids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepraining%2Forchids/lists"}