search/
Start typing to search packages!
package_2
compulse
By @afrxo
Roblox
MirroredCompulse
An open-source library for Roblox, enabling seamless creation of component-based classes with lifecycle. Simplify UI development and embrace modularity.
Installation
Add Compulse to your wally.toml dependency list:
Compulse = "afrxo/compulse@^1.2"
Example
local Button, create = Compulse()
function Button:Init(props)
self.Text = props.Text
end
function Button:Render()
return Fusion.New "TextButton" {
Text = self.Text,
Size = UDim2.fromOffset(200, 50),
[Fusion.OnEvent "Activated"] = self.Props.Activated
}
end
function Button:DidRender()
print('I was created ;)')
end
function Button:WillDestroy()
print('There I go.. :C')
end
return create
-- [imports omitted]
local instance = Button {
Text = "Click me!",
Activated = function()
print("Do something")
end
}
instance.Parent = Fusion.New "ScreenGui" {
Parent = Player.PlayerGui
}
task.delay(3, instance.Destroy, instance)
Strictly Typed
export type Factory<props> = Compulse.Factory<props>
export type Component<props> = Compulse.Component<props>
export type Props = {
Text: string,
Activated: () -> ()
}
local Component: Component<Props>, create: Factory<Props> = Compulse()
-- The `props` type gets inferred automatically
function Component:Init(props)
self.Text = props.Text
end
function Component:Render()
return Fusion.New "TextButton" {
Size = UDim2.fromOffset(200, 50),
Text = self.Text,
[Fusion.OnEvent "Activated"] = self.Props.Activated
}
end
return create
Package Details
Install command (Click to copy)
Version
1.3.0
License
MIT
Safe for commercial use
License identified from the packaged LICENSE file; the manifest declared none.
Automated license review — not legal advice.
