Skip to content

A CanJS Driven Route Element for Hash Based Routing => can-element + can-define += can-route-element

License

Notifications You must be signed in to change notification settings

at-nikolaus/can-route-element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

can-route-element

A CanJS Driven Route Element for Hash Based Routing => can-element + can-define += can-route-element

Use

importent for binding is only the name of your observed attribute and that your element has a x.addEventListener method named on

in this example we use can-define maybe this exports a addEventListner method so we can unify this.

import canRouteElement from 'can-route-element'
import define from 'can-define'
export default class myApp extends canRouteElement.Element {
  constructor() {
    super()
    define(this, {
      channel: { type: 'string' },
      page: {
        type: "string",
        value: "login"
      },
      /* gets called when ever page changes */
      routeState: {
        get: function(){
          return { page: this.page, channel: this.channel }
        }
      }
    })
    this.routeReady("routeState")
  }
}

About

A CanJS Driven Route Element for Hash Based Routing => can-element + can-define += can-route-element

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published