Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var interval;
- var loopcounter = 1;
- // startTxPendingCheck is a global window variable set by another script
- if (startTxPendingCheck) {
- var div = document.getElementById('spinnerwait');
- div.style.display = 'block';
- interval = setTimeout(checkForConfirmedTx, 2000);
- function checkForConfirmedTx() {
- if (loopcounter < 45) {
- $.ajax({
- url: "/api?module=localchk&action=txexist&txhash=" + txHash,
- type: "GET",
- success: function(data) {
- if (data.result == "True") {
- window.location.href = "/tx/" + txHash;
- }
- },
- dataType: "json"
- })
- loopcounter = loopcounter + 1;
- interval = setTimeout(checkForConfirmedTx, 20000);
- } else {
- stopInterval();
- }
- }
- function stopInterval() {
- console.log("stopInterval called");
- var div = document.getElementById('spinnerwait');
- div.style.display = 'none';
- clearTimeout(interval);
- }
- function startInterval() {
- console.log("startInterval called");
- clearTimeout(interval);
- var div = document.getElementById('spinnerwait');
- div.style.display = 'block';
- interval = setTimeout(checkForConfirmedTx, 5000);
- }
- }
Add Comment
Please, Sign In to add comment