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
68
カミナシのフロントエンド開発の効率化の取り組み
nasum
2
260
新参者だけどバーンアウトしかけているチームを立て直す
nasum
21
11k
DjangoではじめるGraphQLとフロントエンド開発の協業
nasum
1
3.2k
Flutterとfirebaseを使ってモバイルアプリに挑戦してみる
nasum
3
2.8k
grpc-gatewayで作るマイクロサービスの管理画面
nasum
1
7.4k
コストをかけずに機械学習の環境を整える&学習環境(人間の)
nasum
0
1.5k
Elixirの好きなところ
nasum
0
470
Vue.jsを導入する際失敗したこと
nasum
1
4.1k
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Outline View in SwiftUI
1024jp
1
330
Jakarta EE meets AI
ivargrimstad
0
620
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
150
最新TCAキャッチアップ
0si43
0
190
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
990
CSC509 Lecture 12
javiergs
PRO
0
160
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
940
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Cult of Friendly URLs
andyhume
78
6k
Code Review Best Practice
trishagee
64
17k
Writing Fast Ruby
sferik
627
61k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Pragmatic Product Professional
lauravandoore
31
6.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
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͋Μ·Γؔͳ͘ͳͬͪΌͬͨ