@alwatr/delay 1.0.6 → 1.0.7
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.
- package/CHANGELOG.md +28 -21
- package/README.md +38 -31
- package/dist/main.cjs +2 -2
- package/dist/main.mjs +2 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.7](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.0.6...@alwatr/delay@1.0.7) (2024-10-25)
|
|
7
|
+
|
|
8
|
+
### Dependencies update
|
|
9
|
+
|
|
10
|
+
* bump the development-dependencies group across 1 directory with 2 updates ([2dfda9e](https://github.com/Alwatr/nanolib/commit/2dfda9ec38a595f1fd961490d1a2fbf060f20a66)) by @dependabot[bot]
|
|
11
|
+
* bump the development-dependencies group with 8 updates ([16847ac](https://github.com/Alwatr/nanolib/commit/16847acba91da027c422e3910d0f2dcc1f084e93)) by @dependabot[bot]
|
|
12
|
+
|
|
6
13
|
## [1.0.6](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.0.5...@alwatr/delay@1.0.6) (2024-10-12)
|
|
7
14
|
|
|
8
15
|
**Note:** Version bump only for package @alwatr/delay
|
|
@@ -11,19 +18,19 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
18
|
|
|
12
19
|
### Bug Fixes
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
- use new `global-this` package & remove global type & prevent sidee-ffects ([092d448](https://github.com/Alwatr/nanolib/commit/092d44885738ed58215698917ae97c13958f7c7d)) by @mohammadhonarvar
|
|
15
22
|
|
|
16
23
|
### Code Refactoring
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
- **delay:** prevent side-effects ([f92eeed](https://github.com/Alwatr/nanolib/commit/f92eeed7d917f6eb3ca9a407fab0b1ea77adc1d4)) by @mohammadhonarvar
|
|
26
|
+
- prevent side-effects ([01e00e1](https://github.com/Alwatr/nanolib/commit/01e00e191385cc92b28677df0c01a085916ae677)) by @mohammadhonarvar
|
|
27
|
+
- use new `global-this` package ([42510b9](https://github.com/Alwatr/nanolib/commit/42510b9ae0e385206a902db093d188949f1cb84e)) by @mohammadhonarvar
|
|
21
28
|
|
|
22
29
|
## [1.0.4](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.0.3...@alwatr/delay@1.0.4) (2024-10-11)
|
|
23
30
|
|
|
24
31
|
### Miscellaneous Chores
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
- include LICENSE and LEGAL files to publish ([09f366f](https://github.com/Alwatr/nanolib/commit/09f366f680bfa9fb26acb2cd1ccbc68c5a9e9ad8)) by @AliMD
|
|
27
34
|
|
|
28
35
|
## [1.0.3](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.0.2...@alwatr/delay@1.0.3) (2024-10-11)
|
|
29
36
|
|
|
@@ -33,7 +40,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
33
40
|
|
|
34
41
|
### Dependencies update
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
- bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @dependabot[bot]
|
|
37
44
|
|
|
38
45
|
## [1.0.1](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.0.0...@alwatr/delay@1.0.1) (2024-10-08)
|
|
39
46
|
|
|
@@ -43,19 +50,19 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
43
50
|
|
|
44
51
|
### Features
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
- use `package-tracer` ([cc3c5f9](https://github.com/Alwatr/nanolib/commit/cc3c5f9c1a3d03f0d81b46835665f16a0426fd0d)) by @mohammadhonarvar
|
|
47
54
|
|
|
48
55
|
### Code Refactoring
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
- **delay:** update delay package to use @alwatr/parse-duration for duration delays ([cca1be2](https://github.com/Alwatr/nanolib/commit/cca1be2dcfeec6dce388562ef867b81af1823b62)) by @AliMD
|
|
58
|
+
- **delay:** update untilIdle function to accept Duration instead of DurationString ([b3a5c32](https://github.com/Alwatr/nanolib/commit/b3a5c322a1b59833693149da644c7d2eddd6a374)) by @AliMD
|
|
59
|
+
- update Dictionary type definitions ([c94cbc4](https://github.com/Alwatr/nanolib/commit/c94cbc4523864e2cc47828ccf5508b68945ac2b8)) by @AliMD
|
|
60
|
+
- use new type-helper global types and remove all import types ([08b5d08](https://github.com/Alwatr/nanolib/commit/08b5d08c03c7c315382337239de0426462f384b8)) by @AliMD
|
|
61
|
+
- **wait:** rename package to delay ([cf8c45c](https://github.com/Alwatr/nanolib/commit/cf8c45cf3f5b61fdd4b1b1c7f744c4eb3e230016)) by @AliMD
|
|
55
62
|
|
|
56
63
|
### Miscellaneous Chores
|
|
57
64
|
|
|
58
|
-
|
|
65
|
+
- fix versions ([497a6d8](https://github.com/Alwatr/nanolib/commit/497a6d81ae5989e566e96d498fc5f1b6c80193ae)) by @AliMD
|
|
59
66
|
|
|
60
67
|
## [1.1.16](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.15...@alwatr/delay@1.1.16) (2024-09-21)
|
|
61
68
|
|
|
@@ -65,32 +72,32 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
65
72
|
|
|
66
73
|
### Dependencies update
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
- bump the development-dependencies group across 1 directory with 10 updates ([9ed98ff](https://github.com/Alwatr/nanolib/commit/9ed98ffd0668d5a36e255c82edab3af53bffda8f)) by @dependabot[bot]
|
|
76
|
+
- update ([c36ed50](https://github.com/Alwatr/nanolib/commit/c36ed50f68da2f5608ccd96119963a16cfacb4ce)) by @AliMD
|
|
70
77
|
|
|
71
78
|
## [1.1.14](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.13...@alwatr/delay@1.1.14) (2024-08-31)
|
|
72
79
|
|
|
73
80
|
### Miscellaneous Chores
|
|
74
81
|
|
|
75
|
-
|
|
82
|
+
- Update package.json exports for [@alwatr](https://github.com/alwatr) packages ([dacb362](https://github.com/Alwatr/nanolib/commit/dacb362b145e3c51b4aba00ff643687a3fac11d2)) by @
|
|
76
83
|
|
|
77
84
|
## [1.1.13](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.12...@alwatr/delay@1.1.13) (2024-08-31)
|
|
78
85
|
|
|
79
86
|
### Dependencies update
|
|
80
87
|
|
|
81
|
-
|
|
88
|
+
- update all dependencies ([1e0c30e](https://github.com/Alwatr/nanolib/commit/1e0c30e6a3a8e19deb5185814e24ab6c08dca573)) by @AliMD
|
|
82
89
|
|
|
83
90
|
## [1.1.12](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.11...@alwatr/delay@1.1.12) (2024-07-04)
|
|
84
91
|
|
|
85
92
|
### Dependencies update
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
- update all dependencies ([0e908b4](https://github.com/Alwatr/nanolib/commit/0e908b476a6b976ec2447f864c8cafcbb8a0f099)) by @
|
|
88
95
|
|
|
89
96
|
## [1.1.11](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.10...@alwatr/delay@1.1.11) (2024-05-12)
|
|
90
97
|
|
|
91
98
|
### Dependencies update
|
|
92
99
|
|
|
93
|
-
|
|
100
|
+
- upgrade ([6dbd300](https://github.com/Alwatr/nanolib/commit/6dbd300642c9bcc9e7d0b281e244bf1b06eb1c38)) by @AliMD
|
|
94
101
|
|
|
95
102
|
## [1.1.10](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.9...@alwatr/delay@1.1.10) (2024-04-25)
|
|
96
103
|
|
|
@@ -104,11 +111,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
104
111
|
|
|
105
112
|
### Bug Fixes
|
|
106
113
|
|
|
107
|
-
|
|
114
|
+
- exported types by add .js extensions to all imports ([fc3d83e](https://github.com/Alwatr/nanolib/commit/fc3d83e8f375da97ba276314b2e6966aa82c9b3f)) by @AliMD
|
|
108
115
|
|
|
109
116
|
### Miscellaneous Chores
|
|
110
117
|
|
|
111
|
-
|
|
118
|
+
- **deps:** update ([1a45030](https://github.com/Alwatr/nanolib/commit/1a450305440b710a300787d4ca24b1ed8c6a39d7)) by @AliMD
|
|
112
119
|
|
|
113
120
|
## [1.1.7](https://github.com/Alwatr/nanolib/compare/@alwatr/delay@1.1.6...@alwatr/delay@1.1.7) (2024-01-24)
|
|
114
121
|
|
package/README.md
CHANGED
|
@@ -16,77 +16,84 @@ yarn add @alwatr/delay
|
|
|
16
16
|
|
|
17
17
|
Each function within `@alwatr/delay` returns a Promise that resolves when the specified waiting condition is met. Here's a breakdown of the available functions:
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
- **waitForTimeout(duration: number): Promise<void>**
|
|
20
|
+
|
|
21
|
+
- Waits for a specified duration (in milliseconds) before resolving.
|
|
22
|
+
- Example:
|
|
22
23
|
|
|
23
24
|
```typescript
|
|
24
|
-
import {
|
|
25
|
+
import {waitForTimeout} from '@alwatr/delay';
|
|
25
26
|
|
|
26
27
|
await waitForTimeout(1000); // Waits for 1 second
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
- **waitForAnimationFrame(): Promise<DOMHighResTimeStamp>**
|
|
31
|
+
|
|
32
|
+
- Pauses execution until the next animation frame is scheduled, resolving with the current timestamp.
|
|
33
|
+
- Useful for synchronizing UI updates with browser rendering.
|
|
34
|
+
- Example:
|
|
33
35
|
|
|
34
36
|
```typescript
|
|
35
|
-
import {
|
|
37
|
+
import {waitForAnimationFrame} from '@alwatr/delay';
|
|
36
38
|
|
|
37
39
|
await waitForAnimationFrame(); // Waits for next animation frame
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
- **waitForIdle(timeout?: number): Promise<IdleDeadline>**
|
|
43
|
+
|
|
44
|
+
- Waits for the next idle period (when the browser is not busy), resolving with an `IdleDeadline` object.
|
|
45
|
+
- Optionally accepts a timeout value (in milliseconds) for maximum waiting time.
|
|
46
|
+
- Ideal for executing tasks that don't impact user experience.
|
|
47
|
+
- Example:
|
|
45
48
|
|
|
46
49
|
```typescript
|
|
47
|
-
import {
|
|
50
|
+
import {waitForIdle} from '@alwatr/delay';
|
|
48
51
|
|
|
49
52
|
await waitForIdle(); // Waits for next idle period
|
|
50
53
|
```
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
- **waitForDomEvent<T extends keyof HTMLElementEventMap>(element: HTMLElement, eventName: T): Promise<HTMLElementEventMap[T]>**
|
|
56
|
+
|
|
57
|
+
- Pauses execution until a specific DOM event is triggered on a provided element, resolving with the event object.
|
|
58
|
+
- Example:
|
|
55
59
|
|
|
56
60
|
```typescript
|
|
57
|
-
import {
|
|
61
|
+
import {waitForDomEvent} from '@alwatr/delay';
|
|
58
62
|
|
|
59
63
|
const button = document.getElementById('myButton');
|
|
60
64
|
await waitForDomEvent(button, 'click'); // Waits for click event on button
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
- **waitForEvent(target: HasAddEventListener, eventName: string): Promise<Event>**
|
|
68
|
+
|
|
69
|
+
- More generic version of `waitForDomEvent`, allowing waiting for any event on any object with an `addEventListener` method.
|
|
70
|
+
- Example:
|
|
66
71
|
|
|
67
72
|
```typescript
|
|
68
|
-
import {
|
|
73
|
+
import {waitForEvent} from '@alwatr/delay';
|
|
69
74
|
|
|
70
75
|
const server = http.createServer();
|
|
71
76
|
await waitForEvent(server, 'request'); // Waits for request event on server
|
|
72
77
|
```
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
- **waitForImmediate(): Promise<void>**
|
|
80
|
+
|
|
81
|
+
- Executes the next task in the microtask queue immediately after the current task finishes.
|
|
82
|
+
- Example:
|
|
77
83
|
|
|
78
84
|
```typescript
|
|
79
|
-
import {
|
|
85
|
+
import {waitForImmediate} from '@alwatr/delay';
|
|
80
86
|
|
|
81
87
|
await waitForImmediate(); // Executes next microtask
|
|
82
88
|
```
|
|
83
89
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
- **waitForMicrotask(): Promise<void>**
|
|
91
|
+
|
|
92
|
+
- Similar to `waitForImmediate`, but waits specifically for the next microtask queue.
|
|
93
|
+
- Example:
|
|
87
94
|
|
|
88
95
|
```typescript
|
|
89
|
-
import {
|
|
96
|
+
import {waitForMicrotask} from '@alwatr/delay';
|
|
90
97
|
|
|
91
98
|
await waitForMicrotask(); // Waits for next microtask queue
|
|
92
99
|
```
|
package/dist/main.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @alwatr/delay v1.0.
|
|
1
|
+
/* @alwatr/delay v1.0.7 */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -36,7 +36,7 @@ var requestIdleCallbackFallback = (callback, options) => setTimeout(callback, op
|
|
|
36
36
|
var requestIdleCallback = /* @__PURE__ */ (() => win.requestIdleCallback || win.webkitRequestIdleCallback || win.mozRequestIdleCallback || requestIdleCallbackFallback)();
|
|
37
37
|
|
|
38
38
|
// src/main.ts
|
|
39
|
-
__dev_mode__: import_package_tracer.packageTracer.add("@alwatr/delay", "1.0.
|
|
39
|
+
__dev_mode__: import_package_tracer.packageTracer.add("@alwatr/delay", "1.0.7");
|
|
40
40
|
var delay = {
|
|
41
41
|
/**
|
|
42
42
|
* Delays execution for a specified duration (in milliseconds).
|
package/dist/main.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @alwatr/delay v1.0.
|
|
1
|
+
/* @alwatr/delay v1.0.7 */
|
|
2
2
|
|
|
3
3
|
// src/main.ts
|
|
4
4
|
import { packageTracer } from "@alwatr/package-tracer";
|
|
@@ -13,7 +13,7 @@ var requestIdleCallbackFallback = (callback, options) => setTimeout(callback, op
|
|
|
13
13
|
var requestIdleCallback = /* @__PURE__ */ (() => win.requestIdleCallback || win.webkitRequestIdleCallback || win.mozRequestIdleCallback || requestIdleCallbackFallback)();
|
|
14
14
|
|
|
15
15
|
// src/main.ts
|
|
16
|
-
__dev_mode__: packageTracer.add("@alwatr/delay", "1.0.
|
|
16
|
+
__dev_mode__: packageTracer.add("@alwatr/delay", "1.0.7");
|
|
17
17
|
var delay = {
|
|
18
18
|
/**
|
|
19
19
|
* Delays execution for a specified duration (in milliseconds).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/delay",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Comprehensive toolkit for managing asynchronous operations.",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
"clean": "rm -rfv dist *.tsbuildinfo"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@alwatr/global-this": "^1.0.
|
|
71
|
-
"@alwatr/package-tracer": "^1.0.
|
|
72
|
-
"@alwatr/parse-duration": "^1.1.
|
|
70
|
+
"@alwatr/global-this": "^1.0.2",
|
|
71
|
+
"@alwatr/package-tracer": "^1.0.7",
|
|
72
|
+
"@alwatr/parse-duration": "^1.1.7"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@alwatr/nano-build": "^2.0.
|
|
75
|
+
"@alwatr/nano-build": "^2.0.3",
|
|
76
76
|
"@alwatr/prettier-config": "^1.0.6",
|
|
77
|
-
"@alwatr/tsconfig-base": "^1.3.
|
|
78
|
-
"@alwatr/type-helper": "^2.0.
|
|
79
|
-
"@types/node": "^22.
|
|
77
|
+
"@alwatr/tsconfig-base": "^1.3.3",
|
|
78
|
+
"@alwatr/type-helper": "^2.0.3",
|
|
79
|
+
"@types/node": "^22.8.0",
|
|
80
80
|
"typescript": "^5.6.3"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "a1e430a02f9a5711fc43f19012091bcd8806c4f9"
|
|
83
83
|
}
|