|
@@ -22,6 +22,7 @@
|
22
|
22
|
|
23
|
23
|
import Speedy from 'speedy-vision';
|
24
|
24
|
import { SpeedySize } from 'speedy-vision/types/core/speedy-size';
|
|
25
|
+import { SpeedyPromise } from 'speedy-vision/types/core/speedy-promise';
|
25
|
26
|
import { AssertionError, IllegalArgumentError } from './errors';
|
26
|
27
|
import { Resolution, computeResolution } from './resolution';
|
27
|
28
|
|
|
@@ -91,6 +92,18 @@ export class Utils
|
91
|
92
|
}
|
92
|
93
|
|
93
|
94
|
/**
|
|
95
|
+ * Wait a few milliseconds
|
|
96
|
+ * @param milliseconds how long should we wait?
|
|
97
|
+ * @returns a promise that resolves soon after the specified time
|
|
98
|
+ */
|
|
99
|
+ static wait(milliseconds: number): SpeedyPromise<void>
|
|
100
|
+ {
|
|
101
|
+ return new Speedy.Promise<void>(resolve => {
|
|
102
|
+ setTimeout(resolve, milliseconds);
|
|
103
|
+ });
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ /**
|
94
|
107
|
* Convert a resolution type to a resolution measured in pixels
|
95
|
108
|
* @param resolution resolution type
|
96
|
109
|
* @param aspectRatio width / height ratio
|