diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt index 3d6a4642c4579677d76b0843f69cbae94341a6ff..30ff7a15b71ce408587e441fefb449b46e25a5e5 100644 --- a/devNotes/twine JS.txt +++ b/devNotes/twine JS.txt @@ -4085,12 +4085,12 @@ window.html5passage = function html5passage(passage_function) { }); }; -//If you want to include a SugarCube passage in a JS function use this. The result must be printed using the <<print>> macro. -window.jsInclude = function(passage) { - if (Story.has(passage)) - return Story.get(passage).processText(); +//If you want to include a SugarCube passage in a JS function use this. The result must be printed using the <<print>> macro. passageTitle must be a string. +window.jsInclude = function(passageTitle) { + if (Story.has(passageTitle)) + return Story.get(passageTitle).processText(); else - return `<span class="red">Error: Passage ${passage} does not exist.</span>` + return `<span class="red">Error: Passage ${passageTitle} does not exist.</span>`; }; window.capFirstChar = function capFirstChar(string) { diff --git a/src/js/utilJS.tw b/src/js/utilJS.tw index c65c2f4512fda875fd3a3cb58f13a519faabbff5..346883935e365e7ee264878e96f464581f9c725d 100644 --- a/src/js/utilJS.tw +++ b/src/js/utilJS.tw @@ -700,12 +700,12 @@ window.html5passage = function html5passage(passage_function) { }); }; -//If you want to include a SugarCube passage in a JS function use this. The result must be printed using the <<print>> macro. -window.jsInclude = function(passage) { - if (Story.has(passage)) - return Story.get(passage).processText(); +//If you want to include a SugarCube passage in a JS function use this. The result must be printed using the <<print>> macro. passageTitle must be a string. +window.jsInclude = function(passageTitle) { + if (Story.has(passageTitle)) + return Story.get(passageTitle).processText(); else - return `<span class="red">Error: Passage ${passage} does not exist.</span>` + return `<span class="red">Error: Passage ${passageTitle} does not exist.</span>`; }; window.capFirstChar = function capFirstChar(string) {