MCPcopy Create free account
hub / github.com/cryptii/cryptii / toggleMenu

Method toggleMenu

src/View/Brick.js:229–251  ·  view source on GitHub ↗

* Toggles menu.

()

Source from the content-addressed store, hash-verified

227 * Toggles menu.
228 */
229 toggleMenu () {
230 this._menuVisible = !this._menuVisible
231
232 if (this._menuVisible) {
233 // append menu and trigger next cycle
234 this._$header.appendChild(this._$menu)
235 this._$menu.getBoundingClientRect()
236
237 // show menu animated
238 this._$menu.classList.add('menu--visible')
239
240 // listen to the next window click to hide the menu again
241 window.requestAnimationFrame(() => {
242 window.addEventListener('click', this._menuHideHandler)
243 })
244 } else {
245 // remove menu
246 this._$header.removeChild(this._$menu)
247
248 // remove listener
249 window.removeEventListener('click', this._menuHideHandler)
250 }
251 }
252
253 /**
254 * Updates Brick status and message.

Callers 1

renderHeaderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected