daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, Prop } from '@stencil/core';
  2.  
  3. @Component({
  4.   tag: 'torq-button',
  5.   styleUrl: 'my-component.css',
  6.   shadow: true
  7. })
  8. export class MyComponent {
  9.   container: HTMLElement;
  10.   window: Window | any;
  11.   document: Document | any;
  12.   root:Element | any;
  13.   _element: any;
  14.  
  15. init() {
  16.     return Promise.resolve(this._init());
  17. }
  18.  
  19. async componentWillLoad() {
  20.     this.window = window;
  21.     await this._init();
  22. }
  23. componentDidLoad() {
  24.     console.log("torq-button loaded");
  25.  
  26. }
  27.  
  28. async _init(): Promise<void> {
  29.   // init some variables
  30.   this.document = this.window.document;
  31.   this.root = this.document.documentElement;
  32.  
  33. }
  34.   /**
  35.    * The text to show inside the button
  36.    */
  37.   @Prop() buttontext: string;
  38.   /**
  39.    * Could be a primary button, a secondary, etc
  40.    */
  41.   @Prop() buttontype: string;
  42.  
  43.  
  44.   private getText(): string {
  45.     return this.buttontext;
  46.   }
  47.   private getClass(): string {
  48.     return this.buttontype;
  49.   }
  50.  
  51.   render() {
  52.     return <button type="button" class={this.getClass()}>{this.getText()}</button>;
  53.   }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top