This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsonDataRe = /example\.com\/(.*\.json)/; | |
self.addEventListener('fetch', function(event) { | |
var request = event.request, | |
match = jsonDataRe.exec(request.url); | |
if (match) { | |
// Use regex capturing to grab only the bit of the URL | |
// that we care about, ignoring query string, etc. | |
var cacheRequest = new Request(match[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HashTable = function() { | |
this._storage = []; | |
this._count = 0; | |
this._limit = 8; | |
} | |
HashTable.prototype.insert = function(key, value) { | |
//create an index for our storage location by passing it through our hashing function | |
var index = this.hashFunc(key, this._limit); |