Refactor of asset bundles

This commit is contained in:
Zef Hemel
2022-10-12 11:47:13 +02:00
parent 9dd94c5397
commit 4c19ab21f2
96 changed files with 6279 additions and 770 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
import { SysCallMapping, System } from "../system.ts";
import type { AssetBundle, FileMeta } from "../asset_bundle_reader.ts";
import { AssetBundle } from "../asset_bundle/bundle.ts";
export default function assetSyscalls(system: System<any>): SysCallMapping {
return {
"asset.readAsset": (
ctx,
name: string,
): { data: string; meta: FileMeta } => {
): string => {
return (system.loadedPlugs.get(ctx.plug.name)!.manifest!
.assets as AssetBundle)[name];
.assets as AssetBundle).readFileAsDataUrl(name);
},
};
}