What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-25 22:16:02
JavaScript Errors
EvalError: Creates an instance representing an error that occurs regarding the global function eval(). RangeError: Creates an instance representing an error that occurs when a numeric variable or parameter is outside of its valid range. ReferenceError: ... Add solution -
TypeScript 2021-09-25 07:52:03
cloudinary
import { v2 as cloudinary, UploadApiResponse } from 'cloudinary' export const cloudStorage = (filename: string): Promise<Record<string, any>> => { return new Promise((resolve, reject) => { cloudinary.config({ cloud_name: process.e... Add solution -
Javascript 2021-09-24 17:47:05
sleeping in 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 -
Other 2021-09-24 10:49:03
react-native-sync-localstorage expire date
/** * * @param urlAsKey * @param expireInMinutes * @returns {Promise.<*>} */ async getCachedUrlContent(urlAsKey, expireInMinutes = 60) { let data = null; await AsyncStorage.getItem(urlAsKey, async (err, value) => { data = ... Add solution -
Javascript 2021-09-23 04:31:02
what is promise in javascript
/* A Promise is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action's eventual success value or failure reason. */ let promise = new Promise((resolve... Add solution -
TypeScript 2021-09-22 23:42:02
node-redis
// node-redis to promise, because node-redis not support promise import bluebird from 'bluebird' import { Commands, createClient } from 'redis' const client = createClient({ host: process.env.REDIS_HOST, port: parseInt(process.env.REDIS_PORT), passwo... Add solution -
Javascript 2021-09-21 22:35:05
axios request interceptor add header
// Add a request interceptor axios.interceptors.request.use(function (config) { // Do something before request is sent return config; }, function (error) { // Do something with request error return Promise.reject(error); }); // Add a ... Add solution