What do you want to save?
Add Code snippet
New code examples
-
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-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 -
Javascript 2022-01-31 01:26:15
sttripe for payment in react native andorid
import React from 'react';import AddSubscriptionView from '../components/AddSubscriptionView';const STRIPE_ERROR = 'Payment service error. Try again later.';const SERVER_ERROR = 'Server error. Try again later.';const STRIPE_PUBLISHABLE_KEY = 'Your Key';/*... Add solution -
Javascript 2021-11-16 13:22:15
js promiseStatus
/** * This function allow you to modify a JS Promise by adding some status properties. * Based on: http://stackoverflow.com/questions/21485545/is-there-a-way-to-tell-if-an-es6-promise-is-fulfilled-rejected-resolved * But modified according to the specs... Add solution -
Javascript 2021-11-12 20:01:23
service worker.js
/* Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.or... Add solution -
Javascript 2021-09-27 23:12:05
promise.all map statement
//Here i have filmresponse.json() which will return promise so i uses promise. //all otherwise it won't be possible to run it let characterResponse = await fetch('http://swapi.co/api/people/2/') let characterResponseJson = await characterResponse.json()... Add solution -
Javascript 2021-09-27 12:55:06
service worker js example
/* Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.or... 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 -
Javascript 2021-09-18 10:25:06
vanilla js post form data
document.addEventListener('submit', function (event) { event.preventDefault(); fetch('https://jsonplaceholder.typicode.com/posts', { method: 'POST', body: JSON.stringify(Object.fromEntries(new FormData(event.target))), headers: { 'Content-typ... Add solution