Skip to content

Instantly share code, notes, and snippets.

@robdodson
Created July 17, 2017 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robdodson/4270ff2dbd0852b34ad849e723bc4592 to your computer and use it in GitHub Desktop.
Save robdodson/4270ff2dbd0852b34ad849e723bc4592 to your computer and use it in GitHub Desktop.
<!-- 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