mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-16 11:00:23 +00:00
fix: only dispatch remove evt if an item is actually removed
by removeAt
This commit is contained in:
parent
3d469c19ca
commit
61742f45c8
@ -99,12 +99,14 @@ end
|
|||||||
|
|
||||||
---@return HarpoonList
|
---@return HarpoonList
|
||||||
function HarpoonList:removeAt(index)
|
function HarpoonList:removeAt(index)
|
||||||
Listeners.listeners:emit(
|
if self.items[index] then
|
||||||
Listeners.event_names.REMOVE,
|
Logger:log("HarpoonList:removeAt", { item = self.items[index], index = index })
|
||||||
{ list = self, item = self.items[index], idx = index }
|
Listeners.listeners:emit(
|
||||||
)
|
Listeners.event_names.REMOVE,
|
||||||
Logger:log("HarpoonList:removeAt", { item = self.items[index], index = index })
|
{ list = self, item = self.items[index], idx = index }
|
||||||
table.remove(self.items, index)
|
)
|
||||||
|
table.remove(self.items, index)
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user