0.1.7 • Published 3 years ago

@rbxts/roact-wm v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Component

local function Window()
        return Roact.createElement(RoactWM.ComponentAdapter, {
                render = function(history)
                        return Roact.createElement(RoactWM.Window, {
                                Id = "ExampleWindow",
                                OnOpen = function()
                                        print("My window has open!")
                                end,
                                OnClosed = function()
                                        print("My window has closed.")
                                end,
                                OnFocused = function()
                                        print("Focus gained")
                                end,
                                OnFocusReleased = function()
                                        print("Focus released")
                                end,
                                BorderSizePixel = 2,
                                Position = UDim2.fromOffset(50, 50),
                                Size = UDim2.fromOffset(500, 200),
                        }, {
                                Text = Roact.createElement("TextLabel", {
                                        BackgroundTransparency = 1,
                                        Size = UDim2.fromScale(1, 1),
                                        Text = ("History Size: %s"):format(history:size()),
                                        TextSize = 18,
                                })
                        })
                end,
        })
end

Controller

RoactWM.Adapter(function(history)
	InputService.InputBegan:Connect(function(input)
		if input.KeyCode == Enum.KeyCode.One then
			history:push("ExampleWindow")
		elseif input.KeyCode == Enum.KeyCode.Two then
			history:clear()
		end
	end)
end)

Demo

This demonstration's source code is available in Example.

RoactWM Demonstration

Installation

Source

git clone https://github.com/HylianBasement/roact-wm.git ./Vendor

roblox-ts

npm i @rbxts/roact-wm
0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago