Merge pull request #425 from willothy/list-read-evt

feat: add `LIST_READ` event
This commit is contained in:
ThePrimeagen 2024-01-05 15:20:44 -07:00 committed by GitHub
commit 9ef3cb0794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
---@field listeners HarpoonExtension[]
local HarpoonExtensions = {}
@ -12,6 +10,7 @@ local HarpoonExtensions = {}
---@field UI_CREATE? fun(...): nil
---@field SETUP_CALLED? fun(...): nil
---@field LIST_CREATED? fun(...): nil
---@field LIST_READ? fun(...): nil
---@field NAVIGATE? fun(...): nil
HarpoonExtensions.__index = HarpoonExtensions
@ -64,5 +63,6 @@ return {
SETUP_CALLED = "SETUP_CALLED",
LIST_CREATED = "LIST_CREATED",
NAVIGATE = "NAVIGATE",
LIST_READ = "LIST_READ",
},
}

View File

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