Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- updateContent(mainUrl){
- console.log("updateContent was called")
- fetch(mainUrl)
- .then((responseJsonAnyUrl) => responseJsonAnyUrl.json())
- .then((responseJsonAnyUrl) => {
- this.setState({
- mainUrl: mainUrl,
- jsonObject: responseJsonAnyUrl
- },
- function testName() {
- let interval = 20000
- let ind = this.child.current.getCurrentIndex()
- let zlengths = this.child.current.getZoneLengths()
- let option = 1
- if (ind !== zlengths[0]-1){
- //didn't iterate trough all content, can't update
- option=2
- interval = 5000
- }
- console.log('ind', ind)
- console.log('len', zlengths[0]-1)
- console.log('interval', interval)
- this.timeout = setTimeout(
- function(){
- if (option===1){
- this.updateContent(mainUrl)
- }else if (option===2){
- // call testName()
- }
- }.bind(this, mainUrl)
- ,
- interval)
- }.bind(this))
- })
- }
Add Comment
Please, Sign In to add comment