timeout-flow 0.0.18 → 0.0.20
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/ADDITIONAL_TERMS.md +122 -0
- package/LICENSE +694 -0
- package/README.md +294 -173
- package/dist/timeout-flow.min.js +1 -1
- package/package.json +74 -59
- package/robots.txt +78 -2
- package/src/TimerBase.js +3 -2
- package/src/abort.js +13 -1
- package/src/context.txt +366 -261
- package/src/index.js +1 -0
- package/src/raf/waitForRaf.js +4 -4
- package/src/retry.js +125 -84
- package/src/sleep.js +58 -0
- package/src/waitFor.js +66 -47
- package/types/abort.d.ts +40 -31
- package/types/index.d.ts +10 -9
- package/types/raf/waitForRaf.d.ts +19 -19
- package/types/retry.d.ts +70 -31
- package/types/sleep.d.ts +29 -0
- package/types/waitFor.d.ts +28 -17
- package/LICENSE.MD +0 -285
package/package.json
CHANGED
|
@@ -1,60 +1,75 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "timeout-flow",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Fluent, composable, pauseable JavaScript timers and time control flows
|
|
6
|
-
"keywords": [
|
|
7
|
-
"timeout",
|
|
8
|
-
"interval",
|
|
9
|
-
"flow",
|
|
10
|
-
"raf",
|
|
11
|
-
"animationframe",
|
|
12
|
-
"debounce",
|
|
13
|
-
"retry",
|
|
14
|
-
"javascript",
|
|
15
|
-
"timers",
|
|
16
|
-
"throttle",
|
|
17
|
-
"asynchronous",
|
|
18
|
-
"control-flow",
|
|
19
|
-
"utilities"
|
|
20
|
-
],
|
|
21
|
-
"author": "
|
|
22
|
-
"license": "
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/iWhatty/
|
|
26
|
-
},
|
|
27
|
-
"sideEffects": false,
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"import": "./src/index.js",
|
|
38
|
-
"require": "./dist/timeout-flow.min.js"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"src/",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "timeout-flow",
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Fluent, composable, pauseable JavaScript timers and time control flows, plus RAF utilities for frame-based logic.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"timeout",
|
|
8
|
+
"interval",
|
|
9
|
+
"flow",
|
|
10
|
+
"raf",
|
|
11
|
+
"animationframe",
|
|
12
|
+
"debounce",
|
|
13
|
+
"retry",
|
|
14
|
+
"javascript",
|
|
15
|
+
"timers",
|
|
16
|
+
"throttle",
|
|
17
|
+
"asynchronous",
|
|
18
|
+
"control-flow",
|
|
19
|
+
"utilities"
|
|
20
|
+
],
|
|
21
|
+
"author": "WATT3D <WATT3D@protonmail.com>",
|
|
22
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/iWhatty/timeout-flow.git"
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/timeout-flow.min.js",
|
|
32
|
+
"module": "./src/index.js",
|
|
33
|
+
"browser": "./dist/timeout-flow.min.js",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./types/index.d.ts",
|
|
37
|
+
"import": "./src/index.js",
|
|
38
|
+
"require": "./dist/timeout-flow.min.js",
|
|
39
|
+
"default": "./src/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./after": "./src/after.js",
|
|
42
|
+
"./every": "./src/every.js",
|
|
43
|
+
"./debounce": "./src/debounce.js",
|
|
44
|
+
"./throttle": "./src/throttle.js",
|
|
45
|
+
"./sleep": "./src/sleep.js",
|
|
46
|
+
"./retry": "./src/retry.js",
|
|
47
|
+
"./wait-for": "./src/waitFor.js",
|
|
48
|
+
"./flow": "./src/TimeoutFlow.js",
|
|
49
|
+
"./parse-duration": "./src/parseDuration.js",
|
|
50
|
+
"./raf": "./src/raf/index.js",
|
|
51
|
+
"./min": "./dist/timeout-flow.min.js"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"src",
|
|
56
|
+
"types",
|
|
57
|
+
"robots.txt",
|
|
58
|
+
"ADDITIONAL_TERMS.md"
|
|
59
|
+
],
|
|
60
|
+
"types": "./types/index.d.ts",
|
|
61
|
+
"scripts": {
|
|
62
|
+
"dev": "serve testing",
|
|
63
|
+
"test": "node --test testing/*.test.mjs && npm run build && npm run test:node",
|
|
64
|
+
"test:unit": "node --test testing/*.test.mjs",
|
|
65
|
+
"test:node": "node testing/node-harness.mjs",
|
|
66
|
+
"build": "node build.js",
|
|
67
|
+
"types": "tsc",
|
|
68
|
+
"prepub": "npm run build && npm run types"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"esbuild": "^0.25.3",
|
|
72
|
+
"serve": "^14.2.4",
|
|
73
|
+
"typescript": "^5.8.3"
|
|
74
|
+
}
|
|
60
75
|
}
|
package/robots.txt
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
# WATT3D — AI scraping policy
|
|
2
|
+
#
|
|
3
|
+
# This file enumerates known AI / LLM training and inference crawlers
|
|
4
|
+
# that the WATT3D AI Training Rider does not consent to. See
|
|
5
|
+
# ./ADDITIONAL_TERMS.md for the legal scope and definitions.
|
|
6
|
+
#
|
|
7
|
+
# Honoring robots.txt is voluntary. The rider applies whether or not
|
|
8
|
+
# a bot respects this file. The enumeration is non-exhaustive — bots
|
|
9
|
+
# not listed here are still bound by the rider if they perform
|
|
10
|
+
# Training Use as defined in ADDITIONAL_TERMS.md §1.
|
|
11
|
+
|
|
12
|
+
User-agent: GPTBot
|
|
13
|
+
Disallow: /
|
|
14
|
+
|
|
15
|
+
User-agent: ChatGPT-User
|
|
16
|
+
Disallow: /
|
|
17
|
+
|
|
18
|
+
User-agent: OAI-SearchBot
|
|
19
|
+
Disallow: /
|
|
20
|
+
|
|
21
|
+
User-agent: anthropic-ai
|
|
22
|
+
Disallow: /
|
|
23
|
+
|
|
24
|
+
User-agent: ClaudeBot
|
|
25
|
+
Disallow: /
|
|
26
|
+
|
|
27
|
+
User-agent: Claude-Web
|
|
28
|
+
Disallow: /
|
|
29
|
+
|
|
30
|
+
User-agent: Claude-SearchBot
|
|
31
|
+
Disallow: /
|
|
32
|
+
|
|
33
|
+
User-agent: Google-Extended
|
|
34
|
+
Disallow: /
|
|
35
|
+
|
|
36
|
+
User-agent: Applebot-Extended
|
|
37
|
+
Disallow: /
|
|
38
|
+
|
|
39
|
+
User-agent: Meta-ExternalAgent
|
|
40
|
+
Disallow: /
|
|
41
|
+
|
|
42
|
+
User-agent: Meta-ExternalFetcher
|
|
2
43
|
Disallow: /
|
|
3
|
-
|
|
44
|
+
|
|
45
|
+
User-agent: FacebookBot
|
|
46
|
+
Disallow: /
|
|
47
|
+
|
|
48
|
+
User-agent: CCBot
|
|
49
|
+
Disallow: /
|
|
50
|
+
|
|
51
|
+
User-agent: PerplexityBot
|
|
52
|
+
Disallow: /
|
|
53
|
+
|
|
54
|
+
User-agent: Perplexity-User
|
|
55
|
+
Disallow: /
|
|
56
|
+
|
|
57
|
+
User-agent: cohere-ai
|
|
58
|
+
Disallow: /
|
|
59
|
+
|
|
60
|
+
User-agent: Bytespider
|
|
61
|
+
Disallow: /
|
|
62
|
+
|
|
63
|
+
User-agent: Amazonbot
|
|
64
|
+
Disallow: /
|
|
65
|
+
|
|
66
|
+
User-agent: Omgilibot
|
|
67
|
+
Disallow: /
|
|
68
|
+
|
|
69
|
+
User-agent: AI2Bot
|
|
70
|
+
Disallow: /
|
|
71
|
+
|
|
72
|
+
User-agent: Diffbot
|
|
73
|
+
Disallow: /
|
|
74
|
+
|
|
75
|
+
# Everyone else: full access. Search engines and human-driven crawlers
|
|
76
|
+
# remain welcome.
|
|
77
|
+
|
|
78
|
+
User-agent: *
|
|
79
|
+
Allow: /
|
package/src/TimerBase.js
CHANGED
|
@@ -78,9 +78,10 @@ export class TimerBase {
|
|
|
78
78
|
const rawDelay = overrideDelay ?? this.#remaining;
|
|
79
79
|
|
|
80
80
|
// Reject invalid delays (avoid scheduling with NaN/Infinity/etc.)
|
|
81
|
-
if (!Number.isFinite(rawDelay)
|
|
81
|
+
if (!Number.isFinite(rawDelay)) return;
|
|
82
82
|
|
|
83
|
-
//
|
|
83
|
+
// Negative delays clamp to 0 like setTimeout (next macrotask)
|
|
84
|
+
// instead of silently never firing.
|
|
84
85
|
const delay = Math.max(0, rawDelay);
|
|
85
86
|
|
|
86
87
|
// Important: remaining must reflect what we actually scheduled,
|
package/src/abort.js
CHANGED
|
@@ -72,4 +72,16 @@ export function pendingAbort(signal, onAbort) {
|
|
|
72
72
|
cleanup = null;
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The error an aborted operation should reject with: the signal's own
|
|
79
|
+
* `reason` (what `fetch()` and other web APIs use), falling back to a
|
|
80
|
+
* standard AbortError for runtimes without `AbortSignal.reason`.
|
|
81
|
+
*
|
|
82
|
+
* @param {AbortSignal | null | undefined} signal
|
|
83
|
+
* @returns {any}
|
|
84
|
+
*/
|
|
85
|
+
export function abortReason(signal) {
|
|
86
|
+
return signal?.reason ?? createAbortError();
|
|
87
|
+
}
|