Skip to content

Commit

Permalink
(refactor/deps): extract out mst-persist into its own lib
Browse files Browse the repository at this point in the history
- made a bunch of changes, but works in mostly the same fashion
  - mostly additions and superificial changes to the underlying code
    - e.g. whitelists + blacklists (and as arrays, like redux-persist),
      persist returns promise instead of calling `afterHydration`, etc

- wanted lib per pinqy520/mobx-persist#37 ,
  but only gists and examples around
  - it's a tiny wrapper library for now, but still faster than writing
    by yourself

- installing via GH since empty NPM package is owned by someone else rn
  - pinqy520/mobx-persist#37 (comment)
  • Loading branch information
agilgur5 committed May 19, 2019
1 parent 9121f20 commit 286725f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 94 deletions.
11 changes: 6 additions & 5 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from 'react'
import persist from 'mst-persist'
import { AsyncStorage } from 'react-native'
import { Provider } from 'mobx-react'

import AppModel from './models/models.js'
import { persist } from './utils/persist'
import MainView from './components/mainView.js'

const appStore = AppModel.create()

persist('@mangaStoreKey', appStore, {
storage: AsyncStorage,
jsonify: true // set to true if using AsyncStorage
}, {
mangas: true,
favorites: true
jsonify: true, // set to true if using AsyncStorage
whitelist: [
'mangas',
'favorites'
]
})

const App = () => (
Expand Down
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"mobx": "^5.9.4",
"mobx-react": "^5.2.5",
"mobx-state-tree": "^3.14.0",
"mst-persist": "github:agilgur5/mst-persist",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz"
},
Expand Down
42 changes: 0 additions & 42 deletions utils/persist.js

This file was deleted.

47 changes: 0 additions & 47 deletions utils/storage.js

This file was deleted.

0 comments on commit 286725f

Please sign in to comment.