Releases: Sleitnick/Knit
Release v0.0.21-alpha
0.0.21-alpha
- Fix issue with having multiple required components
- Adds
Sample
andZip
to TableUtil - Improvements to Timer module
Release v0.0.20-alpha
0.0.20-alpha
- Fixes bug with Timer class
- Updates Janitor
- Removes unnecessary parentheses
- Adds some more Luau types
Release v0.0.19-alpha
- New Signal implementation
- Remove Thread module in favor of new
task.spawn
andtask.defer
functions - Add Janitor / Remove Maid
- Add Timer module
MIGRATION FROM v18 TO v19:
- Remove
require
s ofThread
module - Replace
require
s ofMaid
withJanitor
Thread.Spawn
->task.defer
Thread.SpawnNow
->task.spawn
Thread.Delay
->task.delay
Thread.DelayRepeat
-> UseTimer
class (see below)maid:GiveTask
->janitor:Add
maid:GivePromise
->janitor:AddPromise
maid:DoCleaning
->janitor:Cleanup
maid[id] = nil
->janitor:Remove(id)
Timer class:
The Timer class makes it easy to schedule functions at certain intervals.
local Timer = require(Knit.Util.Timer)
local timer = Timer.new(1)
timer.Tick:Connect(function()
print("Tock")
end)
timer:Start()
...
timer:Stop()
...
timer:Destroy()
Janitor class:
For the most part, swapping out Janitor for Maid should be quite seamless, as their APIs are nearly identical, besides some name changes. It is worth noting some significant changes:
- Instead of clearing an item from a maid using
maid[id] = nil
, Janitor has a dedicatedRemove
method, in which you pass in the ID that you explicitly gave it onAdd
. For instance:janitor:Add(item, nil, "SomeID"); janitor:Remove("SomeID")
. - Janitor comes with a
LinkToInstance
, which lets you link the janitor instance to the life of a Roblox instance. If that instance is deparented, the janitor will be cleaned up. - The
Add
method's 2nd parameter is an optional cleanup method name, which can be used if your object's cleanup method is different than Destroy.
Removal of Thread module:
With the addition of the built-in task
library, the Thread module is obsolete.
- Use
task.spawn
to spawn a thread immediately (same behavior asThread.SpawnNow
). - Use
task.defer
to schedule a thread to run using the internal deferral scheduling (still within the same frame). This is roughly a replacement forThread.Spawn
. If you still want to delay a frame, simply usetask.delay(0, function() ... end)
. - Use
task.delay
to schedule a thread to run after some period of time. - Use
Timer
class instead ofThread.DelayRepeat
.
Snippets:
If you use the VS Code snippets provided from the documentation, be sure to update them to use Janitor instead of Maid.
Release v0.0.18-alpha
Components
- Added optional
RequiredComponents
table for components - Added
Observe
method for components - Fixed
Added
andRemoved
events not being cleaned up when component class destroyed - Fixed lifecycle RunService method bindings not being cleaned up properly for future reuse
Documentation
- Added more documentation for components
Stability
- Upgraded CI/CD pipeline to use latest packages
Release v0.0.17-alpha
- Hotfix for TableUtil
Sync
,Assign
,Extend
, andShuffle
functions to do shallow copies instead of deep copies - Fix release GitHub action to properly use
"Knit"
as the top-level directory name within the zipped file - Fix documentation to properly use user preference theme (light/dark)
Release v0.0.16-alpha
[BR] = Breaking Change
Fixes, Additions, and Improvements
- Project directory restructure
- Can now include Knit as a Git submodule and reference the default rojo project to sync in (see below)
- Added unit tests for Knit-specific utility modules
- Added simple integration tests
- TableUtil fixes, additions, and improvements:
- [BR] All functions (except
FastRemove
andFastRemoveFirstValue
) no longer mutate table - Fix
Filter
bug introduced in v0.0.15-alpha - Fix behavior of
Extend
to extend arrays and not dictionaries (useAssign
to extend a dictionary) - Add optional RNG override parameter for
Shuffle
- Add
Flat
,FlatMap
,Keys
,Find
,Every
, andSome
functions - Add documentation page for TableUtil
- [BR] All functions (except
- Simplify
Knit.OnStart()
internally to usePromise.FromEvent
- Update Rojo version used by CI/CD pipeline
- Fix broken links in documentation pages
Knit Submodule
If desired, Knit can now be included into a project as a Git submodule.
git submodule add https://github.com/Sleitnick/Knit ./lib/Knit
Once added, include it in your Rojo's default.project.json
file as such:
{
"tree": {
"$className": "DataModel",
"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"Knit": {
"$path": "lib/Knit/default.project.json"
}
}
}
}
TableUtil Breaking Changes
All TableUtil
functions (except for FastRemove
and FastRemoveFirstValue
) have been modified to not mutate the given table. Specifically, this impacts Sync
, Assign
, Extend
, and Shuffle
.
Instead, the functions will create a copy of the table before running any operations. This helps push for further immutability. When upgrading to this version of Knit, check to make sure your code has been changed to capture these changes.
For instance, the following code worked before but will not work as expected now:
local t = {"A", "B", "C"}
TableUtil.Shuffle(t)
To fix it, either reassign t
to the returned value or capture it in a new variable:
local t = {"A", "B", "C"}
local tShuffled = TableUtil.Shuffle(t)
Release v0.0.15-alpha
- Memory leak fixed with Streamable when instance was immediately available
Knit.GetService(serviceName)
added to server-side Knit- Minor improvements to TableUtil
- Util documentation split across multiple pages
Release v0.0.14-alpha
- Fix Signal leak when firing with no connections
- Change
._instance
to.Instance
in Component - Components will use attributes to store unique ID instead of StringValue
- Add
Signal.Proxy
constructor to wrap built-in RBXScriptSignals - Add
Maid:GivePromise
method - Allow dictionary tables in
StreamableUtil.Compound
observers list
Note breaking changes from above:
- When upgrading, make sure to change
._instance
field accessors to.Instance
for components ServerID
StringValue for components has been switched to use attributes:instance:GetAttribute("ComponentServerId")
Release v0.0.13-alpha
Component:WaitFor
has been rewritten to utilize built-in promise features better, which also eliminated an existing event connection leak.Streamable
andStreamableUtil
modules added to easily manage parts that may stream in & out during runtime when usingStreamingEnabled
.- Documentation improvements.
Release v0.0.12-alpha
- Added new 'Add' functions to automatically load all modules in a folder. This is useful for quickly loading a bunch of service or controller modules:
KnitServer.AddServices(folder: Instance)
KnitServer.AddServicesDeep(folder: Instance)
KnitClient.AddControllers(folder: Instance)
KnitClient.AddControllersDeep(folder: Instance)
- Split up remotes to server/client versions:
RemoteEvent
->RemoteSignal
andClientRemoteSignal
RemoteProperty
->RemoteProperty
andClientRemoteProperty
- Knit module isn't required to live in ReplicatedStorage now
- Added
EnumList
class which wrapsSymbol
s to create pseudo-enums - Added style guide in documentation