Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1015000 - [Vertical Homescreen] Trying to stop a flywheel scrolli…
Browse files Browse the repository at this point in the history
…ng start an application r=kgrandon
  • Loading branch information
crdlc authored and KevinGrandon committed May 24, 2014
1 parent 560b40a commit 084aee2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions shared/elements/gaia_grid/js/grid_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

(function(exports) {

const PREVENT_CLICK_TIMEOUT = 300;

/**
* GridView is a generic class to render and display a grid of items.
* @param {Object} config Configuration object containing:
Expand All @@ -16,6 +18,7 @@
function GridView(config) {
this.config = config;
this.clickIcon = this.clickIcon.bind(this);
this.onScroll = this.onScroll.bind(this);

if (config.features.zoom) {
this.zoom = new GridZoom(this);
Expand Down Expand Up @@ -65,10 +68,20 @@

start: function() {
this.element.addEventListener('click', this.clickIcon);
window.addEventListener('scroll', this.onScroll);
},

stop: function() {
this.element.removeEventListener('click', this.clickIcon);
window.removeEventListener('scroll', this.onScroll);
},

onScroll: function(e) {
this.element.removeEventListener('click', this.clickIcon);
clearTimeout(this.preventClickTimeout);
this.preventClickTimeout = setTimeout(function addClickEvent() {
this.element.addEventListener('click', this.clickIcon);
}.bind(this), PREVENT_CLICK_TIMEOUT);
},

/**
Expand Down

0 comments on commit 084aee2

Please sign in to comment.