How to use the @stencil/core.Prop function in @stencil/core

To help you get started, we’ve selected a few @stencil/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / stencil-site / src / components / stencil-router / router.tsx View on Github external
* @module ionic
  * @description
 */
@Component({
  tag: 'stencil-router'
})
export class Router {
  $el: any;

  base: string;

  @Prop() root: string = '';

  @State() routeMatch: any = {};

  @Prop()
  get match() {
    return this.routeMatch
  }

  @Prop()
  navigateTo(url, data={}) {
    console.log('navigateTo', url, data);
    window.history.pushState(null, null, url);
    this.routeMatch = {
      url: '/' + url.replace(this.root, '')
    }
    console.log('Route match', this.routeMatch);

    console.log('Emitting event');
    //Ionic.emit(this.$instance, 'ionRouterNavigation', { detail: this.routeMatch });
  }
github ionic-team / ionic / packages / core / src / components / router / router.tsx View on Github external
/**
  * @name Router
  * @module ionic
  * @description
 */
@Component({
  tag: 'ion-router'
})
export class Router {
  base: string;

  @Prop() root: string = '';

  @State() routeMatch: any = {};

  @Prop()
  get match() {
    return this.routeMatch;
  }

  /*
  @Prop()
  navigateTo(url, data={}) {
    window.history.pushState(null, null, url);
    this.routeMatch = {
      url: '/' + url.replace(this.root, '')
    }
    console.log('Route match', this.routeMatch);

    console.log('Emitting event');
    Ionic.emit(this.$instance, 'ionRouterNavigation', { detail: this.routeMatch });
  }
github ionic-team / stencil-site / src / components / stencil-router / router.tsx View on Github external
})
export class Router {
  $el: any;

  base: string;

  @Prop() root: string = '';

  @State() routeMatch: any = {};

  @Prop()
  get match() {
    return this.routeMatch
  }

  @Prop()
  navigateTo(url, data={}) {
    console.log('navigateTo', url, data);
    window.history.pushState(null, null, url);
    this.routeMatch = {
      url: '/' + url.replace(this.root, '')
    }
    console.log('Route match', this.routeMatch);

    console.log('Emitting event');
    //Ionic.emit(this.$instance, 'ionRouterNavigation', { detail: this.routeMatch });
  }

  componentWillLoad() {
    console.log(' loaded');
    window.addEventListener('popstate', this.handlePopState.bind(this));
    window.addEventListener('hashchange', this.handleHashChange.bind(this));