@gudhub/gh-html-element

1.4.5 • Public • Published

GH HTML ELEMENT

Attributes

  • app-id - application id of element
  • item-id - item id of element
  • field-id - field id of element
  • value - value of element
  • gh-model - path to object where save or get value from element

Available methods

  • render - It's used for render html in component. You need pass html to this method.
  • observe - Method for binding data in component. This method expect for variable name and callback. Here is example:
class Simple extends GhHtmlElement {
  constructor() {
      super();
       this.text = 'Text';
  }
  
   connectedCallback() {
   	this.render()
   	this.observe('text', () => {
    	  this.render();
      });
    }
  
  render () {
		this.innerHTML = `<p>${this.text}</p>`;
  }
}
window.customElements.define('simple-element', Simple);
const simple = document.createElement('simple-element');
setTimeout(() => {
	simple.data.text = 'Hello World!';	
}, 1000)

document.body.append(simple);

Readme

Keywords

none

Package Sidebar

Install

npm i @gudhub/gh-html-element

Weekly Downloads

7

Version

1.4.5

License

ISC

Unpacked Size

7.26 kB

Total Files

3

Last publish

Collaborators

  • gudhub