Created
July 17, 2017 17:54
-
-
Save robdodson/4270ff2dbd0852b34ad849e723bc4592 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!-- src/my-element.html --> | |
<link rel="import" href="../bower_components/polymer/polymer-element.html"> | |
<dom-module id="my-element"> | |
<template> | |
<h1>Hello, World! It's [[today]].</h1> | |
</template> | |
<script type=”module”> | |
// Heyyyy, we're pulling in a Node module! | |
import format from 'date-fns/format'; | |
class MyElement extends Polymer.Element { | |
static get is() { return 'my-element'; } | |
static get properties() { | |
return { | |
today: { | |
type: String, | |
value: function() { | |
return format(new Date(), 'MM/DD/YYYY'); | |
} | |
} | |
} | |
} | |
} | |
window.customElements.define(MyElement.is, MyElement); | |
</script> | |
</dom-module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment