microsoft / ClearScript

A library for adding scripting to .NET applications. Supports V8 (Windows, Linux, macOS) and JScript/VBScript (Windows).
https://microsoft.github.io/ClearScript/
MIT License
1.74k stars 148 forks source link

How to call the local third-party js library #482

Closed gogo1008 closed 1 year ago

gogo1008 commented 1 year ago

1、For example, call dayjs. If the third-party library file has been checked for more than 1M, the following code is very difficult to use

var result = ""; using (var engine = new V8ScriptEngine()) { var scirpt = await FileUtil.ReadFileAndContentByVirUrlAsync("~/AppNodeJs/Plugins/words/cnchar/cnchar.all.min.js"); engine.Execute($"{scirpt}"); result = engine.Script.cnchar.convert.simpleToTrad("content"); }

ClearScriptLib commented 1 year ago

Hi @gogo1008,

We aren't clear on the problem you're having. Does the code above not work for you?

Thanks!

ClearScriptLib commented 1 year ago

Please reopen this issue if you can provide more information. Thank you!