Skip to content

Commit

Permalink
chore(types): Update types for events
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Jun 14, 2024
1 parent 225eba8 commit cc51c19
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions lua/orgmode/events/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ local Events = require('orgmode.events.types')
local Listeners = require('orgmode.events.listeners')

---@class OrgEventManager
---@field private initialized boolean
---@field private _listeners table<string, fun(...:any)[]>
local EventManager = {
initialized = false,
_listeners = {},
Expand Down
3 changes: 1 addition & 2 deletions lua/orgmode/events/types/headline_demoted_event.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---@class OrgHeadlineDemotedEvent: OrgEvent
---@field type string
---@field headline OrgHeadline
---@field old_headline? string

---@field old_level number
local HeadlineDemotedEvent = {
type = 'orgmode.headline_demoted',
}
Expand Down
4 changes: 1 addition & 3 deletions lua/orgmode/events/types/headline_promoted_event.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---@class OrgHeadlinePromotedEvent: OrgEvent
---@field type string
---@field headline OrgHeadline
---@field old_headline? string

---@field old_level number
local HeadlinePromotedEvent = {
type = 'orgmode.headline_promoted',
}
Expand Down
8 changes: 4 additions & 4 deletions lua/orgmode/events/types/todo_changed_event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
---@field type string
---@field headline OrgHeadline
---@field old_todo_state? string
---@field is_done? boolean
---@field was_done? boolean
local TodoChangedEvent = {
type = 'orgmode.todo_changed',
}

---@param headline OrgHeadline
---@param old_todo_state? string
---@param is_done? boolean
function TodoChangedEvent:new(headline, old_todo_state, is_done)
---@param was_done? boolean
function TodoChangedEvent:new(headline, old_todo_state, was_done)
local obj = setmetatable({}, self)
self.__index = self
obj.headline = headline
obj.old_todo_state = old_todo_state
obj.is_done = is_done
obj.was_done = was_done
return obj
end

Expand Down

0 comments on commit cc51c19

Please sign in to comment.