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

New Post: Script libraries

$
0
0
Hello MW!

You can execute any number of library scripts to prepare the environment for your main script. There really are no limitations. You can do something simple:
using (var engine = new V8ScriptEngine()) {
    engine.Execute(File.ReadAllText(@"C:\path\to\lib1.js"));
    engine.Execute(File.ReadAllText(@"C:\path\to\lib2.js"));
    // and so on
}
Or you can use a module manager such as RequireJS for a bit more structure; see here for a simple RequireJS implementation on ClearScript.

And because ClearScript executes scripts from in-memory strings, you can use whatever storage is convenient - files, resources, database records, etc. You can also construct scripts on the fly in memory.

Cheers!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



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