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


TypeScript rsvp.configure函数代码示例

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


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

示例1: function

    beforeEach: function() {
      configure('async', customAsync);
      bb.begin();

      if (options.setup) {
        options.setup.apply(this, arguments);
      }
    },
开发者ID:tildeio,项目名称:router.js,代码行数:8,代码来源:test_helpers.ts

示例2: testConfigure

function testConfigure() {
    assertType<void>(RSVP.configure('name', { with: 'some value' }));
    assertType<{}>(RSVP.configure('name'));
}
开发者ID:Dru89,项目名称:DefinitelyTyped,代码行数:4,代码来源:rsvp-tests.ts

示例3:

/* globals Promise */

import RSVP from 'rsvp';
import hasEmberVersion from './has-ember-version';

export class _Promise<T> extends RSVP.Promise<T> {}

const ORIGINAL_RSVP_ASYNC: Function = RSVP.configure('async');

/*
  Long ago in a galaxy far far away, Ember forced RSVP.Promise to "resolve" on the Ember.run loop.
  At the time, this was meant to help ease pain with folks receiving the dreaded "auto-run" assertion
  during their tests, and to help ensure that promise resolution was coelesced to avoid "thrashing"
  of the DOM. Unfortunately, the result of this configuration is that code like the following behaves
  differently if using native `Promise` vs `RSVP.Promise`:

  ```js
  console.log('first');
  Ember.run(() => Promise.resolve().then(() => console.log('second')));
  console.log('third');
  ```

  When `Promise` is the native promise that will log `'first', 'third', 'second'`, but when `Promise`
  is an `RSVP.Promise` that will log `'first', 'second', 'third'`. The fact that `RSVP.Promise`s can
  be **forced** to flush synchronously is very scary!

  Now, lets talk about why we are configuring `RSVP`'s `async` below...

  ---

  The following _should_ always be guaranteed:
开发者ID:switchfly,项目名称:ember-test-helpers,代码行数:31,代码来源:-utils.ts


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