Skip to content

Instantly share code, notes, and snippets.

@enjikaka
Created August 6, 2017 18:07
Show Gist options
  • Select an option

  • Save enjikaka/7a4b22b806f489d9f4498d5e83d4b65c to your computer and use it in GitHub Desktop.

Select an option

Save enjikaka/7a4b22b806f489d9f4498d5e83d4b65c to your computer and use it in GitHub Desktop.
<link rel="import" href="template-component.html">
<script>
class SsrData extends TemplateComponent {
constructor () {
super(SsrData.is);
}
static get is () {
return 'ssr-data';
}
getState () {
return JSON.parse(this.innerHTML.trim());
}
}
window.customElements.define(SsrData.is, SsrData);
</script>
<template>
<style>
/* This is scoped! */
p {
color: red;
font-style: italic;
}
</style>
<p>I am ${this.name}</p>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment