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
ElectronでFirebaseを使ってみた(仮)
Search
Masaya Nasu
June 03, 2016
Programming
2
3.4k
ElectronでFirebaseを使ってみた(仮)
ElectronでFirebaseを使ってみました。
Masaya Nasu
June 03, 2016
Tweet
Share
More Decks by Masaya Nasu
See All by Masaya Nasu
What's new in Go 1.23
nasum
0
75
カミナシのフロントエンド開発の効率化の取り組み
nasum
2
270
新参者だけどバーンアウトしかけているチームを立て直す
nasum
21
11k
DjangoではじめるGraphQLとフロントエンド開発の協業
nasum
1
3.3k
Flutterとfirebaseを使ってモバイルアプリに挑戦してみる
nasum
3
2.9k
grpc-gatewayで作るマイクロサービスの管理画面
nasum
1
7.5k
コストをかけずに機械学習の環境を整える&学習環境(人間の)
nasum
0
1.6k
Elixirの好きなところ
nasum
0
490
Vue.jsを導入する際失敗したこと
nasum
1
4.1k
Other Decks in Programming
See All in Programming
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
230
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
0
190
Lottieアニメーションをカスタマイズしてみた
tahia910
0
130
AWS Organizations で実現する、 マルチ AWS アカウントのルートユーザー管理からの脱却
atpons
0
150
Bedrock Agentsレスポンス解析によるAgentのOps
licux
3
840
Amazon S3 TablesとAmazon S3 Metadataを触ってみた / 20250201-jawsug-tochigi-s3tables-s3metadata
kasacchiful
0
160
CNCF Project の作者が考えている OSS の運営
utam0k
6
710
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
550
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
46
17k
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
340
JavaScriptツール群「UnJS」を5分で一気に駆け巡る!
k1tikurisu
9
1.8k
SpringBoot3.4の構造化ログ #kanjava
irof
2
990
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
630
Gamification - CAS2011
davidbonilla
80
5.1k
Why Our Code Smells
bkeepers
PRO
336
57k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How STYLIGHT went responsive
nonsquared
98
5.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Transcript
ElectronͰFirebaseΛͬͯ ΈΔʢԾʣ Gotanda.js #4 in Retty
ࣗݾհ • Github @nasum • twitter @tomato360
Electron • ݴΘͣͱΕͨGithubͷϑϨʔϜϫʔΫ • ࠷ۙ1.0͕ϦϦʔε͞Ε·ͨ͠ • ͏1.2.1ʹͳͬͯΔɻૣ͕͞ා͍ • ηΩϡϦςΟେมͳΠϝʔδ ElectronΞϓϦͷXSSͰrm
-fr /Λ࣮ߦ͢Δ http://qiita.com/akameco/items/cc6fc949e7c9f0d1a42a
Firebase • Google͕ങऩͨ͠BaaS • ϦΞϧλΠϜʹσʔλΛಉظ͢ΔͷʹڧΈͷ ͋ΔαʔϏε • Google IO Ͱϩάղੳϓογϡ௨ͷػೳ
͕Ճ͞Εͯ
Έ߹Θͤͨಈػ • Electron1ܥʹͳֶͬͨ͠ͼ͢ࠒ߹͍ • EvernoteͷΑ͏ͳͷΛ࡞Γ͔ͨͬͨ • σʔλΛͲ͏ཷΊΔ͔ʹΜͩ • nedb
https://github.com/louischatriot/nedb • electron-json-storage https://github.com/jviotti/electron-json-storage • etc…etc… • Firebaseͷrealtime databaseΛ༻͍Ε͍͚ͦ͏
FirebaseͷWeb൛ͰͰ͖Δ͜ͱ • Authentication • Realtime Database • Storage • Hosting
• Cloud Messaging ElectronͰ͑ͦ͏
ҙɿͣͬͱܯࠂ͕Ͱ·͢
ElectronͰAuth • ElectronͰGoogleTwitterɺFacebookͷೝূ͑ͳ͍ • origin͕file://͔ͩΒઃఆͰ͖ͳ͍ • CordovaͰࣅͨΑ͏ͳ͜ͱͰΜͰ͍Δਓ͕͍ͨ https://groups.google.com/forum/#!topic/firebase-talk/ eUzTjj8mVa4 •
signInWithEmailAndPasswordΛ͑ೝূग़དྷΔ https://firebase.google.com/docs/auth/web/password- auth#before_you_begin
Ϣʔβ࡞ var auth = firebase.auth(); auth.createUserWithEmailAndPassword(email, password).then(function(){ console.log('ok') var uid
= auth.currentUser.uid; console.log(uid) writeUserData(uid, "hoge", email); }).catch(function(error) { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // ... });
Ϣʔβೝূ var auth = firebase.auth(); auth.signInWithEmailAndPassword(email, password).then(function(){ console.log('ok') var uid
= auth.currentUser.uid; console.log(uid) }).catch(function(error) { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; console.log(errorCode); console.log(errorMessage); });
ೝূ݁Ռ
ೝূใLocalStorageʹೖΔ
ೝূ͏·͍ͬͨͧ͘ʂ ʢͰݸਓ༻్ͰೝূΘͳ͍͔Ͷʂʣ
Realtime Database • ίϯιʔϧͰϧʔϧΛܾΊΔඞཁ͕͋Δ • ݁ߏෳࡶͰ׳ΕΔ·Ͱେม • FirebaseͷRulesΛཧղ͢Δ http://qiita.com/laco0416/items/ b068ab0cf19a26f0992d
ࢼ͠ʹ࡞ͬͨϧʔϧ
ϧʔϧςετͰ͖Δ
realtime databaseʹอଘ͢Δ ίʔυ var auth = firebase.auth(); var uid =
auth.currentUser.uid; var obj = { "title": "test", "description": "description" }; //σʔλΛηοτ͢Δ firebase.database().ref('documents/' + uid).push(obj); //σʔλͷҰཡΛऔಘ͢Δ firebase.database().ref('documents/' + uid).once('value').then(function(snapshot) { console.log(snapshot.val()); }); //σʔλͷมߋΛݕ͠දࣔ͢Δ firebase.database().ref('documents/' + uid).on('value', function(snapshot) { console.log(snapshot.val()); });
ಈ͔ͯ͠ΈΔ
realtime database͏·͘ ͍͖ͦ͏ʂ
Ͱ͜͜Ͱ࣌ؒΕ storageͱ͔ࢼ͔ͨͬͨ͠
·ͱΊ • ೝূଞͷαʔϏεͷOAuth͑ͳ͍͚Ͳemail͔ͭͬͨೝূग़ དྷΔ • realtime databaseบ͕͋Δ • ϦΞϧλΠϜͰߋ৽͞ΕΔ͔Βຊνϟοτ͚ͩΑͶ •
࣮ೝূͳ͠Ͱ͑Δ • ܯࠂ͕ग़ଓ͚Δ͔Βݸਓ༻్Ͱ͓͏ʂ • ࠷ऴతʹElectron͋Μ·Γؔͳ͘ͳͬͪΌͬͨ