Skip to content

Commit

Permalink
add debounce so you can"t get song multiple times during click
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Aug 17, 2013
1 parent df508fa commit 65dce17
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/scripts/ui/front.js
@@ -1,13 +1,16 @@
define([
"flight/component",
"jquery"
], function ( defineComponent, $ ) {
"jquery",
"lodash"
], function ( defineComponent, $, _ ) {
"use strict";
return defineComponent( front );

function front () {
var fly = this;
this.after( "initialize", function () {
this.on( "button.cta", "click", this.getStarted );
// included this debounce so it doesn't try and load 1000 things
this.on( "button.cta", "click", _.debounce( this.getStarted, 4500, true ) );
this.on( document, "uiUserWantsToStart", this.fadeAway );
this.on( document, "dataSoundOver", this.comeBack );
});
Expand All @@ -17,6 +20,7 @@ define([
}

this.comeBack = function ( event, data ) {
fly.on( document, "uiUserWantsToStart", this.fadeAway );
$( ".front" ).addClass( "next" ).fadeIn( 2000 );
}

Expand Down

0 comments on commit 65dce17

Please sign in to comment.