Cannot watch localStorage
gymbry opened this issue · comments
Tried:
localStorage.setItem('name, 'gymbry');
watch(localStorage, 'name', function () { alert() });
localStorage.setItem('name, 'stuff');
which returns nothing.
Tried:
localStorage.watch('name', function () { alert() });
which says "Undefined is not a function".
Also tried:
watch(JSON.parse(localStorage), 'name', function () { alert() });
and
JSON.parse(localStorage).watch('name', function () { alert() });
which returns error "Uncaught SyntaxError: Unexpected token o".
This same error is returned when using Object.observe().
Did you ever solve this @gymbry ? Outside of some dirty checking, I'm running out of options for a use case like this.
Yeah, that will not work, localStorage is not a plain object