What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-24 00:20:07
js sleep
const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) } /*Use like so*/ async function timeSensativeAction(){ //must be async func //do something here await sleep(5000) //wait 5 seconds //contin... Add solution -
Javascript 2022-01-24 01:26:32
sleep function js
const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) } /*Use like so*/ async function timeSensativeAction(){ //must be async func //do something here await sleep(5000) //wait 5 seconds //contin... Add solution -
Python 2021-11-22 04:41:15
asyncio sleep
const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) } /*Use like so*/ async function timeSensativeAction(){ //must be async func //do something here await sleep(5000) //wait 5 seconds //contin... Add solution -
TypeScript 2021-11-21 13:33:07
refreshcontrol
import React from 'react'; import { RefreshControl, SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native'; const wait = (timeout) => { return new Promise(resolve => setTimeout(resolve, timeout)); } const App = () => { const [refr... Add solution -
Javascript 2021-11-13 22:13:14
asyncio.sleep in javascript
const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) } /*Use like so*/ async function timeSensativeAction(){ //must be async func //do something here await sleep(5000) //wait 5 seconds //contin... Add solution -
Other 2021-11-12 01:16:08
async function in variable
function resolveAfter2Seconds(x) { return new Promise(resolve => { setTimeout(() => { resolve(x); }, 2000); }); }; (async function(x) { // fonction asynchrone immédiatement appelée var a = resolveAfter2Seconds(20);... Add solution