Skip to content

Commit

Permalink
Item menu separators
Browse files Browse the repository at this point in the history
  • Loading branch information
madprops committed Jan 15, 2025
1 parent 0b7ac0f commit 79f218c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/libs/needcontext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1242,11 +1242,13 @@ NeedContext.create_debouncer = (func, delay) => {
return obj
}

// Reset debouncers
NeedContext.reset_debouncers = () => {
NeedContext.autohide_debouncer.cancel()
NeedContext.autoclick_debouncer.cancel()
}

// Check auto functions
NeedContext.check_auto_funcs = (e) => {
if (!NeedContext.open || !e.target) {
return
Expand Down Expand Up @@ -1277,6 +1279,7 @@ NeedContext.check_auto_funcs = (e) => {
}
}

// Check mouse range
NeedContext.check_mouse_range = (e) => {
if (NeedContext.autohide_enabled) {
return
Expand Down Expand Up @@ -1348,12 +1351,14 @@ NeedContext.check_mouse_range = (e) => {
}
}

// Start autohide
NeedContext.start_autohide = (delay) => {
NeedContext.autohide_debouncer = NeedContext.create_debouncer((e) => {
NeedContext.hide(e)
}, delay || NeedContext.autohide_delay)
}

// Start autoclick
NeedContext.start_autoclick = (delay) => {
NeedContext.autoclick_debouncer = NeedContext.create_debouncer((el, e) => {
if (el.closest(`.needcontext-item`)) {
Expand Down

0 comments on commit 79f218c

Please sign in to comment.