-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathROF_CacheReload.js
More file actions
36 lines (32 loc) · 1.17 KB
/
ROF_CacheReload.js
File metadata and controls
36 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//=============================================================================
// ROF_CacheReload
//=============================================================================
/*:
*
* @plugindesc This allows to force users to re-load old files
* @author RageOfFire
* @pluginname ROF_CacheReload
*
* @help Allow to force users to rel-load webpage when new update come
*
* This plugin allows you to force users to re-load old files
* Just need to change the version in the plugin setting before pushing online
*
* It does not provide plugin commands.
*
* @param gameVersion
* @text Game version:
* @type text
* @default 1.0.0
*/
(() => {
const cacheReload = PluginManager.parameters('ROF_CacheReload');
const storageVersion = localStorage.getItem('gameVersion') ? localStorage.getItem('gameVersion') : null
const currentVersion = cacheReload['gameVersion'] || "1.0.0";
// Force loading last file if browser version doesn't match with plugin
if (storageVersion != currentVersion || storageVersion == null) {
localStorage.setItem('gameVersion', currentVersion);
alert("Found new update ! Reload your webpage");
setTimeout(location.reload(), 3000);
}
})();