Skip to content

Instantly share code, notes, and snippets.

@pastleo
Last active June 21, 2018 12:16
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 pastleo/d5e8e4269055be701d646df7df7bbd16 to your computer and use it in GitHub Desktop.
Save pastleo/d5e8e4269055be701d646df7df7bbd16 to your computer and use it in GitHub Desktop.

notes from Google IO 2018 polymer 3.0

youtube video

import { FancyButton } from 'fancy-button'
const myRegistry = new CustomElementRegistry();

myRegistry.define('fancy-button', FancyButton);
element.attatchShadow({mode: 'open', customElements: myRegistry});
  • package map: <script type='packagemap' src='package-map.json'></script>:
{
  "path_prefix": "/node_modules",
  "packages": {
    "foo-modules": { "main": "foo-module.js" }
  }
}
  • HTML module, import html in js
  • template instantiation
new NodeTemplatePart().attach(div) // ?
let inst = template.createInstance();
this.shadowRoot.appendChild(instance)
inst.getParts()[0].setValue(text);
inst.commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment