Skip to content

How to give default value instead of undefined when deleting a property? #1011

Answered by dai-shi
lmk123 asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not strongly suggesting it, but "sync" subscribe might help this specific case.

subscribe(storage, () => {
  if (!('foo' in storage)) {
    storage.foo = 'bar'
  }
}, true)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@lmk123
Comment options

@dai-shi
Comment options

@lmk123
Comment options

@dai-shi
Comment options

Answer selected by lmk123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants