Skip to content

Commit

Permalink
Added fromSource to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
1ForeverHD committed Apr 5, 2024
1 parent 1bb82d4 commit e54dcd5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,23 +388,27 @@ Clears all connections and destroys all instances associated with the icon.
## Events
#### selected
```lua
icon.selected:Connect(function()
print("The icon was selected")
icon.selected:Connect(function(fromSource)
-- fromSource can be useful for checking if the behaviour was triggered by a user (such as clicking)
-- fromSource values include "User", "OneClick", "AutoDeselect", "HideParentFeature", "Overflow"
local sourceName = fromSource or "Unknown"
print("The icon was selected by the "..sourceName)
end)
```

----
#### deselected
```lua
icon.deselected:Connect(function()
print("The icon was deselected")
icon.deselected:Connect(function(fromSource)
local sourceName = fromSource or "Unknown"
print("The icon was deselected by the "..sourceName)
end)
```

----
#### toggled
```lua
icon.toggled:Connect(function(isSelected)
icon.toggled:Connect(function(isSelected, fromSource)
local stateName = (isSelected and "selected") or "deselected"
print(`The icon was {stateName}!`)
end)
Expand Down

0 comments on commit e54dcd5

Please sign in to comment.