if I have four methods of abcd. Each of these methods is executed for five seconds, and the sequence is random. Is there a way to do this?
if I have four methods of abcd. Each of these methods is executed for five seconds, and the sequence is random. Is there a way to do this?
what does random order mean? a sequence is provided here. Please refer to
.function loop(fn){
t = 5*1000
var date = new Date()
while(Date.now() - date < t){
fn && fn()
}
}
[a,b,c,d].forEach(loop)
let queue = [a, b, c, d]
setInterval(() => {
queue[Math.floor(Math.random() * queue.length)]()
}, 5000)
do you mean to keep performing one of the arecalogical brecinct crecinct d for 5 seconds, and then randomly change another one for the next 5 seconds, and then cycle around non-stop?
this generally controls some display effects, which requires that a _ r _ c _ d and so on can be interrupted at will, and can be entered again.
fns=[a,b,c,d];
t=5*1000;
while(true){
var datein=Date().now();
fn=fns[ Math.floor(Math.random()*4) ];
while(Date.now()-datein < t){
(fn)();
}
}
need to modify abcd:
if the subject says that each method executes for 5 seconds, then I will assume that
Yes, just give a callback at random!
Previous: How to get the proxy ip address
Next: Multiple onload images need to generate new Image () one by one?
draw the subway map to achieve the drag function, the first drag is normal, the back drag will appear a backward effect in the opposite direction. function clickSubway(e) { isDrag=true; start_x=e.pageX-draw.offsetLeft; start_y=e.pageY-draw....
The end result of vue implementation is to refresh the page and chat records of two people I would like to ask all the great gods to give us a train of thought in one or two. ...
problem 1: now the company is developing an activity that uses the H 5 interface to do it. Click on the pop-up window on the native app and enter my H5 interface. pass a user ID, ask me how my current H5 interface should receive the parameters passed ...
the code is as follows: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equ...
I implement preview pdf in web. As long as the href to the file link browser will preview automatically, but I add the download attribute under the a tag or just preview but not download. How to solve this? ...
chrome browser, in mobile phone mode iphone6, adds this sentence to the page < meta name= "viewport " content= "width=device-width, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5 " > . At this time, both window.innerWidth and document.docume...
using app packaged with Hbuilder to use sharing function, Android real machine debugging and apk testing are all fine ios can be debugged on a real machine, but after the packaged ipa files are installed, the sharing function is not available have y...
What s the difference between and a direct request request ...
my web page needs to load a 3.3Mb library resource with the suffix .sf2 because I want to play music. when you enter the page, the chrome debugging tool shows that it takes 20s to load this resource, and I think the speed is more than 100kb s. I am us...
has an address. How can a html, be returned to prevent js execution in the returned html? ...
...
because the mobile project we are doing now will eventually be enclosed in the app shell. I put the axios request of each component in the created. Go to the component to send the request and get the data . the requirement now is that all component...
how does the front-end page get the videos and pictures in the database? Without relevant experience, you had better say more details about _ (: 3 ") _ like a video bar how to get it. On your knees. Thank you. Thank you, guys. I was wrong that TT ...
1: after the page login is redirected, the user switches routes, how to ensure that he does not have to log in every time? 2: the user enters a routing link at will for the first time, how to judge that he has not logged in yet, and needs to log in. ...
does the ngx-ueditor rich text editor support angular4.x ...
above (Zhihu effect) give me json backstage { "newe_page":1, "page_count":52, } to find out how to achieve the effect shown above, answer ...
play video local video normal playback request server video to report 403 but open normally in the browser to solve! Wait online <template> <div class="player"> <video-player class="vjs-custom-skin&quo...
can variables be written in legend.selected in echarts? Why are the variables I wrote treated as strings? console.log(aa); optionFH.legend.selected={ aa:true, "xx":true, ...
use js to get uploaded files. When judging the file type, there are computers whose uploaded word, cannot get the file type, through js, but pdf can get the file. is obtained by using the event.files [0] .type method, and basically most computers ca...
from page a hyperlink to page b, I want to press back to page a no matter how many times I refresh and submit on page b. How can I achieve this? if replaceState can be implemented, please also show me how to fill in the third parameter ...