This package has been deprecated

Author message:

Use @conectate/ct-router

@conectate/ct-route

2.0.2 • Public • Published

Published on webcomponents.org

ct-route

It's a simple routing system that changes the viewport depending on the route given

Installation

To include this, type:

$ npm i @conectate/ct-route

Usage

Lazy-import

To lazy-import use the from attr, like a:

<page-element-one route="/one" from="/src/page-element-one.html"></page-element-one>

Lazy-import finished

maybe you want to know when an import has finished loading...

to know this use finish-load attr in <c2-route>

If you plan to manage the dynamic imports, skip this attr

<page-element-one route="/one"></page-element-one>

Routing

To route page use the route attr

route="/page/:id"

you can use :id to varible path and * for any path or your own regex

Auth

There are pages that only a user with session started can see. for this it passes a Boolean parameter to auth of ct-route and add auth to element

<ct-route path="{{path}}" auth="[[isLogged]]">
  <auth-needed route="/page/:id" from="/src/auth-needed.js" auth></<auth-needed>
</ct-route>

Full example:

<ct-route path="{{path}}" params="{{params}}" query-params="{{queryParams}}" finish-load="{{finishLoad}}" auth="[[isLogged]]">
  <page-element-one route="/page" from="/src/page-element-one.js"></page-element-one>
  <auth-needed route="/page/:id" from="/src/auth-needed.js" auth></<auth-needed>
  <my-view404 route="/404" from="/src/mainc2-view404.js"></my-view404>
</ct-route>

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

  • v0.1 Initial Release

Credits

littleqairoes/qairoe-app-router created this for his projects in polymer v1.

License

See LICENSE

Readme

Keywords

Package Sidebar

Install

npm i @conectate/ct-route

Weekly Downloads

4

Version

2.0.2

License

ISC

Unpacked Size

30.5 kB

Total Files

7

Last publish

Collaborators

  • herberthobregon