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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
320
Design It! in a nutshell
nunulk
1
270
PHP Getting Faster
nunulk
0
280
How does learning English broaden your world?
nunulk
0
370
Testing on Laravel
nunulk
1
1.5k
Nuxt.js in TypeScript
nunulk
1
440
A startup meets Laravel + Vue.js
nunulk
1
2k
Unit Testing Laravel
nunulk
0
490
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
590
Other Decks in Technology
See All in Technology
Data Hubグループ 紹介資料
sansan33
PRO
0
2.7k
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
What happened to RubyGems and what can we learn?
mikemcquaid
0
220
Embedded SREの終わりを設計する 「なんとなく」から計画的な自立支援へ
sansantech
PRO
2
1.9k
データ民主化のための LLM 活用状況と課題紹介(IVRy の場合)
wxyzzz
2
640
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
420
しろおびセキュリティへ ようこそ
log0417
0
280
オープンウェイトのLLMリランカーを契約書で評価する / searchtechjp
sansan_randd
3
630
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
0
130
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
130
セキュリティ はじめの一歩
nikinusu
0
1.5k
Amazon Bedrock AgentCore 認証・認可入門
hironobuiga
2
500
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
210
Color Theory Basics | Prateek | Gurzu
gurzu
0
190
Statistics for Hackers
jakevdp
799
230k
Optimizing for Happiness
mojombo
379
71k
First, design no harm
axbom
PRO
2
1.1k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
47
Embracing the Ebb and Flow
colly
88
5k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
210
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
95
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
320
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); }
σϞ