MCPcopy
hub / github.com/witheve/Eve / changeDocument

Function changeDocument

src/client.ts:500–520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

498}
499
500function changeDocument() {
501 if(!client.showIDE) return;
502 let ide = client.ide;
503 // @FIXME: This is not right in the non-internal case.
504 let docId = "/examples/quickstart.eve";
505 let path = location.hash && location.hash.split('?')[0].split("#")[1];
506 if(path[path.length - 1] === "/") path = path.slice(0, -1);
507 if(path && path.length > 2) {
508 if(path[path.length - 1] === "/") path = path.slice(0, -1);
509 docId = path;
510 }
511
512 if(!docId) return;
513 if(docId === ide.documentId) return;
514 try {
515 ide.loadFile(docId);
516 } catch(err) {
517 client.injectNotice("info", "Unable to load unknown file: " + docId);
518 }
519 ide.render();
520}
521
522//---------------------------------------------------------
523// Handlers

Callers 1

onHashChangeFunction · 0.85

Calls 3

loadFileMethod · 0.80
injectNoticeMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected