Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/create-apollo-client / dist / cache / apolloCachePersist.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const apollo_cache_persist_1 = require("apollo-cache-persist");
const apolloCache_1 = require("./apolloCache");
/**
 * @note exported as fn to not make it a side effect
 * @note this is super slow
 * @note was process.env.USE_APOLLO_CACHE
 * @see https://github.com/apollographql/apollo-cache-persist/blob/0bc569308379b4cc59b2c7f5f4823428b208ada0/src/types/index.ts
 */
exports.default = () => {
    if (process.env.NODE_ENV === 'test') {
        // ignore
    }
    else if (process.env.DISABLE_APOLLO_CACHE_PERSIST !== undefined) {
        console.warn('[create-apollo-client] process.env.DISABLE_APOLLO_CACHE_PERSIST was not undefined');
        return;
    }
    else if (typeof window === 'object' &&
        typeof window.localStorage === 'object') {
        const cacheConfig = {
            cache: apolloCache_1.cache,
            storage: window.localStorage,
            key: 'graphql-client-cache',
        };
        /**
         * @note this returns a promise
         */
        apollo_cache_persist_1.persistCache(cacheConfig);
    }
    else {
        // is server
    }
};
//# sourceMappingURL=apolloCachePersist.js.map