How to use the core-js/library/web/timers.setTimeout function in core-js

To help you get started, we’ve selected a few core-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github edu-sharing / Edu-Sharing / Frontend / src / app / common / services / cordova.service.ts View on Github external
if(this.isRunningCordova()) {
        // deviceready may not work, because cordova is already loaded, so try to set it ready after some time
        setTimeout(() => this.deviceIsReady = true, 1000);
    }
    //adding listener for cordova events
    document.addEventListener('deviceready', () => {
      this.deviceIsReady = true;
    }, false);
    document.addEventListener('pause', whenDeviceGoesBackground, false);
    document.addEventListener('resume', whenDeviceGoesForeground, false);

    // just for simulation on forced cordova mode
    if ((this.forceCordovaMode) && (!this.isReallyRunningCordova())) {
      console.log("SIMULATED deviceready event in FORCED CORDOVA MODE (just use during development)");
      setTimeout(this.whenDeviceIsReady,500+Math.random()*1000);
    } else if(this.isReallyRunningCordova()) {
      this.deviceReadyLoop(1);
    }

  }
github edu-sharing / Edu-Sharing / Frontend / src / app / common / services / cordova.service.ts View on Github external
* ignore pauses under 1 minute that appear when going into
       * a plugin (camera) or you get a permission request from the OS
       */
      if (this.appGoneBackgroundTS==null) return;
      if ((Date.now()-this.appGoneBackgroundTS)<(60*1000)) return;

      // OK - real pasuse detected
      console.log("CordovaService: App comes back from Background");

      // call listener if set
      if (this.deviceResumeCallback!=null) this.deviceResumeCallback();
    };

    if(this.isRunningCordova()) {
        // deviceready may not work, because cordova is already loaded, so try to set it ready after some time
        setTimeout(() => this.deviceIsReady = true, 1000);
    }
    //adding listener for cordova events
    document.addEventListener('deviceready', () => {
      this.deviceIsReady = true;
    }, false);
    document.addEventListener('pause', whenDeviceGoesBackground, false);
    document.addEventListener('resume', whenDeviceGoesForeground, false);

    // just for simulation on forced cordova mode
    if ((this.forceCordovaMode) && (!this.isReallyRunningCordova())) {
      console.log("SIMULATED deviceready event in FORCED CORDOVA MODE (just use during development)");
      setTimeout(this.whenDeviceIsReady,500+Math.random()*1000);
    } else if(this.isReallyRunningCordova()) {
      this.deviceReadyLoop(1);
    }
github edu-sharing / Edu-Sharing / Frontend / src / app / common / services / cordova.service.ts View on Github external
let waitLoop = () => {
          if (this.serviceIsReady) {
            observer.next(null);
            observer.complete();
          } else {
            console.log("Waiting for Device Ready .. waitloop");
            setTimeout(waitLoop,200);
          }
        };
        waitLoop();
github edu-sharing / Edu-Sharing / Frontend / src / app / common / services / cordova.service.ts View on Github external
private deviceReadyLoop(counter:number) : void {
    console.log("deviceReadyLoop("+counter+")");
    setTimeout(()=>{
      if (this.deviceIsReady) {
        this.whenDeviceIsReady();
      } else {
        this.deviceReadyLoop(++counter);
      }
    },250);
  }
github gitlabhq / gitlabhq / spec / javascripts / clusters / clusters_index_spec.js View on Github external
it('shows updated state after sucessfull request', (done) => {
      mock.onPut().reply(200, {}, {});
      const button = document.querySelector('.js-toggle-cluster-list');
      button.click();

      expect(button.classList).toContain('is-loading');

      setTimeout(() => {
        expect(button.classList).not.toContain('is-loading');
        expect(button.classList).not.toContain('is-checked');
        done();
      }, 0);
    });
github datafornews / metada / react / src / reducers / user.js View on Github external
data: {}
            }


        case 'SET_USER_STATUS':

            component = action.component;
            const checkTimeout = 15;
            const ts = component.props.user.timestamp || parseInt(localStorage['userTimestamp'], 10);

            if (!localStorage['_jwt']) {
                if (ts) {
                    return { ...state }
                }
                setTimeout(component.props.userLogOut, 1);
                setTimeout(component.props.setUserTimestamp, 1);
                return { ...state }
            }

            now = Math.round(new Date().getTime() / 1000);

            if (ts && now - ts < checkTimeout && !action.force) {
                return {
                    ...state
                }
            }

            Axios.post(
                "http://localhost:5000/auth/status",
                { status: true },
                {
                    headers: {
github fabric8-ui / fabric8-ui / src / app / components / planner-list / planner-list.component.ts View on Github external
togglePanel() {
    this.sidePanelRef.toggleSidePanel();
    setTimeout(() => {
    this.datatableWorkitems = [...this.datatableWorkitems];
    }, 500);
  }
github tidusjar / Ombi / src / Ombi / ClientApp / app / landingpage / landingpage.component.ts View on Github external
public cycleBackground() {
        setTimeout(() => {
            this.images.getRandomBackground().subscribe(x => {
                this.background = "";
            });
        }, 10000);
        setTimeout(() => {
            this.images.getRandomBackground().subscribe(x => {
                this.background = this.sanitizer
                    .bypassSecurityTrustStyle("linear-gradient(-10deg, transparent 20%, rgba(0,0,0,0.7) 20.0%, rgba(0,0,0,0.7) 80.0%, transparent 80%), url(" + x.url + ")");
            });
        }, 10000);
    }
}
github onap / sdc / catalog-ui / src / app / ng2 / components / ui / palette-animation / palette-animation.component.ts View on Github external
public runAnimation() {
    this.visible = true;
    let positionDiff:Point = new Point(this.to.x - this.from.x, this.to.y - this.from.y);
    setTimeout(()=>{
     this.transformStyle = 'translate('+ positionDiff.x + 'px,' + positionDiff.y +'px)';
    }, 0);
  };