@stryke/helpers 0.6.1 â 0.7.0
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/README.md +1 -1
- package/dist/mutex.d.ts +8 -2
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ This package is part of Storm Software's **đŠī¸ Stryke** monorepo. Stryke pac
|
|
|
22
22
|
|
|
23
23
|
<h3 align="center">đģ Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
24
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
26
|
|
|
27
27
|
> [!IMPORTANT] Important
|
|
28
28
|
> This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
|
package/dist/mutex.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* It allows only one async task to access a critical section at a time.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
+
* ```typescript
|
|
6
7
|
* const mutex = new Mutex();
|
|
7
8
|
*
|
|
8
9
|
* async function criticalSection() {
|
|
@@ -16,12 +17,13 @@
|
|
|
16
17
|
*
|
|
17
18
|
* criticalSection();
|
|
18
19
|
* criticalSection(); // This call will wait until the first call releases the mutex.
|
|
20
|
+
* ```
|
|
19
21
|
*/
|
|
20
22
|
export declare class Mutex {
|
|
21
23
|
private semaphore;
|
|
22
24
|
/**
|
|
23
25
|
* Checks if the mutex is currently locked.
|
|
24
|
-
* @returns
|
|
26
|
+
* @returns True if the mutex is locked, false otherwise.
|
|
25
27
|
*
|
|
26
28
|
* @example
|
|
27
29
|
* const mutex = new Mutex();
|
|
@@ -34,9 +36,10 @@ export declare class Mutex {
|
|
|
34
36
|
get isLocked(): boolean;
|
|
35
37
|
/**
|
|
36
38
|
* Acquires the mutex, blocking if necessary until it is available.
|
|
37
|
-
* @returns
|
|
39
|
+
* @returns A promise that resolves when the mutex is acquired.
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
42
|
+
* ```typescript
|
|
40
43
|
* const mutex = new Mutex();
|
|
41
44
|
* await mutex.acquire();
|
|
42
45
|
* try {
|
|
@@ -44,12 +47,14 @@ export declare class Mutex {
|
|
|
44
47
|
* } finally {
|
|
45
48
|
* mutex.release();
|
|
46
49
|
* }
|
|
50
|
+
* ```
|
|
47
51
|
*/
|
|
48
52
|
acquire(): Promise<void>;
|
|
49
53
|
/**
|
|
50
54
|
* Releases the mutex, allowing another waiting task to proceed.
|
|
51
55
|
*
|
|
52
56
|
* @example
|
|
57
|
+
* ```typescript
|
|
53
58
|
* const mutex = new Mutex();
|
|
54
59
|
* await mutex.acquire();
|
|
55
60
|
* try {
|
|
@@ -57,6 +62,7 @@ export declare class Mutex {
|
|
|
57
62
|
* } finally {
|
|
58
63
|
* mutex.release(); // Allows another waiting task to proceed.
|
|
59
64
|
* }
|
|
65
|
+
* ```
|
|
60
66
|
*/
|
|
61
67
|
release(): void;
|
|
62
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/helpers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing miscellaneous helper functions that are used across many different Storm Software projects.",
|
|
6
6
|
"repository": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"private": false,
|
|
12
12
|
"publishConfig": { "access": "public" },
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@stryke/convert": "^0.
|
|
15
|
-
"@stryke/type-checks": "^0.3.
|
|
16
|
-
"@stryke/types": "^0.8.
|
|
14
|
+
"@stryke/convert": "^0.3.0",
|
|
15
|
+
"@stryke/type-checks": "^0.3.6",
|
|
16
|
+
"@stryke/types": "^0.8.6"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {},
|
|
19
19
|
"sideEffects": false,
|
|
@@ -440,5 +440,6 @@
|
|
|
440
440
|
},
|
|
441
441
|
"main": "./dist/index.cjs",
|
|
442
442
|
"module": "./dist/index.mjs",
|
|
443
|
-
"types": "./dist/index.d.ts"
|
|
443
|
+
"types": "./dist/index.d.ts",
|
|
444
|
+
"gitHead": "ea7a3a1d68d4a4361cc04d6f5bf6219a5bc4a2a2"
|
|
444
445
|
}
|