<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <h1 class="time"></h1> <button class="stop">暂停时间</button> <script ...
分类:
其他好文 时间:
2020-01-28 15:59:17
阅读次数:
93
const Gen = (time) => { return new Promise((resolve, reject) => { setTimeout(function () { if(time < 500) { reject(time) } else { resolve(time) } },ti ...
分类:
其他好文 时间:
2020-01-24 00:27:22
阅读次数:
81
function Gen (time) { return new Promise((resolve,reject) => { setTimeout(function () { resolve(time) },time) }) } async function test () { let arr = ...
分类:
其他好文 时间:
2020-01-23 22:48:55
阅读次数:
142
1.setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。//5秒之后弹出框(只会执行一次)setTimeout(function () { alert('5秒之后弹出框');}, 5000)2.setInterval()方法可按照指定的周期(以毫秒计)来调用函数或计算表达式,会不 ...
分类:
其他好文 时间:
2020-01-21 18:03:15
阅读次数:
71
题目 代码 js class Man { constructor(name) { this.actions = []; const hello = () = { console.log( ); this.next(); }; this.addAction(hello); setTimeout(() ...
分类:
其他好文 时间:
2020-01-19 11:02:43
阅读次数:
83
function resolveAfter2Seconds() { console.log('slow start at: ' + new Date().getSeconds()) return new Promise(resolve => { setTimeout(() => { resolve( ...
分类:
Web程序 时间:
2020-01-16 12:58:43
阅读次数:
83
一、简介 定时器在需求中也是一个常见的部分,例如在间隔时间内循环执行某些业务或者定时推送消息等。ReactNative中提供了三种定时器API,分别是setTimeout、setInterval、setImmediate。它们都是遵循浏览器API标准实现的,但是作用也略有不同。 二、API 1、se ...
分类:
其他好文 时间:
2020-01-16 12:57:28
阅读次数:
145
function resolveAfter2Seconds() { console.log('starting slow promise at:'+ new Date().getSeconds()) return new Promise(resolve => { setTimeout(() => { ...
分类:
Web程序 时间:
2020-01-16 12:52:26
阅读次数:
89
function resolveAfter2Seconds() { return new Promise(resolve => { setTimeout(() => { resolve('resolved') }, 2000) }) } async function asyncCall() { co ...
分类:
Web程序 时间:
2020-01-16 12:26:53
阅读次数:
87
function resolveAfter2Seconds() { console.log('slow start at: ' + new Date().getSeconds()) return new Promise(resolve => { setTimeout(() => { resolve( ...
分类:
Web程序 时间:
2020-01-16 12:23:27
阅读次数:
74