@quenty/canceltoken 3.2.1-canary.8533eea.0 → 3.3.1

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 CHANGED
@@ -3,7 +3,15 @@
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
- ## [3.2.1-canary.8533eea.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/canceltoken@3.2.0...@quenty/canceltoken@3.2.1-canary.8533eea.0) (2021-12-18)
6
+ ## [3.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/canceltoken@3.3.0...@quenty/canceltoken@3.3.1) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @quenty/canceltoken
9
+
10
+
11
+
12
+
13
+
14
+ # [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/canceltoken@3.2.0...@quenty/canceltoken@3.3.0) (2021-12-18)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/canceltoken
9
17
 
package/README.md CHANGED
@@ -1,14 +1,21 @@
1
1
  ## CancelToken
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
- <img src="https://img.shields.io/badge/discord-nevermore-blue.svg" alt="Discord" />
7
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
8
8
  </a>
9
9
  <a href="https://github.com/Quenty/NevermoreEngine/actions">
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
11
11
  </a>
12
12
  </div>
13
13
 
14
- Cancellation tokens for Roblox Lua!
14
+ Cancellation tokens for Roblox Lua!
15
+
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/CancelToken">View docs →</a></div>
17
+
18
+ ## Installation
19
+ ```
20
+ npm install @quenty/canceltoken --save
21
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/canceltoken",
3
- "version": "3.2.1-canary.8533eea.0",
3
+ "version": "3.3.1",
4
4
  "description": "Cancellation tokens for Roblox Lua",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,12 +26,12 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/loader": "3.1.1",
30
- "@quenty/promise": "3.2.1-canary.8533eea.0",
31
- "@quenty/signal": "2.0.0"
29
+ "@quenty/loader": "^3.1.2",
30
+ "@quenty/promise": "^3.3.1",
31
+ "@quenty/signal": "^2.0.1"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "8533eeade3bf6835c0295785c1c326b9abee3222"
36
+ "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
37
37
  }
@@ -1,6 +1,7 @@
1
- ---
2
- -- @classmod CancelToken
3
- -- @author Quenty
1
+ --[=[
2
+ Cancellation token
3
+ @class CancelToken
4
+ ]=]
4
5
 
5
6
  local require = require(script.Parent.loader).load(script)
6
7
 
@@ -11,6 +12,12 @@ local CancelToken = {}
11
12
  CancelToken.ClassName = "CancelToken"
12
13
  CancelToken.__index = CancelToken
13
14
 
15
+ --[=[
16
+ Constructs a new CancelToken
17
+
18
+ @param executor (cancel: () -> ()) -> ()
19
+ @return CancelToken
20
+ ]=]
14
21
  function CancelToken.new(executor)
15
22
  local self = setmetatable({}, CancelToken)
16
23
 
@@ -34,6 +41,12 @@ end
34
41
 
35
42
  local EMPTY_FUNCTION = function() end
36
43
 
44
+ --[=[
45
+ Constructs a new CancelToken that cancels whenever the maid does.
46
+
47
+ @param maid Maid
48
+ @return CancelToken
49
+ ]=]
37
50
  function CancelToken.fromMaid(maid)
38
51
  local token = CancelToken.new(EMPTY_FUNCTION)
39
52
 
@@ -48,12 +61,19 @@ function CancelToken.fromMaid(maid)
48
61
  return token
49
62
  end
50
63
 
64
+ --[=[
65
+ Errors if cancelled
66
+ ]=]
51
67
  function CancelToken:ErrorIfCancelled()
52
68
  if not self.PromiseCancelled:IsPending() then
53
69
  error("[CancelToken.ErrorIfCancelled] - Cancelled")
54
70
  end
55
71
  end
56
72
 
73
+ --[=[
74
+ Returns true if cancelled
75
+ @return boolean
76
+ ]=]
57
77
  function CancelToken:IsCancelled()
58
78
  return self.PromiseCancelled:IsFulfilled()
59
79
  end