let dictionary = null;
function loadDictionaryForLanguage(appDataDirEntry, lang) {
dictionary = null;
appDataDirEntry.getDirectory("Dictionaries", {}, (dirEntry) => {
dirEntry.getFile(`${lang}-dict.json`, {}, (fileEntry) => {
fileEntry.file((dictFile) => {
let reader = new FileReader();
reader.addEventListener("loadend", () => {
dictionary = JSON.parse(reader.result);
});
reader.readAsText(dictFile);
});
});
});
}FileSystemDirectoryEntry: getFile() method / notebook
FileSystemDirectoryEntry: getFile() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.