Skip to content

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Apr 11, 2023

const storage = new MMKV()

storage.batch((s) => {
  s.set('hello', 'world')
  s.set('test', 'another')
  s.set('someLargeBuffer', buffer)
})

@adhorodyski
Copy link

Love the feature!
I've been playing with the library lately for https://github.com/Expensify/App and have a quick question - as far as I understand this will trigger addOnValueChangedListener for each updated key (20k keys when eg. populating will do 20k events etc), do you think it might be worth to have a separate listener notifying about the batched updates being applied? Like a addOnBatchedValuesChangedListener 😅 that will trigger only once.

@mrousavy
Copy link
Owner Author

Hey - yea for listeners we should maybe batch that as well then. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants