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