当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript runloop.getCurrentRunLoop函数代码示例

本文整理汇总了TypeScript中@ember/runloop.getCurrentRunLoop函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getCurrentRunLoop函数的具体用法?TypeScript getCurrentRunLoop怎么用?TypeScript getCurrentRunLoop使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getCurrentRunLoop函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: while

  hooks.afterEach(function() {
    let { assert } = QUnit.config.current;

    if (getCurrentRunLoop()) {
      assert.ok(false, 'Should not be in a run loop at end of test');
      while (getCurrentRunLoop()) {
        end();
      }
    }

    if (hasScheduledTimers()) {
      assert.ok(false, 'Ember run should not have scheduled timers at end of test');
      cancelTimers();
    }
  });
开发者ID:jacobq,项目名称:ember.js,代码行数:15,代码来源:run-loop.ts

示例2: setTimeout

  hooks.afterEach(function(assert) {
    if (getCurrentRunLoop() || hasScheduledTimers()) {
      let done = assert.async();
      // use a setTimeout to allow the current run loop to flush via autorun
      setTimeout(() => {
        // increment expected assertion count for the assertions just below
        if (assert['test'].expected !== null) {
          assert['test'].expected += 2;
        }

        // if it is _still_ not completed, we have a problem and the test should be fixed
        assert.ok(
          !hasScheduledTimers(),
          'Ember run should not have scheduled timers at end of test'
        );
        assert.ok(!getCurrentRunLoop(), 'Should not be in a run loop at end of test');

        // attempt to recover so the rest of the tests can run
        while (getCurrentRunLoop()) {
          end();
        }
        cancelTimers();

        done();
      }, 0);
    }
  });
开发者ID:cibernox,项目名称:ember.js,代码行数:27,代码来源:run-loop.ts

示例3: setInterval

    let watcher = setInterval(() => {
      // If there are scheduled timers or we are inside of a run loop, keep polling
      if (hasScheduledTimers() || getCurrentRunLoop()) {
        return;
      }

      // Stop polling
      clearInterval(watcher);

      // Synchronously resolve the promise
      resolve(event);
    }, 5);
开发者ID:cibernox,项目名称:ember.js,代码行数:12,代码来源:run.ts

示例4: renderSettled

export function renderSettled() {
  if (renderSettledDeferred === null) {
    renderSettledDeferred = RSVP.defer();
    // if there is no current runloop, the promise created above will not have
    // a chance to resolve (because its resolved in backburner's "end" event)
    if (!getCurrentRunLoop()) {
      // ensure a runloop has been kicked off
      backburner.schedule('actions', null, K);
    }
  }

  return renderSettledDeferred.promise;
}
开发者ID:habdelra,项目名称:ember.js,代码行数:13,代码来源:renderer.ts


注:本文中的@ember/runloop.getCurrentRunLoop函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。