Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@quenty/binder
Advanced tools
Utility object to Bind a class to Roblox object, and associated helper methods
Binders bind a class to Roblox Instance
npm install @quenty/binder --save
-- Setup a class!
local MyClass = {}
MyClass.__index = MyClass
function MyClass.new(robloxInstance)
print("New tagged instance of ", robloxInstance")
return setmetatable({}, MyClass)
end
function MyClass:Destroy()
print("Cleaning up")
setmetatable(self, nil)
end
-- bind to every instance with tag of "TagName"!
local binder = Binder.new("TagName", MyClass)
binder:Start() -- listens for new instances and connects events
Binder.new(tagName, constructor)
Creates a new binder object.
Binder.isBinder(value)
Retrieves whether or not its a binder
Binder:Start()
Listens for new instances and connects to the GetInstanceAddedSignal() and removed signal!
Binder:GetTag()
Returns the tag name that the binder has
Binder:GetConstructor()
Returns whatever was set for the construtor. Used for meta-analysis of the binder, such as extracting new
Binder:ObserveInstance(inst, callback)
Fired when added, and then after removal, but before destroy!
Binder:GetClassAddedSignal()
Returns a new signal that will fire whenever a class is bound to the binder
Binder:GetClassRemovingSignal()
Returns a new signal that will fire whenever a class is removed from the binder
Binder:GetAll()
Returns all of the classes in a new table
local birdBinder = Binder.new("Bird", require("Bird")) -- Load bird into binder
-- Update every bird every frame
RunService.Stepped:Connect(function()
for _, bird in pairs(birdBinder:GetAll()) do
bird:Update()
end
end)
Binder:GetAllSet()
Faster method to get all items in a binder
NOTE: Do not mutate this set directly
local birdBinder = Binder.new("Bird", require("Bird")) -- Load bird into binder
-- Update every bird every frame
RunService.Stepped:Connect(function()
for bird, _ in pairs(birdBinder:GetAllSet()) do
bird:Update()
end
end)
birdBinder:Start()
Binder:Bind(inst)
Binds an instance to this binder using collection service and attempts to return it if it's bound properly. See BinderUtils.promiseBoundClass() for a safe way to retrieve it.
NOTE: Do not assume that a bound object will be retrieved
Binder:Unbind(inst)
Unbinds the instance by removing the tag
Binder:BindClient(inst)
See :Bind(). Acknowledges the risk of doing this on the client. Using this acknowledges that we're intentionally binding on a safe client object, i.e. one without replication. If another tag is changed on this instance, this tag will be lost/changed.
Binder:UnbindClient(inst)
See Unbind(), acknowledges risk of doing this on the client.
Binder:Get(inst)
Returns a version of the clas
Binder:Promise(inst, cancelToken)
Binder:Destroy()
Cleans up all bound classes, and disconnects all events
FAQs
Utility object to Bind a class to Roblox object, and associated helper methods
The npm package @quenty/binder receives a total of 62 weekly downloads. As such, @quenty/binder popularity was classified as not popular.
We found that @quenty/binder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.