@nxtedition/scheduler 1.0.5 → 1.0.6
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/lib/index.d.ts +1 -1
- package/lib/index.js +12 -4
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -43,16 +43,24 @@ export class Scheduler {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
schedule(fn , priority
|
|
46
|
+
schedule(fn , priority = Scheduler.NORMAL) {
|
|
47
47
|
if (typeof fn !== 'function') {
|
|
48
48
|
throw new TypeError('First argument must be a function')
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (priority == null) {
|
|
52
52
|
priority = Scheduler.NORMAL
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
} else if (typeof priority === 'string') {
|
|
54
|
+
if (priority === 'low') {
|
|
55
|
+
priority = Scheduler.LOW
|
|
56
|
+
} else if (priority === 'normal') {
|
|
57
|
+
priority = Scheduler.NORMAL
|
|
58
|
+
} else if (priority === 'high') {
|
|
59
|
+
priority = Scheduler.HIGH
|
|
60
|
+
} else {
|
|
61
|
+
throw new Error('Invalid priority')
|
|
62
|
+
}
|
|
63
|
+
} else if (!Number.isInteger(priority)) {
|
|
56
64
|
throw new Error('Invalid priority')
|
|
57
65
|
}
|
|
58
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/scheduler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"rimraf": "^6.1.2",
|
|
21
21
|
"typescript": "^5.9.3"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "1c0ae17fb7bb015b6f352befd2c629bc5ad0ea64"
|
|
24
24
|
}
|