Last active
August 29, 2015 14:02
-
-
Save buritica/17148e5065f36bc5dde5 to your computer and use it in GitHub Desktop.
Automate reader swiping
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
var timer; | |
var times = 0; | |
var delay = 4; // seconds | |
var totalSwipes = 3; // | |
var next = function() { | |
if (window.onswipePub) { | |
onswipePub.entryView.entryMgr.swipeNext(); | |
} else { | |
leaf.app.router.next(); | |
} | |
} | |
function demo() { | |
console.info('swiped %s times', times++); | |
next(); | |
if (totalSwipes && times === totalSwipes) { | |
window.clearInterval(timer); | |
console.info('demo complete'); | |
} | |
}; | |
timer = window.setInterval(demo, delay * 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment