Hi,
I had an equivalent Java issue, so I tackle it along these lines:
The js record contains something like
window.someVarForReturn = 'content for return'
On html
- <script src="file.js"></script>
-
<script>console.log(someVarForReturn)</script>
For my situation the substance was html layout. So I followed through with something like this:
On js record
window.someVarForReturn = '<did>My template</div>'
On html
- <script src="file.js"></script>
-
<script>
-
new DOMParser().parseFromString(someVarForReturn, 'text/html').body.children[0]
-
</script>
-
Regards -