wip load snapshot
This commit is contained in:
parent
c794084dd6
commit
8ffb006ece
|
|
@ -4,6 +4,8 @@ import { PG } from "../../ed/logic/ed-global";
|
||||||
import { evalCJS } from "../../ed/logic/ed-sync";
|
import { evalCJS } from "../../ed/logic/ed-sync";
|
||||||
import { treeRebuild } from "../../ed/logic/tree/build";
|
import { treeRebuild } from "../../ed/logic/tree/build";
|
||||||
import { w } from "../../../utils/types/general";
|
import { w } from "../../../utils/types/general";
|
||||||
|
import { dbProxy } from "../../../base/load/db/db-proxy";
|
||||||
|
import { apiProxy } from "../../../base/load/api/api-proxy";
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
export const viLoadSnapshot = async (p: PG) => {
|
export const viLoadSnapshot = async (p: PG) => {
|
||||||
|
|
@ -69,6 +71,12 @@ export const viLoadSnapshot = async (p: PG) => {
|
||||||
export const applyEnv = (p: PG, src?: string) => {
|
export const applyEnv = (p: PG, src?: string) => {
|
||||||
if (src) {
|
if (src) {
|
||||||
const w = window as any;
|
const w = window as any;
|
||||||
|
|
||||||
|
if (p.site.config.api_url) {
|
||||||
|
w.db = dbProxy(p.site.config.api_url);
|
||||||
|
w.api = apiProxy(p.site.config.api_url);
|
||||||
|
}
|
||||||
|
|
||||||
const module = evalCJS(src);
|
const module = evalCJS(src);
|
||||||
p.global_prop = Object.keys(module);
|
p.global_prop = Object.keys(module);
|
||||||
if (typeof module === "object") {
|
if (typeof module === "object") {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue