MCPcopy Index your code
hub / github.com/hokein/electron-sample-apps / handleDocumentChange

Function handleDocumentChange

mini-code-editor/editor.js:11–33  ·  view source on GitHub ↗
(title)

Source from the content-addressed store, hash-verified

9const fs = require("fs");
10
11function handleDocumentChange(title) {
12 var mode = "javascript";
13 var modeName = "JavaScript";
14 if (title) {
15 title = title.match(/[^/]+$/)[0];
16 document.getElementById("title").innerHTML = title;
17 document.title = title;
18 if (title.match(/.json$/)) {
19 mode = {name: "javascript", json: true};
20 modeName = "JavaScript (JSON)";
21 } else if (title.match(/.html$/)) {
22 mode = "htmlmixed";
23 modeName = "HTML";
24 } else if (title.match(/.css$/)) {
25 mode = "css";
26 modeName = "CSS";
27 }
28 } else {
29 document.getElementById("title").innerHTML = "[no document loaded]";
30 }
31 editor.setOption("mode", mode);
32 document.getElementById("mode").innerHTML = modeName;
33}
34
35function newFile() {
36 fileEntry = null;

Callers 3

newFileFunction · 0.85
readFileIntoEditorFunction · 0.85
writeEditorToFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected