@quenty/bindtocloseservice 8.32.1 → 8.33.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/CHANGELOG.md +6 -0
- package/package.json +3 -3
- package/src/Server/BindToCloseService.lua +21 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
# [8.33.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/bindtocloseservice@8.32.1...@quenty/bindtocloseservice@8.33.0) (2026-07-14)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **bindtocloseservice:** convert package to --!strict ([e90dffb](https://github.com/Quenty/NevermoreEngine/commit/e90dffb75f355e31c5a8d60e2994c8d5fd82249e))
|
|
11
|
+
|
|
6
12
|
## [8.32.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/bindtocloseservice@8.32.0...@quenty/bindtocloseservice@8.32.1) (2026-05-30)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @quenty/bindtocloseservice
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/bindtocloseservice",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.33.0",
|
|
4
4
|
"description": "Bind to game close API in a centralized location.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@quenty/symbol": "3.5.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@quenty/contentproviderutils": "12.
|
|
40
|
+
"@quenty/contentproviderutils": "12.32.0",
|
|
41
41
|
"@quenty/playerthumbnailutils": "10.18.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
44
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Allows unregisterable BindToClose callbacks. This is important because you can't unbind
|
|
4
4
|
:BindToClose calls normally, so we need to provide another place to guarantee clean shutdowns.
|
|
@@ -19,15 +19,24 @@ local Symbol = require("Symbol")
|
|
|
19
19
|
local BindToCloseService = {}
|
|
20
20
|
BindToCloseService.ServiceName = "BindToCloseService"
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export type BindToCloseService = typeof(setmetatable(
|
|
23
|
+
{} :: {
|
|
24
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
25
|
+
_maid: Maid.Maid,
|
|
26
|
+
_subscriptions: { [Symbol.Symbol]: () -> Promise.Promise<any> },
|
|
27
|
+
},
|
|
28
|
+
{} :: typeof({ __index = BindToCloseService })
|
|
29
|
+
))
|
|
30
|
+
|
|
31
|
+
function BindToCloseService.Init(self: BindToCloseService, serviceBag: ServiceBag.ServiceBag): ()
|
|
32
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
24
33
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
25
34
|
self._maid = Maid.new()
|
|
26
35
|
|
|
27
36
|
self._subscriptions = {}
|
|
28
37
|
end
|
|
29
38
|
|
|
30
|
-
function BindToCloseService
|
|
39
|
+
function BindToCloseService.Start(self: BindToCloseService): ()
|
|
31
40
|
if RunService:IsServer() then
|
|
32
41
|
game:BindToClose(function()
|
|
33
42
|
local ok, err = self:_promiseClose():Yield()
|
|
@@ -46,13 +55,13 @@ function BindToCloseService:Start()
|
|
|
46
55
|
end
|
|
47
56
|
end
|
|
48
57
|
|
|
49
|
-
function BindToCloseService
|
|
50
|
-
local promises = {}
|
|
58
|
+
function BindToCloseService._promiseClose(self: BindToCloseService): Promise.Promise<any>
|
|
59
|
+
local promises: { Promise.Promise<any> } = {}
|
|
51
60
|
|
|
52
61
|
for _, caller in self._subscriptions do
|
|
53
62
|
local promise = caller()
|
|
54
63
|
if Promise.isPromise(promise) then
|
|
55
|
-
table.insert(promises, promise)
|
|
64
|
+
table.insert(promises, promise :: any)
|
|
56
65
|
else
|
|
57
66
|
warn("[BindToCloseService.BindToClose] - Bad promise returned from close callback.")
|
|
58
67
|
end
|
|
@@ -67,7 +76,10 @@ end
|
|
|
67
76
|
@param saveCallback function
|
|
68
77
|
@return function -- Call to unregister callback
|
|
69
78
|
]=]
|
|
70
|
-
function BindToCloseService
|
|
79
|
+
function BindToCloseService.RegisterPromiseOnCloseCallback(
|
|
80
|
+
self: BindToCloseService,
|
|
81
|
+
saveCallback: () -> Promise.Promise<any>
|
|
82
|
+
): () -> ()
|
|
71
83
|
assert(type(saveCallback) == "function", "Bad saveCallback")
|
|
72
84
|
|
|
73
85
|
local id = Symbol.named("savingCallbackId")
|
|
@@ -79,7 +91,7 @@ function BindToCloseService:RegisterPromiseOnCloseCallback(saveCallback: () -> (
|
|
|
79
91
|
end
|
|
80
92
|
end
|
|
81
93
|
|
|
82
|
-
function BindToCloseService
|
|
94
|
+
function BindToCloseService.Destroy(self: BindToCloseService): ()
|
|
83
95
|
self._maid:DoCleaning()
|
|
84
96
|
end
|
|
85
97
|
|