Unreleased interval and events

This commit is contained in:
vbaranov 2018-10-26 20:30:51 +03:00
parent d82dbff5f0
commit 6fed8e7f8c
2 changed files with 21 additions and 9 deletions

View File

@ -96,7 +96,9 @@ class BlacklistController {
*
*/
scheduleUpdates () {
if (this._phishingUpdateIntervalRef) return
if (this._phishingUpdateIntervalRef) {
clearInterval(this._phishingUpdateIntervalRef)
}
this.updatePhishingList().catch(log.warn)
this._phishingUpdateIntervalRef = setInterval(() => {
this.updatePhishingList().catch(log.warn)

View File

@ -80,24 +80,24 @@ MenuDroppoComponent.prototype.componentDidMount = function () {
this.container = container
}
this.transitionStarted = this.transitionstartOccured.bind(this)
/*
* transitionstart event is not supported in Chrome yet. But it works for Firefox 53+.
* We need to handle this event only for FF because for Chrome we've hidden scrolls.
*/
this.refs.menuDroppoContainer.addEventListener('transitionstart', () => {
this.refs.menuDroppoContainer.style.overflow = 'hidden'
})
this.refs.menuDroppoContainer.addEventListener('transitionstart', this.transitionStarted)
this.refs.menuDroppoContainer.addEventListener('transitionend', () => {
if (!this.props.constOverflow) {
this.refs.menuDroppoContainer.style.overflow = 'auto'
}
})
this.transitionEnded = this.transitionendOccured.bind(this)
this.refs.menuDroppoContainer.addEventListener('transitionend', this.transitionEnded)
}
MenuDroppoComponent.prototype.componentWillUnmount = function () {
if (this && document.body) {
document.body.removeEventListener('click', this.globalClickHandler)
document.body.removeEventListener('transitionstart', this.transitionStarted)
document.body.removeEventListener('transitionend', this.transitionEnded)
}
}
@ -113,6 +113,16 @@ MenuDroppoComponent.prototype.globalClickOccurred = function (event) {
}
}
MenuDroppoComponent.prototype.transitionstartOccured = function (event) {
this.refs.menuDroppoContainer.style.overflow = 'hidden'
}
MenuDroppoComponent.prototype.transitionendOccured = function (event) {
if (!this.props.constOverflow) {
this.refs.menuDroppoContainer.style.overflow = 'auto'
}
}
function isDescendant (parent, child) {
var node = child.parentNode
while (node !== null) {