Answer the question
In order to leave comments, you need to log in
What kind of Android torrent client exists with the ability to control it from the side?
Good afternoon, please tell me.
There is an Android device on which you need to download content via torrent,
but you need such functionality so that you can, as it were, give it a task from the outside
. it turns out initially the first device is only a workhorse,
and other third-party clients (ideally also on Android) could monitor its
download progress status, and the ability to transfer the task in the form of a .torrent file
Answer the question
In order to leave comments, you need to log in
if there is no setTimeout, then the logic looks like this:
print();
look at what i is now and print to the console
print()
look at what i is now and print to the console print() look at what i is now and
print
to the console
.....
If there is setTimeout, then the logic looks like this:
call print() when the stack calls will be empty(no code is being executed) but not earlier than 5 seconds later
call print() when the call stack is empty(no code is being executed) but not earlier than 5 seconds later
call print() when the call stack is empty(no code not executed) but not before 5 seconds
call print() when the call stack is empty (no code is executed) but not before 5 seconds
....
all code is executed
....
look at what i is now and print to the console
look at what i is now and print to the console
look at what i is now and print to the console
look at what i is now and print to the console
This is how it should work:
var i;
var print = function (i) {
console.log(i);
}
for(i=0;i<10;i++){
setTimeout(print.bind(null, i),5000);
}
because the loop is over by the time the timeout starts running.
This is due to the fact that the first print is called 5 seconds after the timer was started, but the loop during this time performed more and more iterations on each of which it increased the value of the variable i by one until it became equal to 10, all these iterations took only a few milliseconds or tens of milliseconds. So, by the time print was called for the first time by the timer, the value of i was already 10 and never changed!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question