https://bugzilla.wikimedia.org/show_bug.cgi?id=65566

--- Comment #3 from Ori Livneh <o...@wikimedia.org> ---
Something like this would work too, by making activation conditional on the key
not being present *and* on it being set successfully:

    function shouldShow() {
        try {
            if ( localStorage.getItem( ctaFlagKey ) === null ) {
                localStorage.setItem( ctaFlagKey, 'true' );
                return localStorage.getItem( ctaFlagKey ) !== null;
            }
        } catch (e) {}
        return false;
    }

This approach wouldn't work with $.jStorage, because it caches any stored value
in an in-memory object, so the call $.jStorage.get will always succeed even
when the value fails to persist.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to