Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Web notifications with Polymer & Firebase
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Filip Prochazka
November 26, 2016
Programming
80
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Web notifications with Polymer & Firebase
Filip Prochazka
November 26, 2016
More Decks by Filip Prochazka
See All by Filip Prochazka
Firebase na webu? Hračka
filipproch
0
340
Web Notifications with Firebase
filipproch
0
89
Other Decks in Programming
See All in Programming
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
190
Go のフラットな パッケージに 「ファイル単位の private」を 〜Linter “declscope” を作った話〜
mpyw
0
280
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
120
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
310
アクセシビリティから考える情報設計
high_g_engineer
0
370
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
310
自分的「カンファレンスの楽しみ方」
syumai
0
200
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
460
スマート反転とウェブアクセシビリティ
camiha
0
200
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
140
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
6.9k
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
710
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
270
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Unsuck your backbone
ammeep
672
58k
How to make the Groovebox
asonas
2
2.4k
The Curse of the Amulet
leimatthew05
2
14k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Optimizing for Happiness
mojombo
378
71k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
410
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Visualization
eitanlees
152
17k
Ruling the World: When Life Gets Gamed
codingconduct
0
330
エンジニアに許された特別な時間の終わり
watany
108
250k
Transcript
with Polymer & Firebase Web notifications Filip Prochazka
• How far is the web? • Tools? • Notifications?
None
None
None
None
None
None
credit: Morgan Stanley
Users expect more!
None
None
None
We can do it
“I want to write least code possible” every developer ever
None
None
FCM
None
None
#UseThePlatform
<dom-module id="contact-card"> ... </dom-module>
<style>...</style> <template> <content></content> <iron-icon icon="star" hidden$="{{!starred}}"> </iron-icon> </template>
<script> Polymer({ is: 'contact-card', properties: { starred: Boolean } });
</script>
<contact-card starred> <img src="profile.jpg" alt="Eric's photo"> <span>Eric Bidelman</span> </contact-card
None
Polymer + Firebase = Polymerfire
<firebase-app auth-domain="mydb.firebaseapp.com" database-url="https://mydb.firebaseio.com/" api-key="AIzaSyDTP-eiQezleFsV2WdEzx_8v_g"> </firebase-app>
<firebase-auth id="auth" user="{{user}}" provider="google" on-error="handleError"> </firebase-auth> this.$.auth.signInWithPopup()
Web Notifications
<firebase-app auth-domain="mydb.firebaseapp.com" database-url="https://mydb.firebaseio.com/" api-key="AIzaSyDTP-eiQezleAhF_WEzx_8v_g" messaging-sender-id="811649979958"> </firebase-app>
<firebase-messaging id="messaging" token="{{token}}" on-message="_onMessageReceived"> </firebase-messaging>
<firebase-document path="/users/[[user.uid]]/token" value="[[token]]"> </firebase-document>
Service Worker
importScripts('../../firebase-app.js') importScripts('../../firebase-messaging.js') firebase.initializeApp({ messagingSenderId: '811649979958' }) var messaging = firebase.messaging()
messaging.setBackgroundMessageHandler( pushMessage => { ... })
const title = pushMessage.data.title const notificationOptions = { body: pushMessage.data.body,
icon: '/images/notification.png', tag: 'notification-tag', data: { targetUrl: pushMessage.data.targetUrl } }
self.registration .showNotification(title, notificationOptions)
self.addEventListener('notificationclick', event => { ... }
event.notification.close() var targetUrl = event.notification.data.targetUrl
event.waitUntil( clients.matchAll({ type: 'window', includeUncontrolled: !0 }).then( clientList => {
openWindow(clientList, targetUrl) }))
function openWindow(clientList, targetUrl) { clientList.forEach( client => { if (client.url.endsWith(targetUrl)
&& 'focus' in client) { return client.focus() } } return self.clients.openWindow(targetUrl) }
this.$.messaging.requestPermission() .then(() => { console.log('Notification permission granted.') }) .catch( err
=> { console.log('Notification permission was denied.') })
None
“What’s that?” your confused user
None
None
None
1. The web is important 2. Use the tools 3.
Think about the user
Filip Prochazka filipproch www.settleup.info