Skip to content

Instantly share code, notes, and snippets.

@jakewilliami
Last active February 8, 2021 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakewilliami/cb455bf11adbf879c92b9dfc3516c7df to your computer and use it in GitHub Desktop.
Save jakewilliami/cb455bf11adbf879c92b9dfc3516c7df to your computer and use it in GitHub Desktop.
import gorilla = require('gorilla/gorilla');
// Initialise the timer
var stateTimer: gorilla.GorillaTimerSequence;
// Add variable to determine delay
var allowedTime: number = 2000; // set original timer to 2 seconds (2000 milliseconds)
// check if textbox is selected
if ($(document.activeElement).attr("type") == "text" || $(document.activeElement).attr("type") == "textarea") {
// updated allowedTime
allowedTime = 5000; // 5 seconds (5000 milliseconds)
}
var stateTimer: gorilla.GorillaTimerSequence = gorilla.addTimerSequence()
.delay(allowedTime) // wait a certain amout of time
.then(() => {
// transition into your next stage
})
})
.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment