lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js in css-zero-0.0.47 vs lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js in css-zero-0.0.48
- old
+ new
@@ -4,37 +4,26 @@
export default class extends Controller {
static targets = [ "button", "menu" ]
static classes = [ "flip" ]
- #closeTimer
-
show() {
- this.#resetTimer()
this.menuTarget.show()
this.#updateExpanded()
this.#orient()
}
close() {
this.menuTarget.close()
this.#updateExpanded()
}
- closeLater() {
- this.#closeTimer = setTimeout(() => this.close(), 300)
- }
-
toggle() {
this.menuTarget.open ? this.close() : this.show()
}
closeOnClickOutside({ target }) {
!this.element.contains(target) && this.close()
- }
-
- #resetTimer() {
- clearTimeout(this.#closeTimer)
}
#orient() {
this.menuTarget.classList.toggle(this.flipClass, this.#distanceToBottom < BOTTOM_THRESHOLD)
}