mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Debounce works
This commit is contained in:
parent
9d4fcae7b2
commit
3c53386e08
@ -27,6 +27,7 @@ $(window).load(function() {
|
|||||||
// This will apply the debounce effect on the keyup event
|
// This will apply the debounce effect on the keyup event
|
||||||
// And it only fires 500ms or half a second after the user stopped typing
|
// And it only fires 500ms or half a second after the user stopped typing
|
||||||
var prevText = $('#userInput').val();
|
var prevText = $('#userInput').val();
|
||||||
|
console.log("debounce: " + window.cowyo.debounceMS)
|
||||||
$('#userInput').on('keyup', debounce(function() {
|
$('#userInput').on('keyup', debounce(function() {
|
||||||
if (prevText == $('#userInput').val()) {
|
if (prevText == $('#userInput').val()) {
|
||||||
return // no changes
|
return // no changes
|
||||||
@ -39,7 +40,7 @@ $(window).load(function() {
|
|||||||
$('#saveEditButton').removeClass()
|
$('#saveEditButton').removeClass()
|
||||||
$('#saveEditButton').text("Saving")
|
$('#saveEditButton').text("Saving")
|
||||||
upload();
|
upload();
|
||||||
}, window.debounceMS));
|
}, window.cowyo.debounceMS));
|
||||||
|
|
||||||
var latestUpload = null, needAnother = false;
|
var latestUpload = null, needAnother = false;
|
||||||
function upload() {
|
function upload() {
|
||||||
|
Loading…
Reference in New Issue
Block a user