Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Vue.js + TypeScript + Firebase
Search
nunulk
January 19, 2019
Technology
0
890
Vue.js + TypeScript + Firebase
nunulk
January 19, 2019
Tweet
Share
More Decks by nunulk
See All by nunulk
Laravelでテストしやすいコードを書く5 / 5 tips of building testable modules in Laravel
nunulk
0
260
Design It! in a nutshell
nunulk
1
220
PHP Getting Faster
nunulk
0
210
How does learning English broaden your world?
nunulk
0
310
Testing on Laravel
nunulk
1
1.4k
Nuxt.js in TypeScript
nunulk
1
380
A startup meets Laravel + Vue.js
nunulk
1
1.9k
Unit Testing Laravel
nunulk
0
430
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
560
Other Decks in Technology
See All in Technology
関東Kaggler会LT: 人狼コンペとLLM量子化について
nejumi
3
600
株式会社EventHub・エンジニア採用資料
eventhub
0
4.3k
ユーザーストーリーマッピングから始めるアジャイルチームと並走するQA / Starting QA with User Story Mapping
katawara
0
210
開発組織のための セキュアコーディング研修の始め方
flatt_security
3
2.4k
Goで作って学ぶWebSocket
ryuichi1208
3
1.5k
レビューを増やしつつ 高評価維持するテクニック
tsuzuki817
1
730
抽象化をするということ - 具体と抽象の往復を身につける / Abstraction and concretization
soudai
20
8.1k
開発スピードは上がっている…品質はどうする? スピードと品質を両立させるためのプロダクト開発の進め方とは #DevSumi #DevSumiB / Agile And Quality
nihonbuson
2
3k
30分でわかる『アジャイルデータモデリング』
hanon52_
9
2.7k
地方拠点で エンジニアリングマネージャーってできるの? 〜地方という制約を楽しむオーナーシップとコミュニティ作り〜
1coin
1
230
明日からできる!技術的負債の返済を加速するための実践ガイド~『ホットペッパービューティー』の事例をもとに~
recruitengineers
PRO
3
410
表現を育てる
kiyou77
1
210
Featured
See All Featured
Building Adaptive Systems
keathley
40
2.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Making Projects Easy
brettharned
116
6k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Why Our Code Smells
bkeepers
PRO
336
57k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Git: the NoSQL Database
bkeepers
PRO
427
64k
What's in a price? How to price your products and services
michaelherold
244
12k
Transcript
Vue.js + Firebase + TypeScript Ͱ ϦΞϧλΠϜνϟοτ nunulk #ReBuildCamp
Firebase • Google ͕ఏڙ͢Δ mBaaS • Cloud Firestore (Beta), Cloud
Storage, Cloud Functions, A/B Testing, Cloud Messaging
ٕͬͨज़ • Vue.js: 2.5.22 • TypeScript: 3.2.4 • Firebase: 0.3.7
• Element: 2.4.11
ೝূ͕ඞཁͳύεͷࢦఆ routes: [ { path: '/', name: 'home', component: Home,
meta: { requiresAuth: true } },
ϛυϧΣΞ router.beforeEach((to, from, next) => { const requiresAuth = to.matched.some(record
=> record.meta.requiresAuth) if (!requiresAuth) { next() } else { firebase.auth().onAuthStateChanged(function (user) { if (user) { next() } else { next({ path: '/signin', query: { redirect: to.fullPath } })
Component export default class ChatBoard extends Vue { user: User
= { id: null, email: '', avatar_image_url: '' } participants: User[] = [] messages: Message[] = [] message: Message = { room_id, sender_id: null, content: ‘', created_at: null, }
Component created(): void { const fireUser = firebase.auth().currentUser; if (!fireUser)
{ return; } this.user.id = fireUser.uid; this.user.email = fireUser.email; db.collection('users').doc(this.user.id).get() .then((doc) => {})
Component db.collection('messages') .onSnapshot((snapshot) => { const changes = snapshot.docChanges() if
(!changes) { return } changes.forEach((change) => { if (change.type === 'added') { const message = { room_id: change.doc.data().room_id, sender_id: change.doc.data().sender_id, content: change.doc.data().content, created_at: this.timestamp2String(change.doc.data().created_at) }; this.addMessageData(message); }
σϞ