Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,13 @@ Yet another is that there is an internal error. The internal error message is:
if (elem === null) {
elem = document.querySelector(`[data-filename="${divid}"]`);
}
// Check if data file was cached and retrieve it if it was
const cacheKey = `datafile_${divid}`;
const cachedData = localStorage.getItem(cacheKey);
if (cachedData) {
return cachedData;
}

let data = "";
let result = "";
if (elem == null && Sk.builtinFiles.files.hasOwnProperty(divid)) {
Expand All @@ -1143,6 +1150,7 @@ Yet another is that there is an internal error. The internal error message is:
url: `/ns/logger/get_datafile?course_id=${eBookConfig.course}&acid=${divid}`,
success: function (data) {
result = data.detail;
localStorage.setItem(cacheKey, result);
},
error: function (err) {
result = null;
Expand Down