Web Components with Polymer @ Google I/O, Extended Cuiabá
Web Components
with Polymer
/dhyegofernando
Web Components with Polymer @ Google I/O, Extended Cuiabá
/dhyegofernando
full stack dev @
Web Components with Polymer @ Google I/O, Extended Cuiabá
Web Components with Polymer @ Google I/O, Extended Cuiabá
Agenda
✓ What is a Web Component?
✓ Benefits
✓ Where do they live?
Web Components
✓ What is Polymer?
✓ Why Polymer?
Polymer
✓ Polymer 2.0
✓ App Toolbox
✓ Polymer CLI
✓ Getting Started (live code)
✓ Finals
Web Components with Polymer @ Google I/O, Extended Cuiabá
What is a Web Component?
Web Components with Polymer @ Google I/O, Extended Cuiabá
Just HTML Elements

<div>Hello World</div>
Web Components with Polymer @ Google I/O, Extended Cuiabá
Custom Elements

<your-own-element/>
Web Components with Polymer @ Google I/O, Extended Cuiabá
HTML Templates

<template></template>
Web Components with Polymer @ Google I/O, Extended Cuiabá
Shadow DOM

<slot></slot>
Web Components with Polymer @ Google I/O, Extended Cuiabá
HTML Imports

<link/>
Web Components with Polymer @ Google I/O, Extended Cuiabá
What are its benefits?
Web Components with Polymer @ Google I/O, Extended Cuiabá
Reusable
Web Components with Polymer @ Google I/O, Extended Cuiabá
Maintainable
Web Components with Polymer @ Google I/O, Extended Cuiabá
Encapsulated && Independent
Web Components with Polymer @ Google I/O, Extended Cuiabá
Let’s Work Together
Web Components with Polymer @ Google I/O, Extended Cuiabá
What is not so good?
Web Components with Polymer @ Google I/O, Extended Cuiabá
Cross-browsers weirdness
Web Components with Polymer @ Google I/O, Extended Cuiabá
Cross-browsers specs implementation
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polyfills are slow
Web Components with Polymer @ Google I/O, Extended Cuiabá
Where do they live?
Web Components with Polymer @ Google I/O, Extended Cuiabá
“There’s an element for that” bit.ly/2rDlzJ0
Web Components with Polymer @ Google I/O, Extended Cuiabá
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polymer
Web Components with Polymer @ Google I/O, Extended Cuiabá
3.5+ Million
Pages using Polymer
Web Components with Polymer @ Google I/O, Extended Cuiabá
Who is using
Polymer?
bit.ly/2rCuX04
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polymer + PWA +
Google Cloud Vision
API
bit.ly/2qIDX66
Cheese
Web Components with Polymer @ Google I/O, Extended Cuiabá
What is Polymer?
Web Components with Polymer @ Google I/O, Extended Cuiabá
What is not Polymer?
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polymer is not a framework
Web Components with Polymer @ Google I/O, Extended Cuiabá
Interoperable

by default
Web Components with Polymer @ Google I/O, Extended Cuiabá
+
Web Components with Polymer @ Google I/O, Extended Cuiabá
+
Web Components with Polymer @ Google I/O, Extended Cuiabá
+ any
framework
Web Components with Polymer @ Google I/O, Extended Cuiabá
Why Polymer at all?
Web Components with Polymer @ Google I/O, Extended Cuiabá
Template-based
rendering
Web Components with Polymer @ Google I/O, Extended Cuiabá
State propagation
Web Components with Polymer @ Google I/O, Extended Cuiabá
Declarative events
Web Components with Polymer @ Google I/O, Extended Cuiabá
Attributes &&
Properties sync
Web Components with Polymer @ Google I/O, Extended Cuiabá
Premisses
Web Components with Polymer @ Google I/O, Extended Cuiabá
Speed
Web Components with Polymer @ Google I/O, Extended Cuiabá
Latest APIs
Web Components with Polymer @ Google I/O, Extended Cuiabá
App Toolbox
Scaffolding
Routing
i18n
UI Elements
App Storage
Offline Behavior
+ Patterns
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polymer CLI
npm install -g polymer-cli
Web Components with Polymer @ Google I/O, Extended Cuiabá
polymer init
Web Components with Polymer @ Google I/O, Extended Cuiabá
polymer serve
polymer test
polymer build
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polymer 2.0
Web Components with Polymer @ Google I/O, Extended Cuiabá
Smaller, faster, better…
Web Components with Polymer @ Google I/O, Extended Cuiabá
Cross-browser fits
9, 10, 11
Web Components with Polymer @ Google I/O, Extended Cuiabá
natively supported +1b devices
Web Components with Polymer @ Google I/O, Extended Cuiabá
1/4 the size of Polymer 1.0
Web Components with Polymer @ Google I/O, Extended Cuiabá
Interoperability
Web Components with Polymer @ Google I/O, Extended Cuiabá
ES6 syntax like
class MyElement extends Polymer.Element {
// ...
}
Web Components with Polymer @ Google I/O, Extended Cuiabá
Data system improvements
Web Components with Polymer @ Google I/O, Extended Cuiabá
Smooth Migration
Web Components with Polymer @ Google I/O, Extended Cuiabá
Hybrid Elements
Web Components with Polymer @ Google I/O, Extended Cuiabá
Getting Started
Web Components with Polymer @ Google I/O, Extended Cuiabá
Where to Learn?
Web Components with Polymer @ Google I/O, Extended Cuiabá
“There’s an element for that” bit.ly/2rDlzJ0
Web Components with Polymer @ Google I/O, Extended Cuiabá
Polycasts bit.ly/2q3I4Xf
Web Components with Polymer @ Google I/O, Extended Cuiabá
Let’s discuss?
Web Components with Polymer @ Google I/O, Extended Cuiabá
Thank you ♥
/dhyegofernando
bit.ly/devmt-slack

Web Components with Polymer (extra Polymer 2.0)