<commit_before>
// Note, these will be updated automatically at build time
var CACHE_VERSION = '%CACHE_VERSION%';
var CACHE_LIST = ['CACHE_VALUES'];

this.addEventListener('install', function(event) {
    // Perform install steps
    console.log("cordova service worker is installing.");
    event.waitUntil(caches.open(CACHE_VERSION)
    .then(function(cache) {
        return cache.addAll(CACHE_LIST);
    }));
});

this.addEventListener('activate', function(event) {
    // Perform activate steps
    console.log("cordova service worker is activated.");
});

this.addEventListener('fetch', function(event) {
    console.log("cordova service worker : fetch : " + event.request.url);
    event.respondWith(caches.match(event.request));
});<commit_msg>Approach cache more defensively<commit_after>
// Note, these will be updated automatically at build time
var CACHE_VERSION = '%CACHE_VERSION%';
var CACHE_LIST = ['CACHE_VALUES'];

this.addEventListener('install', function(event) {
    // Perform install steps
    console.log("cordova service worker is installing.");
    event.waitUntil(caches.open(CACHE_VERSION)
    .then(function(cache) {
        return cache.addAll(CACHE_LIST);
    }));
});

this.addEventListener('activate', function(event) {
    // Perform activate steps
    console.log("cordova service worker is activated.");
});

this.addEventListener('fetch', function(event) {
    console.log("cordova service worker : fetch : " + event.request.url);

    event.respondWith(caches.match(event.request).then(function(response) {
        // Cache hit? return response else fetch it
        return response || fetch(event.request);
    }));
});
{'fraction_non_alphanumeric': 0.1375980687990344, 'fraction_numerical': 0.0, 'mean_word_length': 4.331189710610932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4307421', 'n_tokens_mistral': 459, 'n_tokens_neox': 458, 'n_words': 109}