-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding asset cachin for lua scripts and lexicon zip
- Loading branch information
1 parent
9fcfa32
commit ade259d
Showing
5 changed files
with
81 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { fetchWithCache } from "./utils.js"; | ||
|
||
const factory = await lb.factory; | ||
const lua = await factory.createEngine(); | ||
|
||
// Set a JS function to be a global lua function | ||
lua.global.set("fetch", (url) => fetch(url)); | ||
|
||
lua.global.set("fetch", (url) => fetchWithCache(url)); | ||
|
||
async function mountFile(file_path, lua_path) { | ||
const content = await fetch(file_path).then((data) => data.text()); | ||
|
@@ -44,7 +47,8 @@ await lua.doString(` | |
--local resp = fetch(string.format('https://cdn.statically.io/gh/hellpanderrr/hellpanderrr.github.io/master/wiktionary_pron/lua_modules/%s.%s',path,extension) ):await() | ||
--local resp = fetch(string.format('https://cdn.jsdelivr.net/gh/hellpanderrr/[email protected]/wiktionary_pron/lua_modules/%s.%s',path,extension) ):await() | ||
updateLoadingText(path, extension) | ||
local resp = fetch(string.format('https://cdn.jsdelivr.net/gh/hellpanderrr/[email protected]/wiktionary_pron/lua_modules/%s.%s',path,extension) ):await() | ||
--local resp = fetch(string.format('https://cdn.jsdelivr.net/gh/hellpanderrr/[email protected]/wiktionary_pron/lua_modules/%s.%s',path,extension) ):await() | ||
local resp = fetch(string.format('https://cdn.statically.io/gh/hellpanderrr/hellpanderrr.github.io/master/wiktionary_pron/lua_modules/%s.%s',path,extension) ):await() | ||
--local resp = fetch(string.format('../wiktionary_pron/lua_modules/%s.%s',path,extension) ):await() | ||
updateLoadingText("", "") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters