Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit ac419f4

Browse files
committed
v0.2.0
1 parent bcea9bb commit ac419f4

File tree

10 files changed

+641
-148
lines changed

10 files changed

+641
-148
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Simple browser module loader.
2020
- [x] No intrusion and does not affect the script label.
2121
- [x] Node modules that support the CommonJS format.
2222
- [x] Modules that support AMD format.
23-
- [x] The fetch function is automatically supported without additional loading.
23+
- [x] The fetch function is automatically supported without additional loading.
24+
- [x] The Promise object is automatically supported if not in the browser.
25+
- [x] Supports running code in memory.
2426

2527
## Installation
2628

@@ -74,6 +76,23 @@ loader.ready(function() {
7476
loader.require(["../dist/tmodule", "module2"], function(t1, t2) {
7577
// Do something, you can also not write callbacks.
7678
});
79+
80+
// --- Load by memory ---
81+
var [rtn] = await loader.requireMemory("main", {
82+
"/main.js": `var sub = require("./sub");
83+
function getData(key) {
84+
return key + ", end.";
85+
}
86+
exports.getData = getData;
87+
88+
function getSubStr() {
89+
return sub.str;
90+
}
91+
exports.getSubStr = getSubStr;`,
92+
"/sub.js": `exports.str = "hehe";`
93+
});
94+
console.log(main.getData("rand: " + Math.random()));
95+
console.log(main.getSubStr());
7796
});
7897
```
7998

dist/index.js

Lines changed: 265 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test-on-browser.js

Lines changed: 80 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test-on-browser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@litert/loader",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"description": "Simple browser module loader.",
55
"keywords": [
66
"litert",

0 commit comments

Comments
 (0)