add option for modules to prevent caching
This commit is contained in:
parent
75b9a6ac4c
commit
006823d870
2 changed files with 15 additions and 7 deletions
18
app.js
18
app.js
|
|
@ -178,11 +178,15 @@ function initModule(mod, file, dir) {
|
|||
if (!script[code]) {
|
||||
return logger.log(`inject missing target "${code}"`);
|
||||
}
|
||||
let opt = options || {};
|
||||
const opt = options || {};
|
||||
const path = `${dir}/${file}`;
|
||||
if (opt.end) {
|
||||
script[code].push(dir + "/" + file);
|
||||
script[code].push(path);
|
||||
} else {
|
||||
script[code].splice(0, 0, dir + "/" + file);
|
||||
script[code].splice(0, 0, path);
|
||||
}
|
||||
if (opt.nocache) {
|
||||
nocache[path] = true;
|
||||
}
|
||||
},
|
||||
path: {
|
||||
|
|
@ -359,6 +363,9 @@ const script = {
|
|||
].map(p => `src/${p}.js`)
|
||||
};
|
||||
|
||||
// prevent caching of specified modules
|
||||
const nocache = {};
|
||||
|
||||
const db = {
|
||||
// --------
|
||||
key: arr => arr.join("/"),
|
||||
|
|
@ -668,9 +675,10 @@ function concatCode(array) {
|
|||
// in debug mode, the script should load dependent
|
||||
// scripts instead of serving a complete bundle
|
||||
if (debug) {
|
||||
let code = [ '(function() { let load = [ ' ];
|
||||
const code = [ '(function() { let load = [ ' ];
|
||||
direct.forEach(file => {
|
||||
code.push(`"/${file.replace(/\\/g,'/')}?${version}",`);
|
||||
const vers = nocache[file] ? Date.now() : version;
|
||||
code.push(`"/${file.replace(/\\/g,'/')}?${vers}",`);
|
||||
});
|
||||
code.push([
|
||||
']; function load_next() {',
|
||||
|
|
|
|||
4
notes.md
4
notes.md
|
|
@ -1,9 +1,9 @@
|
|||
# Kiri:Moto todo
|
||||
|
||||
## 2.3 remaining
|
||||
* deprecate cam device origin settings
|
||||
* gcode render broken when layer hints disabled
|
||||
* cap path ends
|
||||
* rulers need to follow workspace units
|
||||
* gcode render broken when layer hints disabled
|
||||
* onshape mouse mapping option
|
||||
|
||||
## 2.4
|
||||
|
|
|
|||
Loading…
Reference in a new issue