What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-16 10:45:02
await reserved word testcafe using await in loop
async function foo(things) { const results = []; for (const thing of things) { // Good: all asynchronous operations are immediately started. results.push(bar(thing)); } // Now that all the asynchronous operations are running, here we wait ... Add solution -
Javascript 2022-03-04 04:15:09
add update react pwa feature
//This from url https://stackoverflow.com/questions/56972246/how-to-update-reactjs-based-pwa-to-the-new-version window.addEventListener('activate', function(event) { event.waitUntil( caches.keys().then(function(cacheNames) { ... Add solution -
Javascript 2022-02-28 00:25:01
javascript promise.all
var p1 = Promise.resolve(3); var p2 = 1337; var p3 = new Promise((resolve, reject) => { setTimeout(resolve, 100, "foo"); }); Promise.all([p1, p2, p3]).then(values => { console.log(values); // [3, 1337, "foo"] }); Add solution -
Javascript 2022-02-02 23:01:05
multiple async api calls javascript
// store urls to fetch in an array const urls = [ 'https://dog.ceo/api/breeds/list', 'https://dog.ceo/api/breeds/image/random' ]; // use map() to perform a fetch and handle the response for each url Promise.all(urls.map(url => fetch(url) .th... Add solution -
Javascript 2022-02-01 00:35:20
pdf javascript search text
var searchText = "JavaScript"; function searchPage(doc, pageNumber) { return doc.getPage(pageNumber).then(function (page) { return page.getTextContent(); }).then(function (content) { // Search combined text content using regular expr... Add solution