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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
nunulk
January 19, 2019
Technology
0
960
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
330
Design It! in a nutshell
nunulk
1
270
PHP Getting Faster
nunulk
0
280
How does learning English broaden your world?
nunulk
0
380
Testing on Laravel
nunulk
1
1.5k
Nuxt.js in TypeScript
nunulk
1
450
A startup meets Laravel + Vue.js
nunulk
1
2k
Unit Testing Laravel
nunulk
0
500
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
590
Other Decks in Technology
See All in Technology
トップマネジメントとコンピテンシーから考えるエンジニアリングマネジメント
zigorou
4
730
Digitization部 紹介資料
sansan33
PRO
1
7k
Data Hubグループ 紹介資料
sansan33
PRO
0
2.8k
白金鉱業Meetup_Vol.22_Orbital Senseを支える衛星画像のマルチモーダルエンベディングと地理空間のあいまい検索技術
brainpadpr
2
240
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
新職業『オーケストレーター』誕生 — エージェント10体を同時に回すAgentOps
gunta
4
1.6k
バクラクのSREにおけるAgentic AIへの挑戦/Our Journey with Agentic AI
taddy_919
2
1.1k
「ストレッチゾーンに挑戦し続ける」ことって難しくないですか? メンバーの持続的成長を支えるEMの環境設計
sansantech
PRO
3
380
AWS SES VDMで 将来の配信事故を防げた話
moyashi
0
160
Claude Codeが爆速進化してプラグイン追従がつらいので半自動化した話 ver.2
rfdnxbro
0
420
技術的負債の泥沼から組織を救う3つの転換点
nwiizo
8
2.9k
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.1k
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
What does AI have to do with Human Rights?
axbom
PRO
1
2k
Exploring anti-patterns in Rails
aemeredith
2
280
The Spectacular Lies of Maps
axbom
PRO
1
600
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
88
Navigating Team Friction
lara
192
16k
Unsuck your backbone
ammeep
672
58k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.4k
It's Worth the Effort
3n
188
29k
Writing Fast Ruby
sferik
630
63k
Bash Introduction
62gerente
615
210k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
68
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); }
σϞ