问题标签 [jurassic]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - Execute function with complex parameters
For a not relevant reason for this question, i need to call a javascript function, defined inside a js file, from a .net desktop application and get the result.
I'm using Jurassic to do this. However i don't know how to call functions which recieve complex types. Is more simple to explain using an example.
I have this js file
Then, for call this function on .net, i use this code:
At this point suma = 5. However if the definition of plus function was
How should i call plus function to get the same result?
javascript - 无法加载类型“System.Runtime.Serialization.ISerializable”
当我尝试Jurassic.ScriptEngine
在我的 WinPhone 8.1 项目中使用时出现此错误。
整个错误信息:
我能做些什么来解决这个问题?
asp.net - ASP.NET Web API 返回 C# 类
在 Web API Controller 中,操作方法返回 C# 类,如下所示:
Cell 是我的类,继承自 Jurassic JS 库的 ObjectInstance。当我调用此操作时,ASP.NET 尝试将我的对象序列化为 XML 或 JSON,我得到System.InvalidOperationException
:“'ObjectContent`1' 类型无法序列化内容类型'application/xml; charset=utf-8 ’。” 我还尝试将 [DataContract] 属性添加到类中,正如我在此处找到的那样,如下所示:
但我仍然得到错误。如何使操作只返回我的序列化类字段,而不是进入父类?
javascript - In Jurassic, how do I limit script running time?
I am implementing Jurassic script engine, how do I limit how long a script will take?
javascript - 使用修改 html 的侏罗纪 js 代码进行评估
我正在尝试重新实现在 c# 应用程序中获取验证码。有问题,因为没有JS经验。
GET-request 返回数据,其中包含验证码 src 标签,默认为空。
它还返回一些填充验证码的 javascript,如下所示:
我在 c# 应用程序中的步骤:
- 通过WebClient和JavaScriptSerializer加载带有数据和脚本的 json 。完毕。结果存储在 jsonobject answer中,其中answer.data包含 html 和answer.e - 要执行的脚本。
尝试通过侏罗纪执行加载的脚本:
失败:ReferenceError: window is not defined。
如果取消注释第 3 行engine.SetGlobalValue("window", answer.data)
,则会出现另一个错误:TypeError: undefined cannot be convert to an object。
javascript - 是否可以将 .NET 对象公开给具有返回 IEnumerable 的方法的 JavaScript?
我正在尝试创建一个将通过侏罗纪 JavaScript 引擎向 JavaScript 公开的 .NET 类。该类表示一个 HTTP 响应对象。由于 HTTP 响应可能有多个具有相同名称的标头,因此我想包含一个方法,该方法返回具有特定名称的标头的 IEnumerable。
这是我到目前为止所拥有的:
当我测试 getHeaders 方法时,我得到一个 JavascriptException:Unsupported type: System.Collections.Generic.IList'1[System.String]
我尝试将 getHeaders 方法的返回类型从 IList 更改为 string[],并将可选的 IsEnumerable 属性添加到装饰该方法的 JSFunction 属性中。两者都没有改变,我仍然看到同样的例外。
有没有办法从暴露给 JavaScript 的 .NET 类中的方法返回 IEnumerable?
c# - C# 从匿名 json 创建类型化对象
在我的代码中,我发出一个 Web 请求并接收回 html,我使用 Jurassic Engine 将该数据映射到一个字符串化的 JSON 对象。
我有一个与响应 JSON 匹配的模型,但我不确定如何将 JSON 结果中的值设置为该类型的变量。
如何将 json 数据响应转换为 MyType 的类型变量?抱歉,如果这很明显,我是 C# 新手。
谢谢!
c# - 是否可以使用侏罗纪从 C# 调用铯函数
Cesium,javascript 地球查看器,具有实用功能,可用于在创建 czml 对象时操作数据。在 C# 中创建 czml 以将其流式传输到 cesium 时,能够调用其中一些实用程序函数会很方便。我曾尝试使用侏罗纪来做到这一点,但并没有走得太远。这是我所拥有的:
然而,这并没有超过对 Cesium 的第一次调用。我确实得到了以下 JavaScriptExceptionsExecuteFile(@"Cesium.js")
但执行仍在继续,所以我不知道问题是否在于加载 Cesium.js 脚本:
TypeError:未定义无法转换为对象
TypeError:null 不能转换为对象
ReferenceError:未定义 XMLHttpRequest
ReferenceError:未定义 Blob
加载 Cesium.js 脚本后,第一次调用 Cesium 会engine.Evaluate()
崩溃:
ReferenceError:未定义铯
python - API 调用失败 - 如何处理侏罗纪 API 的“错误 400”?
在为侏罗纪设置 API 调用(从https://studio.ai21.com/docs/api/请求)时,我总是收到 400 错误响应。
输出:<响应 [400]>
有人可以给我一些建议吗?先感谢您。