Created
May 5, 2016 20:20
-
-
Save dbarrionuevo/f25099e48eba21883060534a719f6546 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Update subtotal and total amounts on checkout, considering fees | |
GrowDough.Behaviors.UpdateTotal = Essential.Behavior.extend({ | |
init: function() {}, | |
events: { | |
'keyup': 'updateSubtotal' | |
}, | |
updateSubtotal: function(e, force) { | |
// Keys and events on which the behavior has to update totals | |
var isNumber = e && ( (e.which >= 48 && e.which <= 57) || (e.which >= 96 && e.which <= 105) ), | |
isBackSpace = e && e.which == 8, | |
isDelete = e && e.which == 127, | |
isClick = e && e.which == 1; | |
if ( isNumber || isBackSpace || isDelete || isClick || force ) { | |
// Update totals | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment