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
970
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
350
Design It! in a nutshell
nunulk
1
300
PHP Getting Faster
nunulk
0
290
How does learning English broaden your world?
nunulk
0
420
Testing on Laravel
nunulk
1
1.6k
Nuxt.js in TypeScript
nunulk
1
460
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
610
Other Decks in Technology
See All in Technology
案件に一番詳しいAIを Amazon Bedrock AgentCore で作る ― 知見が知見を生むチームへ / Compounding Knowledge with AgentCore
yusukeshimizu
1
170
LanceDB入門
mocobeta
9
670
AIで変わるエンジニアの働き方(仮)
naoinaoi
0
450
内製AIチャットボット開発で学んだ Datadog Agent Observability活用術
mkdev10
0
110
AIコーディングの次。コードレビューと理解負荷を解消して組織の開発生産性を高める
moongift
PRO
2
2.7k
도구에서 동료까지: 10년차 AI 스타트업의 AI 적응기
inureyes
PRO
1
330
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
暗号化?某ファイルストレージはどうなるの!? 3rd Partyとうまく付き合う秘密度ラベル設計
kasada
0
140
トークンマネジメントでAIにとって働きやすい環境を実現する
hikaruegashira
0
140
強化学習「理論」入門
enakai00
3
3.6k
RapidCopy2 Matrix I/Oエンジンによるファイルコピーソフトウェアの設計と実装
kengosawa2
1
310
【GCC2026】TrueHDRIを用いたルックデブ環境とライティングテクニック
bandainamcostudios
PRO
0
290
Featured
See All Featured
For a Future-Friendly Web
brad_frost
183
10k
Optimising Largest Contentful Paint
csswizardry
37
3.9k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
380
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
870
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Color Theory Basics | Prateek | Gurzu
gurzu
0
430
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
280
Building the Perfect Custom Keyboard
takai
2
850
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
550
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
300
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); }
σϞ