-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Offline Cores #5
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell what this PR changes because you changed the indentation space count. Indentation across the entire EmulatorJS project should always be 4 spaces, to keep consistency with code style.
I don't even know how that happened vscode must have auto formatted it. |
I'm going to have to force push to fix it ug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide screenshots of any UI changes and explain the logic behind this PR? I've read through the code and think its just loading the list of cores to allow the user to select what is cached locally, but I want to confirm
|
urlsToCache.push(corePath + "reports/" + core.value + ".json"); | ||
urlsToCache.push(corePath + core.value + "-wasm.data"); | ||
urlsToCache.push(corePath + core.value + "-thread-wasm.data"); | ||
urlsToCache.push(corePath + core.value + "-legacy-wasm.data"); | ||
urlsToCache.push(corePath + core.value + "-thread-legacy-wasm.data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be some sort of opt-in here. This is 4x the amount of needed storage to keep a core locally. A user isn't often going to be switching between these at all
@@ -53,6 +81,10 @@ self.addEventListener("fetch", (event) => { | |||
let url = (requestURL.hostname === "cdn.emulatorjs.org") ? event.request.url : requestURL.pathname; | |||
const cache = await caches.open(CACHE_NAME); | |||
if (requestURL.hostname === "cdn.emulatorjs.org" && !OFFLINE_FILES.includes(event.request.url)) { | |||
const cachedResponse = await caches.match(event.request); | |||
if (cachedResponse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At what point in the code is this cache updated?
No description provided.