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.3k
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
69
カミナシのフロントエンド開発の効率化の取り組み
nasum
2
260
新参者だけどバーンアウトしかけているチームを立て直す
nasum
21
11k
DjangoではじめるGraphQLとフロントエンド開発の協業
nasum
1
3.3k
Flutterとfirebaseを使ってモバイルアプリに挑戦してみる
nasum
3
2.9k
grpc-gatewayで作るマイクロサービスの管理画面
nasum
1
7.4k
コストをかけずに機械学習の環境を整える&学習環境(人間の)
nasum
0
1.6k
Elixirの好きなところ
nasum
0
480
Vue.jsを導入する際失敗したこと
nasum
1
4.1k
Other Decks in Programming
See All in Programming
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
130
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
700
良いユニットテストを書こう
mototakatsu
5
1.9k
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
선언형 UI에서의 상태관리
l2hyunwoo
0
140
プロダクトの品質に コミットする / Commit to Product Quality
pekepek
2
770
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
690
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
510
Mobile First: as difficult as doing things right
swwweet
222
9k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Practical Orchestrator
shlominoach
186
10k
A better future with KSS
kneath
238
17k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
A Tale of Four Properties
chriscoyier
157
23k
Typedesign – Prime Four
hannesfritz
40
2.4k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
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͋Μ·Γؔͳ͘ͳͬͪΌͬͨ