1 | import RSVP from 'rsvp';
|
2 | declare type PromiseType<T> = Promise<T> | RSVP.Promise<T>;
|
3 | /**
|
4 | * A convenient utility function to simplify waiting for a promise.
|
5 | *
|
6 | * @public
|
7 | * @param promise {Promise<T> | RSVP.Promise<T>} The promise to track async operations for
|
8 | * @param label {string} An optional string to identify the promise
|
9 | *
|
10 | * @example
|
11 | *
|
12 | * import Component from '@ember/component';
|
13 | * import { waitForPromise } from '@ember/test-waiters';
|
14 | *
|
15 | * export default class Friendz extends Component {
|
16 | * didInsertElement() {
|
17 | * waitForPromise(new Promise(resolve => {
|
18 | * doSomeWork();
|
19 | * resolve();
|
20 | * }));
|
21 | * }
|
22 | * }
|
23 | */
|
24 | export default function waitForPromise<T, KindOfPromise extends PromiseType<T>>(promise: KindOfPromise, label?: string): KindOfPromise;
|
25 | export {};
|