Skip to content

Instantly share code, notes, and snippets.

View MatheusDonizete's full-sized avatar

Matheus Donizete MatheusDonizete

View GitHub Profile
@MatheusDonizete
MatheusDonizete / jest.config.js
Created November 24, 2020 18:54
Gist de configuração testing library
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue',
],
testEnvironment: 'jest-environment-jsdom-sixteen',
transform: {
'^.+\\.vue$': 'vue-jest',
self.addEventListener('activate', function(event) {
const expectedCacheNames = Object.keys(currentCaches)
.map(key => currentCaches[key]);
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (expectedCacheNames.indexOf(cacheName) == -1) {
return caches.delete(cacheName); //exclusão de cache velho
}
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open(`v${cacheVersion}`)
.then(function(cache) {
return cache.addAll(cacheUrls);
})
);
});
self.addEventListener('fetch', function(event) {
event.respondWith(
const cacheVersion = 1;
const currentCaches = {
font: `font-cache-v${cacheVersion}`
};
//Starter example, caching some files
const cacheUrls = [
'/',
'/js/app.js',
'/fonts/roboto/Roboto-Regular.woff2'
];
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js', { scope: './' })
console.log('Service worker installing');
} else if (reg.waiting) {
console.log('Service worker installed');
console.log('Service worker active');
}).catch((error) => console.log('Registration failed with ' + error));

Keybase proof

I hereby claim:

  • I am matheusdonizete on github.
  • I am matheusdonizete (https://keybase.io/matheusdonizete) on keybase.
  • I have a public key ASAqetRz2N-lp8AyS_63wbtzYtKn2PxFHfbGwR94V_JjVAo

To claim this, I am signing this object: