Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vue.jsを使って良かったこと
Search
Asai Masami
June 17, 2017
Programming
290
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vue.jsを使って良かったこと
Frontend Nagoya #1 LT
Asai Masami
June 17, 2017
More Decks by Asai Masami
See All by Asai Masami
デラなごや.jsはじめました
pipboy3000
0
150
Other Decks in Programming
See All in Programming
Event is what happens
moro
2
860
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
280
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
670
The Rails Doctrine Decade
koic
2
600
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
170
[2026-10-14](C)Re:ゼロから始める異世界生活〜始まりの終わりと終わりの始まり〜
tosite
0
110
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
ジョジョの世界をXRで再現する
mofurune
0
170
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
Railsバージョンを4倍にした話
optim
0
450
Featured
See All Featured
Being A Developer After 40
akosma
92
590k
The Cult of Friendly URLs
andyhume
79
7k
ラッコキーワード サービス紹介資料
rakko
1
5.4M
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Marketing to machines
jonoalderson
1
5.9k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
520
From π to Pie charts
rasagy
1
400
Music & Morning Musume
bryan
48
7.4k
Making the Leap to Tech Lead
cromwellryan
135
10k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Transcript
Vue.jsΛͬͯྑ͔ͬͨ͜ͱ ઙҪխݾ ݄
@count0 http://count0.org ઙҪխݾ
ࠓ͓͢͠Δ͜ͱ ͓ࣄͰVue.jsΛͬͯۀπʔϧΛվ मͨ͠ΒͩͬͨͷͰྑ͔ͬͨػೳΛ1 ͓ͭ͠·͢ɻ
VuexͷϓϥάΠϯ
͖͔͚ͬ • ঢ়ଶͷӬଓԽΛlocalstorage͔ΒIndexedDBʹ͢Δඞ ཁ͕͋ͬͨ • ঢ়ଶΛมߋͨ͠ΒIndexedDBͱউखʹಉظͯ͠ཉ͍͠ • ྫ͑vuex-persistedstateΈ͍ͨʹ
vuex-persistedstate ঢ়ଶΛlocalstorageͱಉظͯ͘͠ΕΔɻ ࠷ݶ͏ʹ͜Ε͚ͩɻ ͱͯศརɻ ͜ΕͷIndexedDB൛͕ཉ͍͠ɻ import createPersistedState from 'vuex-persistedstate' const
store = new Vuex.Store({ // ... plugins: [createPersistedState()] })
ͱΓ͋͑ͣconsole.logͯ͠ΈΔ Vue.use(Vuex) function onlyConsole () { return store => {
store.subscribe(mutation => { console.group('onlyConsole plugin') console.dir(mutation) console.groupEnd() }) } } export default new Vuex.Store({ strict: process.env.NODE_ENV !== 'production', state: initialState(), mutations, actions, getters, plugins: [ onlyConsole() ] })
શͯͷmutation͕ૉ௨Γ จࣈ௨ΓTVCTDSJCFʢఆظߪಡʣ͍ͯ͠Δ
mutation typeΛϑοΫʹ store.subscribe((mutation, state) => { switch (mutation.type) { case
types.ADD_ITEM: case types.UPDATE_ITEM: const item = mutation.payload.item localforage.setItem(item.id, item) break case types.REMOVE_ITEM: localforage.removeItem(mutation.payload.item.id) break case types.CLEAR_LIST: localforage.clear().then(() => console.log('clear database.')) break default: break } }) Ϧετͷૢ࡞͕ൃੜͨ͠Β*OEFYFE%#ʹө
͏Ͱ͖ͨ ΞϓϦέʔγϣϯͷmutation typeʹґଘ͓ͯ͠ Γʢີ݁߹ʣΑΖ͘͠ͳ͍͋Δ͕ɺ͜ΕͰ తୡͰ͖ͯ͠·ͬͨɻ ※࣮ࡍͷίʔυlocalForageͷॳظԽಡΈग़ͨ͠σʔλΛঢ়ଶʹ෮ؼͤ͞Δॲ ཧΛߦ͍ͬͯ·͢ɻ
·ͱΊ • store.subscribeΛར༻͢ΕmutationΛϑο Ϋʹͨ͠ॲཧΛ؆୯ʹՃ͢Δ͜ͱ͕Ͱ͖· ͢ • ࠓճͷྫͰIndexedDBͰ͕ͨ͠ɺαʔόʔ αΠυͷDBʹঢ়ଶΛӬଓԽ͢Δ͜ͱγϯϓ ϧʹ࣮Ͱ͖ͦ͏Ͱ͢
͋Γ͕ͱ͏͍͟͝·ͨ͠