Hi Ashley,
Current offline related conditions in the Browser plugin allow us to determine if an update is available and if it's downloaded. Which is great and works well if we want to allow user to keep on playing the old version while downloading a new one in the background.
However very often it would be more suitable to check the new version availability at start (in the loader layout for instance) and reload (update) the game to ensure that the player is always playing the newest version before letting him enter the actual game.
Currently it is not possible because we do not have any trigger that will tell us "I checked for an update and there is none available". So if there is no update available, we can't check if the update has been checked already or not.
I took a look at the code and I saw that your Service Worker is already sending such message ("up-to-date") to the Browser plugin. The only thing that lacks is a condition and a little logic. I temporarily altered the Browser plugin to test it and it works flawlessly.
I investigated and implemented all the needed code which I'm sharing below. Would you mind adding it to the official Browser plugin release please?
== runtime.js
if (messageType === "up-to-date")
this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateNotFound, this);
else[/code:f5suyvh5]
[b]== runtime.js[/b]
[img="https://puu.sh/z7mOf/c671fb35fd.png"]
[code:f5suyvh5] Cnds.prototype.OnUpdateNotFound = function ()
{
return true;
};[/code:f5suyvh5]
[b]== edittime.js[/b]
[img="https://puu.sh/z7mQF/32d5288e70.png"]
[code:f5suyvh5]AddCondition(22, cf_trigger, "On update not found", "Offline", "On update not found", "Triggers when no update has been found.", "OnUpdateNotFound");[/code:f5suyvh5]
The result allows something like below:
[img="https://puu.sh/z7mVG/e821b29d34.png"]
Simply saying, the user will always run the newest version once it's been uploaded to the server.
[b]== EDIT (bug found):[/b]
I just noticed that SW is not sending "up-to-date" message when the code is exported with minification. It works well without minification.