Last active
February 24, 2019 06:37
-
-
Save kumaraksi/7bc6ed23aa93cdcc0eecf3bccfc2d2c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class GMap extends HTMLElement{ | |
constructor(){ | |
super(); | |
const template = this.getTemplate(); | |
const shadow = this.attachShadow({mode: 'open'}); | |
shadow.appendChild(template.content.cloneNode(true)); | |
} | |
getTemplate(){ | |
const template = document.createElement('template'); | |
template.innerHTML = ` | |
<style> | |
#map{ | |
height:400px; | |
width: 400px; | |
} | |
</style> | |
<div id="map" style="height:400px;width:400px"></div> | |
`; | |
return template; | |
} | |
// triggered once the element is added to the DOM. | |
async connectedCallback(){ | |
console.log('connected'); | |
} | |
// triggered once the element is removed to the DOM. | |
disconnectedCallback(){ | |
} | |
} | |
customElements.define('google-map', GMap); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment