Hi Austin,
> 2) I have some concern where you are testing for the presence of the
> "storage" object. I would recommend changing:
>
> if (storage) {
>
> To
>
> if (typeof localeStorage === 'object') {
>
> The reason for this is that you appear to only be using localStorage and not
> globalStorage or the other variations. Be specific so as to avoid
> uncertainty in potential edge cases. Testing against typeof is generally
> considered the safest way to validate whether or nothing is undefined, which
> is important cross browser.
Yeah, I've seen it both ways and I do use typeof identity checks in my
workflow. I do like the short storage shortcut/alias personally, but
I think I'll change it to your suggestion.
> 3) You are declaring a "loadData" function before you are testing for the
> presence of the storage, or localStorage, object. If localStorage were not
> available this would throw and error.
But I'm only calling loadData from within the if (storage) condition.
If storage isn't supported the function won't be called. I think I'll
move the loadData and saveData functions inside the conditional,
though.
Thanks much for your feedback!
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]