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/packages / pages / Status / StatusContainer.js
Size: Mime:
import * as tslib_1 from "tslib";
import { observable } from 'xmobx/mobx';
import { version, versions } from '../../../package';
/**
 * @todo - if it is down, infinite loop
 * 1. list of product ids
 * 2. hit all catalog pages (GET = read = fetch)
 * 3. hit permutations of compare
 * 4. only allow on localhost
 * 5. send emails
 */
class StatusContainer {
    constructor() {
        this.isItDown = false;
        this.isItCached = false;
        this.isJavaDown = false;
        this.isJavaCached = false;
        this.timerId = 0;
        this.elapsed = 0;
        this.version = {
            version,
            // @note sprint.version should be day of sprint? or 1st half 2nd half?
            ...versions,
        };
        // https://gist.github.com/DavidWells/590e2ae44894de612446
        // <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
        // <meta http-equiv="Pragma" content="no-cache" />
        // <meta http-equiv="Expires" content="0" />
        this.handleClearCache = () => {
            localStorage.clear();
            // document.cookie = ''
            alert('press cntrl/cmd + shift + delete');
            window.location.reload();
        };
    }
    // @todo
    async check() {
        // tick every 1 second
        // this.timerId = setInterval(() => {
        //   this.elapsed += 1
        //   if (this.elapsed > 30) {
        //     clearInterval(this.timer)
        //     this.isItDown = true
        //   }
        // }, 1000)
        // const result = await getNavCategories({ nocache: true })
        // const cachedResult = await getNavCategories()
        // // if we really want to check properly, check times & pdp vs plp
        // const streamResponse = await fetch(
        //   'https://reactdemo.skavaone.com/skavastream/core/v5/wrskavastore/productlist/fashionmen?&campaignId=2691&locale=en_US&storeId=atlanta&offset=0&limit=3'
        // )
        // const streamResponse2 = await fetch(
        //   'https://reactdemo.skavaone.com/skavastream/core/v5/wrskavastore/productlist/fashionmen?&campaignId=2691&locale=en_US&storeId=atlanta&offset=0&limit=3&t=' +
        //     Math.random()
        // )
        // if (!streamResponse.ok) {
        //   state.isJavaDown = true
        // }
        // if (result === undefined) {
        //   state.isItDown = true
        // }
        // if (cachedResult !== undefined) {
        //   state.isItCached = true
        // }
        // const streams = await [streamResponse, streamResponse2].map(stream => stream.json())
        // const [first, second] = streams
        // if (JSON.stringify(first) !== JSON.stringify(second)) {
        //   cache.isJavaCached = true
        // }
        // console.log({ result, cachedResult, streams })
    }
}
tslib_1.__decorate([
    observable
], StatusContainer.prototype, "isItDown", void 0);
tslib_1.__decorate([
    observable
], StatusContainer.prototype, "isItCached", void 0);
tslib_1.__decorate([
    observable
], StatusContainer.prototype, "isJavaDown", void 0);
tslib_1.__decorate([
    observable
], StatusContainer.prototype, "isJavaCached", void 0);
tslib_1.__decorate([
    observable
], StatusContainer.prototype, "timerId", void 0);
tslib_1.__decorate([
    observable
], StatusContainer.prototype, "elapsed", void 0);
tslib_1.__decorate([
    observable.ref
], StatusContainer.prototype, "version", void 0);
export { StatusContainer };
//# sourceMappingURL=StatusContainer.js.map