feat: add LIST_READ event

This commit is contained in:
Will Hopkins 2023-12-14 23:08:23 -08:00
parent 6afc142443
commit 7d1aef462a
No known key found for this signature in database
GPG Key ID: 643B8C585BABBB68
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,3 @@
--- TODO: Rename this... its an odd name "listeners"
---@class HarpoonExtensions ---@class HarpoonExtensions
---@field listeners HarpoonExtension[] ---@field listeners HarpoonExtension[]
local HarpoonExtensions = {} local HarpoonExtensions = {}
@ -12,6 +10,7 @@ local HarpoonExtensions = {}
---@field UI_CREATE? fun(...): nil ---@field UI_CREATE? fun(...): nil
---@field SETUP_CALLED? fun(...): nil ---@field SETUP_CALLED? fun(...): nil
---@field LIST_CREATED? fun(...): nil ---@field LIST_CREATED? fun(...): nil
---@field LIST_READ? fun(...): nil
---@field NAVIGATE? fun(...): nil ---@field NAVIGATE? fun(...): nil
HarpoonExtensions.__index = HarpoonExtensions HarpoonExtensions.__index = HarpoonExtensions
@ -64,5 +63,6 @@ return {
SETUP_CALLED = "SETUP_CALLED", SETUP_CALLED = "SETUP_CALLED",
LIST_CREATED = "LIST_CREATED", LIST_CREATED = "LIST_CREATED",
NAVIGATE = "NAVIGATE", NAVIGATE = "NAVIGATE",
LIST_READ = "LIST_READ",
}, },
} }

View File

@ -55,6 +55,7 @@ function Harpoon:list(name)
self.data.seen[key] = {} self.data.seen[key] = {}
end end
self.data.seen[key][name] = true self.data.seen[key][name] = true
self._extensions:emit(Extensions.event_names.LIST_READ, existing_list)
return existing_list return existing_list
end end