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
960
0
Share
Vue.js + TypeScript + Firebase
nunulk
January 19, 2019
More Decks by nunulk
See All by nunulk
Laravelでテストしやすいコードを書く5 / 5 tips of building testable modules in Laravel
nunulk
0
340
Design It! in a nutshell
nunulk
1
280
PHP Getting Faster
nunulk
0
290
How does learning English broaden your world?
nunulk
0
390
Testing on Laravel
nunulk
1
1.5k
Nuxt.js in TypeScript
nunulk
1
450
A startup meets Laravel + Vue.js
nunulk
1
2.1k
Unit Testing Laravel
nunulk
0
500
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
600
Other Decks in Technology
See All in Technology
暗黙知について一歩踏み込んで考える - 暗黙知の4タイプと暗黙考・暗黙動へ
masayamoriofficial
0
490
プロダクトを育てるように生成AIによる開発プロセスを育てよう
kakehashi
PRO
1
870
ふりかえりを 「あそび」にしたら、 学習が勝手に進んだ / Playful Retros Drive Learning
katoaz
0
410
サイバーフィジカル社会とは何か / What Is a Cyber-Physical Society?
ks91
PRO
0
160
建設的な現実逃避のしかた / How to practice constructive escapism
pauli
4
290
MCPゲートウェイ MCPass の設計と実装 エンタープライズで AI を「運用できる」状態にする
mtpooh
1
200
ふりかえりがなかった職能横断チームにふりかえりを導入してみて学んだこと 〜チームのふりかえりを「みんなで未来を考える場」にするプロローグ設計〜
masahiro1214shimokawa
0
250
Databricks Lakebaseを用いたAIエージェント連携
daiki_akimoto_nttd
0
170
不確実性と戦いながら見積もりを作成するプロセス/mitsumori-process
hirodragon112
1
200
英語翻訳を通じて 音声AIエージェント入門してみた
shichijoyuhi
0
100
New CBs New Challenges
ysuzuki
1
160
試されDATA SAPPORO [LT]Claude Codeで「ゆっくりデータ分析」
ishikawa_satoru
0
320
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
790
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
170
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Embracing the Ebb and Flow
colly
88
5k
Building the Perfect Custom Keyboard
takai
2
720
The World Runs on Bad Software
bkeepers
PRO
72
12k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
670
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Abbi's Birthday
coloredviolet
2
6.4k
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); }
σϞ