Comments (6)
I can't seem to replicate this on my end. Could you provide more details about your environment's state? What OS/browser are you on? Is your service worker active?
from ragin-mages.
I am on windows 10 using normal/stable chrome (not canary). Yes there was a service worker going. It may be an issue with the service worker. Once I unchecked "enable offline" and also killed the service worker the error went away. If I enable offline and then refresh the error occurs again.
from ragin-mages.
I'm looking into this guys.
from ragin-mages.
Alright here are my thoughts on the service worker, please give me your inputs and then I will refactor it accordingly.
I am thinking we don't need two caches? When the service worker loads through the enable button it basically starts off by registering a service worker, which takes it to the SW file and then it initially loads up some static files. We can set it up so it just loads up all the assets immediately then, there's no need to send a second message to the service worker since its already doing a registration and already processing files into a cache. It could be the one single file. We can still have our cache dynamically populate any files we missed using the fetchAsset function only now we'll be fetching into the one cache.
Also I was thinking to add functionality where service worker deletes any caches if it is disabled by unchecking the enable service worker box. This could be done using messaging.
This is also related to #45
from ragin-mages.
I agree that a single cache is better. When the SW is loaded it should cache all files as you say. Here's what I think should happen:
- When the "enable service worker" box is checked, it should verify if the user is online. If the user is offline, caching cannot be enabled. This can be something we add later once we have the WebSocket portion abstracted out into a separate class.
- If the user is online, the SW will be installed.
2.1. Option 1: Loading of assets does not start immediately, since the SW should not fetch another copy of theassets.json
manifest. Instead, it will receive it in a message from the game. Remember that the game has this manifest already loaded in memory.
2.2. Option 2: The SW loads the assets.json file once more and adds things to the cache without further intervention from the game. The problem with this approach is the additional request for the manifest and having to maintain the location of the manifest in two locations: the game and the SW. - Once the SW has the manifest (via either option) it requests each asset/resource again to add it to the cache.
We should probably avoid dynamic caching (via fetch intercept) and instead ensure that our assets.json manifest is complete and correct. One location where we're currently dropping the ball is caching fonts and the web font loader script.
Deleting the cache when offline mode is disabled is a good idea.
from ragin-mages.
Thank you for the feedback.
from ragin-mages.
Related Issues (20)
- Redo 'No Name' HOT 2
- Display leaderboard during gameplay HOT 3
- Scale title & character selection screen for display
- Service worker fails when set to 'update on reload' HOT 4
- Health should regenerate slowly HOT 1
- Single Player: Enemies should stop spawning after player dies HOT 1
- Host fonts locally
- Add sound HOT 2
- Add swipe capabilities
- Enhance map capabilities
- Pickup bones for healing HOT 5
- Capture the flag
- Add push notification HOT 2
- Add random appearing rewards HOT 2
- Add difficulty levels (beginner, intermediate, advanced, etc.) HOT 1
- Better Maps with Collision and Land Features HOT 1
- Add Chat Features
- Ability to sign in using Facebook, Twitter, Google
- Custom cursor/Indicator to show direction of fire
- Can you tell me how you generated assets.json HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ragin-mages.