{"id":28358994,"url":"https://github.com/quickcorp/qcobjects-view-stack-widget-example","last_synced_at":"2026-01-28T17:04:56.756Z","repository":{"id":137924275,"uuid":"358773646","full_name":"QuickCorp/qcobjects-view-stack-widget-example","owner":"QuickCorp","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-17T03:59:36.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-21T08:36:09.917Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/QuickCorp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-17T03:16:33.000Z","updated_at":"2021-04-17T03:59:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"946e5340-b5db-4ce2-9a1c-0b17a3667758","html_url":"https://github.com/QuickCorp/qcobjects-view-stack-widget-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/QuickCorp/qcobjects-view-stack-widget-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickCorp%2Fqcobjects-view-stack-widget-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickCorp%2Fqcobjects-view-stack-widget-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickCorp%2Fqcobjects-view-stack-widget-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickCorp%2Fqcobjects-view-stack-widget-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuickCorp","download_url":"https://codeload.github.com/QuickCorp/qcobjects-view-stack-widget-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuickCorp%2Fqcobjects-view-stack-widget-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28847065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: 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":[],"created_at":"2025-05-28T09:08:39.304Z","updated_at":"2026-01-28T17:04:56.751Z","avatar_url":"https://github.com/QuickCorp.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tutorial: A View Stack Widget Using QCObjects\n\n## Step 1:\n\nCreate three files: view-stack.html. one.html, two.html\n\n## Step 2:\n\nIside the file index.html include the following tag in the head section:\n\n```html\n\u003chead\u003e\n\u003cscript type=\"text/javascript\" src=\"https://cdn.qcobjects.dev/QCObjects.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\n## Step 3:\n\nIn the body section, add the following:\n\n```html\n\u003ch1\u003eThis is a view stack example\u003c/h1\u003e\n\u003ch2\u003eThere are 3 files, view-stack.html , one.html and two.html\u003c/h2\u003e\n\u003ch3\u003eThis part of the page (index.html) does not change when you click in a link\u003c/h3\u003e\n\u003cp\u003eOpen DevTools in your browser (second mouse button, click on  Inspect Elements) and see what happens with the elements of this page when you click a link\u003c/p\u003e\n\n\u003cview-stack componentClass=\"CustomComponent\"\u003e\n  \u003crouting path=\"/one\" name=\"page-one\" \u003e\u003c/routing\u003e\n  \u003crouting path=\"/two\" name=\"page-two\"\u003e\u003c/routing\u003e\n  \u003crouting path=\"/\" name=\"view-stack\"\u003e\u003c/routing\u003e\n  \u003crouting path=\"\" name=\"view-stack\"\u003e\u003c/routing\u003e\n\u003c/view-stack\u003e\n```\n\n## Step 4:\n\nGive some style to your component\n\n```html\n\u003cstyle\u003e\ncomponent[name=view-stack]{\n  border: 1px solid black;\n   width: 200px;\n   height: 200px;\n   position: relative;\n   display: block;\n   padding: 0;\n}\n\u003c/style\u003e\n```\n\n## Step 5\n\nCreate a CustomComponent class to define the custom behaviour when a view is loaded\n\n```javascript\nCONFIG.set(\"routingWay\", \"pathname\")\n\nClass (\"CustomComponent\", Component, {\n  _new_ (o){\n    var component = this;\n    component.addComponentHelper(function (){\n      component.__promise__.then(function (){\n        // This shows a notification when the content of the current page is fully loaded into the view stack\n        return Promise.resolve(NotificationComponent.success(`Current View is ${component.routingSelected.pop().name}`));\n      }).catch (function (e){\n        return Promise.resolve(NotificationComponent.danger(\"some problem\"));\n      })\n\n    });\n    _super_(\"Component\", \"_new_\").call(this, o);\n  }\n});\nRegisterWidget(\"view-stack\")\n```\n\n## The complete code looks like this\n\n```html\n\u003c!doctype html\u003e\n\u003chtml class=\"no-js\" lang=\"en\"\u003e\n\n\u003chead\u003e\n\u003cscript type=\"text/javascript\" src=\"https://cdn.qcobjects.dev/QCObjects.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n\n\u003cbody\u003e\n\u003cstyle\u003e\ncomponent[name=view-stack]{\n  border: 1px solid black;\n   width: 200px;\n   height: 200px;\n   position: relative;\n   display: block;\n   padding: 0;\n}\n\u003c/style\u003e\n\u003ch1\u003eThis is a view stack example\u003c/h1\u003e\n\u003ch2\u003eThere are 3 files, view-stack.html , one.html and two.html\u003c/h2\u003e\n\u003ch3\u003eThis part of the page (index.html) does not change when you click in a link\u003c/h3\u003e\n\u003cp\u003eOpen DevTools in your browser (second mouse button, click on  Inspect Elements) and see what happens with the elements of this page when you click a link\u003c/p\u003e\n\u003cview-stack componentClass=\"CustomComponent\"\u003e\n  \u003crouting path=\"/one\" name=\"page-one\" \u003e\u003c/routing\u003e\n  \u003crouting path=\"/two\" name=\"page-two\"\u003e\u003c/routing\u003e\n  \u003crouting path=\"/\" name=\"view-stack\"\u003e\u003c/routing\u003e\n  \u003crouting path=\"\" name=\"view-stack\"\u003e\u003c/routing\u003e\n\u003c/view-stack\u003e\n\n\u003cscript\u003e\nCONFIG.set(\"routingWay\", \"pathname\")\n\nClass (\"CustomComponent\", Component, {\n  _new_ (o){\n    var component = this;\n    component.addComponentHelper(function (){\n      component.__promise__.then(function (){\n        // This shows a notification when the content of the current page is fully loaded into the view stack\n        return Promise.resolve(NotificationComponent.success(`Current View is ${component.routingSelected.pop().name}`));\n      }).catch (function (e){\n        return Promise.resolve(NotificationComponent.danger(\"some problem\"));\n      })\n\n    });\n    _super_(\"Component\", \"_new_\").call(this, o);\n  }\n});\nRegisterWidget(\"view-stack\")\n\u003c/script\u003e\n\n\u003c/body\u003e\n\n\u003c/html\u003e\n\n```\n\nSee this example running on glitch [index.html](https://heavenly-grave-challenge.glitch.me) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickcorp%2Fqcobjects-view-stack-widget-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquickcorp%2Fqcobjects-view-stack-widget-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickcorp%2Fqcobjects-view-stack-widget-example/lists"}