Guest User

Untitled

a guest
Apr 23rd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. updateContent(mainUrl){
  2. console.log("updateContent was called")
  3. fetch(mainUrl)
  4. .then((responseJsonAnyUrl) => responseJsonAnyUrl.json())
  5. .then((responseJsonAnyUrl) => {
  6. this.setState({
  7. mainUrl: mainUrl,
  8. jsonObject: responseJsonAnyUrl
  9. },
  10. function testName() {
  11. let interval = 20000
  12. let ind = this.child.current.getCurrentIndex()
  13. let zlengths = this.child.current.getZoneLengths()
  14. let option = 1
  15. if (ind !== zlengths[0]-1){
  16. //didn't iterate trough all content, can't update
  17. option=2
  18. interval = 5000
  19. }
  20. console.log('ind', ind)
  21. console.log('len', zlengths[0]-1)
  22. console.log('interval', interval)
  23. this.timeout = setTimeout(
  24. function(){
  25. if (option===1){
  26. this.updateContent(mainUrl)
  27. }else if (option===2){
  28. // call testName()
  29. }
  30. }.bind(this, mainUrl)
  31. ,
  32. interval)
  33. }.bind(this))
  34. })
  35. }
Add Comment
Please, Sign In to add comment