<commit_before>/**
 * Created by ArunaTebel on 12/12/2015.
 */
this.addEventListener('install', function (event) {
    event.waitUntil(
        caches.open('v2.1').then(function (cache) {
            return cache.addAll([
                '/app/view1/view1.html',
                '/app/view2/view2.html'
            ]);
        })
    );
});

this.addEventListener('fetch', function (event) {
    var response;
    event.respondWith(caches.match(event.request).catch(function () {
        return fetch(event.request);
    }).then(function (r) {
        response = r;
        caches.open('v2.1').then(function (cache) {
            cache.put(event.request, response);
        });
        return response.clone();
    }).catch(function () {
        return caches.match('/sw-test/gallery/myLittleVader.jpg');
    }));
});

this.addEventListener('activate', function (event) {
    var cacheWhitelist = ['v2.1'];

    event.waitUntil(
        caches.keys().then(function (keyList) {
            return Promise.all(keyList.map(function (key) {
                if (cacheWhitelist.indexOf(key) === -1) {
                    return caches.delete(keyList[i]);
                }
            }));
        })
    );
});<commit_msg>Remove old cache<commit_after>/**
 * Created by ArunaTebel on 12/12/2015.
 */
this.addEventListener('install', function (event) {
    event.waitUntil(
        caches.open('v2.1').then(function (cache) {
            return cache.addAll([
                '/app/view1/view1.html',
                '/app/view2/view2.html'
            ]);
        })
    );
});

this.addEventListener('fetch', function (event) {
    var response;
    event.respondWith(caches.match(event.request).catch(function () {
        return fetch(event.request);
    }).then(function (r) {
        response = r;
        caches.open('v2.1').then(function (cache) {
            cache.put(event.request, response);
        });
        return response.clone();
    }).catch(function () {
        return caches.match('/sw-test/gallery/myLittleVader.jpg');
    }));
});

this.addEventListener('activate', function (event) {
    var cacheWhitelist = ['v2.1'];

    event.waitUntil(
        caches.keys().then(function (keyList) {
            return Promise.all(keyList.map(function (key) {
                if (cacheWhitelist.indexOf(key) === -1) {
                    return caches.delete(keyList[key]);
                }
            }));
        })
    );
});
{'fraction_non_alphanumeric': 0.16482164821648215, 'fraction_numerical': 0.015580155801558016, 'mean_word_length': 2.031055900621118, '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': '3366478', 'n_tokens_mistral': 751, 'n_tokens_neox': 722, 'n_words': 110}