Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Are multiline strings possible?

$
0
0
Togakangaroo wrote:

I would like to use ClearScript to compile handlebarsjs templates. Handlebars templates can be full html documents that as far as I know there's no good way to build up in js alone ( they have to be passed in via an API or grabbed via an ajax download or elment.innerHTML).

Is there a way in ClearScript where I can inject a multiline string containing a document into a variable or am I barking up the wrong tree?

Sure, the host can pass any string to a script function:
// C#string document = GetOrCreateDocument();
engine.Script.processDocument(document);
... or store the string as a property in a script object (the global object in this case):
// C#
engine.Script.document = document;
There are no restrictions on string size or contents.

Good luck!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>