MCPcopy Index your code
hub / github.com/witheve/Eve / _initProgram

Method _initProgram

src/client.ts:290–324  ·  view source on GitHub ↗
(data:{config:Config, path:string, code:string, workspaces})

Source from the content-addressed store, hash-verified

288 }
289
290 _initProgram(data:{config:Config, path:string, code:string, workspaces}) {
291 initConfig(data.config);
292
293 this.localEve = config.runtimeOwner === Owner.client;
294 this.localControl = config.controlOwner === Owner.client;
295 this.showIDE = config.editor;
296 if(this.localEve) {
297 this.worker = new Worker("/build/src/loadWorker.js");
298 this.worker.onmessage = (event) => {
299 this.onMessage(event);
300 }
301 this.send({type: "init", code: data.code, showIDE: data.config.editor, workspaces: data.workspaces, config, workspaceCache: window["_workspaceCache"]});
302 }
303 if(this.showIDE) {
304 let path = data.path;
305 if(path === undefined) path = location.hash && location.hash.slice(1);
306 //history.replaceState({}, "", window.location.pathname);
307
308 this.ide = new IDE();
309 this.ide.local = this.localControl;
310 initIDE(this);
311 this.ide.render();
312 let found = false;
313 if(path && path.length > 2) {
314 let currentHashChunks = path.split("#");//.slice(1);
315 let docId = currentHashChunks[0];
316 if(docId && docId[docId.length - 1] === "/") docId = docId.slice(0, -1);
317 found = this.ide.loadFile(docId, data.code);
318 }
319 if(!found && config.internal) {
320 this.ide.loadFile("/examples/quickstart.eve");
321 }
322 }
323 onHashChange({});
324 }
325
326 _css(data) {
327 document.getElementById("app-styles").innerHTML = data.css;

Callers 1

onErrorMethod · 0.95

Calls 6

onMessageMethod · 0.95
sendMethod · 0.95
initIDEFunction · 0.85
onHashChangeFunction · 0.85
loadFileMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected