clearscript

Clearscript Javascript 'require' functionality

主宰稳场 提交于 2021-02-20 03:55:27
问题 I am attempting to write a C# wrapper for the Twilio Programmable Chat tool. The library provided is for JS clients. I thought that using a tool like ClearScript (V8) would allow me to wrap the js as needed. The example code on the site is const Chat = require('twilio-chat'); // Make a secure request to your backend to retrieve an access token. // Use an authentication mechanism to prevent token exposure to 3rd parties. const accessToken = '<your accessToken>'; Chat.Client.create(accessToken)

dotnet 使用 ClearScript 执行 VBScript 和 JS 代码 无需浏览器

丶灬走出姿态 提交于 2020-08-15 16:45:01
小伙伴都知道,使用 JS 的坑在于执行效率过低,速度过慢。如果是在客户端中,还开启一个浏览器,整个应用程序就会特别重。有没有什么方法可以让 dotnet 作为容器,执行 JScript 代码而不需要浏览器?其实有的,因为 VBScript 和 JS 代码都很好解析,所以有 ClearScript 支持使用 dotnet 解析代码执行 如何将 VBScript 和 JS 代码编译为 IL 或如何在 C# 和 dotnet 中嵌入 js 代码是不靠谱的,因为 js 语言设计如此,是用来在 基组模块 层运行的语言,也就是这是一个解析型的脚本,更好地做法是给他实现一个解析库。通过解析库将代码解析为数据,在根据数据调用已经写好的代码,这样就能实现在 dotnet 中运行 js 代码了。实现这个方式有两个不同方法,第一个方法使用的最多的,就是在 dotnet 中添加一个浏览器让他执行代码,这个方法的缺点就是性能特别渣,无论是内存占用或 CPU 占用都是特别渣。我作为性能优化组的逗比,只能去寻找第二条路径,毕竟需要照顾一些只会写 js 的大佬。第二个方法是通过 dotnet 解析器解析 js 代码的方法,推荐使用 ClearScript 库,这个库十分好用,可以给 js 注入执行的类或实例包括库,这样可以让贫瘠的 js 可以用到更多的 dotnet 的强大的库。同时可以杂私货,注入自己实现的类等

Taurus.MVC 2.3.2 :WebAPI 文档集成测试功能及附加<%# JS执行功能语法 %>

丶灬走出姿态 提交于 2020-05-08 15:29:32
前言: 前些天有网友提到了那个界面丑陋的SwaggerUI,让我想起了多年前实现的WebAPI文档未完成的功能点,于是,动手了,便有了本文的内容。 开源地址: https://github.com/cyq1162/Taurus.MVC 1、WebAPI 文档集成测试功能(增强说明) 开启WebAPI文档:web.config 或 appsettings.json 设置:"IsStartDoc": true 即可通过/doc访问自动生成的WebAPI文档 1、过滤掉无描述的接口。 文档自动生成的来源来自项目中的Xml文档注释 为了能更好的控制显示的结果,不带注释的类或方法(只收录public),不会被收录显示。 2、参数的显示与执行测试说明 自动和成的参数,来自以下方法的注释: /// <summary> /// 获取Token /// </summary> /// /// <param name="un" required="true" value="13488889999">用户名</param> /// <param name="pwd" type="header">密码</param> /// <param name="upload" type="file">图片上传</param> /// <returns>{success:true:msg:"tokenString...

How to expose AdWords to JavaScript via ClearScript?

一世执手 提交于 2019-12-25 08:58:04
问题 Context: VS2015 Community; C#; ClearScript.V8.5.4.5; Google.AdWords.18.25.0 I'm trying to create a scripting environment to do my Budgets. One the C# side, I'm setting up a JScript environment, and exposing all the AdWords types and objects that I need to it, viz static JScriptEngine JSengine = null; static Dictionary<string, object> Settings = new Dictionary<string, object>(); static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("engine script.js"); Environment.Exit(1);

Loading the TypeScript compiler into ClearScript, “WScript is undefined”, impossible task?

二次信任 提交于 2019-12-21 04:29:30
问题 I tried using ClearScript to load the TypeScript compiler in order to compile some basic TypeScript code. Unfortunately, when executing the TypeScript compiler source I get this error: 'WScript' is undefined This is the LINQPad program I've used, place the ClearScript dll's and the TypeScript compiler file alongside the .linq program: void Main() { using (var js = new Microsoft.ClearScript.Windows.JScriptEngine(Microsoft.ClearScript.Windows.WindowsScriptEngineFlags.DisableSourceManagement)) {

Missing ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll in C# ConsoleApp

牧云@^-^@ 提交于 2019-12-05 01:45:33
问题 I want to run a simple clearscript program. For this i created a new ConsoleProject and added the reference via nuget. When creating the Engine (first line of code) using (var engine = new V8ScriptEngine()) i get System.TypeLoadException was unhandled _HResult=-2146233054 _message=Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll I Only found the dlls: v8-ia32.dll, v8-x64

Missing ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll in C# ConsoleApp

随声附和 提交于 2019-12-03 16:06:45
I want to run a simple clearscript program. For this i created a new ConsoleProject and added the reference via nuget. When creating the Engine (first line of code) using (var engine = new V8ScriptEngine()) i get System.TypeLoadException was unhandled _HResult=-2146233054 _message=Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll I Only found the dlls: v8-ia32.dll, v8-x64.dll but not any ClearscriptV8-*.dll I copied them to the compile output but that didn't change any when

Loading the TypeScript compiler into ClearScript, “WScript is undefined”, impossible task?

*爱你&永不变心* 提交于 2019-12-03 14:39:06
I tried using ClearScript to load the TypeScript compiler in order to compile some basic TypeScript code. Unfortunately, when executing the TypeScript compiler source I get this error: 'WScript' is undefined This is the LINQPad program I've used, place the ClearScript dll's and the TypeScript compiler file alongside the .linq program: void Main() { using (var js = new Microsoft.ClearScript.Windows.JScriptEngine(Microsoft.ClearScript.Windows.WindowsScriptEngineFlags.DisableSourceManagement)) { var typeScriptSource = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath),

Clearscript files cannot be found on host

好久不见. 提交于 2019-11-30 06:47:05
问题 Like a lot of others I'm receiving the following error when deploying my ASP.Net MVC application: Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll Clearscript was installed as part of an effort to transform less files on the fly for page requests. I have tested my application locally in ISS Express and ISS without a hitch. As suggested here http://clearscript3.rssing.com

Clearscript files cannot be found on host

不羁的心 提交于 2019-11-28 21:16:23
Like a lot of others I'm receiving the following error when deploying my ASP.Net MVC application: Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll Clearscript was installed as part of an effort to transform less files on the fly for page requests. I have tested my application locally in ISS Express and ISS without a hitch. As suggested here http://clearscript3.rssing.com/chan-14849437/all_p12.html I've also included the missing code libraries as resources to my project.