BindToCloseService
Allows unregisterable BindToClose callbacks. This is important because you can't unbind :BindToClose calls normally, so we need to provide another place to guarantee clean shutdowns.
Functions
PromiseClose
Closes the game: runs every registered close callback, as Roblox does when the server shuts down, and resolves once they have all resolved. Destroying a ServiceBag does not close the game, so call this before tearing down a server bag while the game keeps running, such as in tests.
The game closes once. Later calls, including Roblox's own shutdown, return the same promise.
RegisterPromiseOnCloseCallback
BindToCloseService.RegisterPromiseOnCloseCallback(saveCallback: function) → function--
Call to unregister callback
Binds the promise to call on close. Can be unregistered