@augment-vir/common 31.7.0 → 31.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeferredPromise } from '@augment-vir/core';
|
|
1
2
|
/**
|
|
2
3
|
* Call a function asynchronously without interrupting current synchronous execution, even if the
|
|
3
4
|
* function was originally synchronous.
|
|
@@ -22,5 +23,9 @@
|
|
|
22
23
|
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
23
24
|
*/
|
|
24
25
|
export async function callAsynchronously(callback) {
|
|
25
|
-
|
|
26
|
+
const deferredPromise = new DeferredPromise();
|
|
27
|
+
setTimeout(async () => {
|
|
28
|
+
deferredPromise.resolve(await callback());
|
|
29
|
+
});
|
|
30
|
+
return deferredPromise.promise;
|
|
26
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/common",
|
|
3
|
-
"version": "31.7.
|
|
3
|
+
"version": "31.7.2",
|
|
4
4
|
"description": "A collection of augments, helpers types, functions, and classes for any JavaScript environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augment",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"test:web": "virmator --no-deps test web"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@augment-vir/assert": "^31.7.
|
|
43
|
-
"@augment-vir/core": "^31.7.
|
|
42
|
+
"@augment-vir/assert": "^31.7.2",
|
|
43
|
+
"@augment-vir/core": "^31.7.2",
|
|
44
44
|
"@date-vir/duration": "^7.1.2",
|
|
45
45
|
"ansi-styles": "^6.2.1",
|
|
46
46
|
"json5": "^2.2.3",
|