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
290
PHP Getting Faster
nunulk
0
290
How does learning English broaden your world?
nunulk
0
400
Testing on Laravel
nunulk
1
1.6k
Nuxt.js in TypeScript
nunulk
1
450
A startup meets Laravel + Vue.js
nunulk
1
2.1k
Unit Testing Laravel
nunulk
0
510
A Third-rate Programmer Talked about a Survival Strategy for Software Engineers
nunulk
3
600
Other Decks in Technology
See All in Technology
AI駆動開発でなんでもハンズオン環境をつくってみた
yoshimi0227
0
160
AI時代の私の技術インプットとアウトプット術
tonkotsuboy_com
15
7.4k
Strands Agents超入門
kintotechdev
1
130
エンジニアは生成AIと どのように向き合うべきか? ことばの意味という観点から
verypluming
3
270
はじめてのAI-DLC
yoshidashingo
2
590
自作エディターをOSSにして分かった、一人に刺さる開発が世界を動かす理由
shinyasaita
1
450
Copilot CLI・IDE・Web・スマホで途切れない開発フローを目指して / One Copilot flow - CLI IDE Web Mobile
aeonpeople
1
1.1k
GitHub Copilot CLI の Rubber Duck 機能を使ってコーディングの品質をあげよう #techbaton_findy
stefafafan
2
1.2k
テストコードのないプロジェクトにテストを根付かせる
tttol
0
210
Javaで学ぶSOLID原則
negima
1
220
Geek Woman の育ち方 〜コミュニティとAIと〜
chicaco
0
440
基礎から解説!Icebergで紐解くSnowflake×Databricks連携の現在地
cm_yasuhara
0
350
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
290
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
750
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
830
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
370
Paper Plane (Part 1)
katiecoart
PRO
0
7.9k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
510
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
190
Six Lessons from altMBA
skipperchong
29
4.2k
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); }
σϞ