Closed staltz closed 7 years ago
The number 1 reason it's sync is because it's generally something that you only have to do once, at startup (like loading configuration). Making it be sync means you can avoid what would otherwise be another closure around your whole application. do you have access to localStorage
in react-native?
merged into 7.0.6
do you have access to localStorage in react-native?
Unfortunately not, it's only the AsyncStorage.
fs.readFileSync
is not available in https://www.npmjs.com/package/level-filesystem which is what React Native uses when shimmingfs
(because it cannot support sync APIs). I figured that this line of code is checking (1) whetherfs
is available and (2) whetherfs
is actually a filesystem API. It seems for purpose (2) thatreadFile
is enough. Or is there a reason forreadFileSync
?With these changes, an
fs
object missingreadFileSync
would still work as long asloadSync
is avoided andload
is used instead.