本文整理汇总了C#中JSContext类的典型用法代码示例。如果您正苦于以下问题:C# JSContext类的具体用法?C# JSContext怎么用?C# JSContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JSContext类属于命名空间,在下文中一共展示了JSContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MarkdownService
public MarkdownService()
{
_ctx = new JSContext(_vm);
var script = System.IO.File.ReadAllText("Markdown/marked.js", System.Text.Encoding.UTF8);
_ctx.EvaluateScript(script);
_val = _ctx[new NSString("marked")];
}
开发者ID:nghialv,项目名称:CodeHub,代码行数:7,代码来源:MarkdownService.cs
示例2: GlobalCode
public static JSValue GlobalCode(JSContext context)
{
context.ReturnValue = JSUndefined.Instance;
context.CreateMutableBinding("__func");
context.SetVarBinding("__func", context.GetFunctionReference(0));
context.ReturnValue = JSValue.JSEqualsExact(context.GetBindingValue("__func")["prototype"]["constructor"], context.GetBindingValue("__func"));
return context.ReturnValue;
}
开发者ID:BGCX261,项目名称:zinj-svn-to-git,代码行数:8,代码来源:MyDynamicType.cs
示例3: ConvertMarkdown
public string ConvertMarkdown(string c)
{
if (string.IsNullOrEmpty(c))
return string.Empty;
using (var vm = new JSVirtualMachine())
{
var ctx = new JSContext(vm);
var script = System.IO.File.ReadAllText("Markdown/marked.js", System.Text.Encoding.UTF8);
ctx.EvaluateScript(script);
var val = ctx[new NSString("marked")];
return val.Call(JSValue.From(c, ctx)).ToString();
}
}
开发者ID:vbassini,项目名称:CodeBucket,代码行数:14,代码来源:MarkdownService.cs
示例4: Load
public static Task<Stage> Load(string scriptName)
{
return Task.Factory.StartNew(()=>{
var script = File.ReadAllText (scriptName);
if(script.Contains("( function($, Edge, compId){"))
script = script.Replace("( function($, Edge, compId){","");
var endIndex= script.IndexOf("Edge.registerC");
if(endIndex > 0)
script = script.Substring(0,endIndex);
script += Environment.NewLine + "var js = JSON.stringify(symbols);";
var context = new JSContext();
var test = context.EvaluateScript (script);
var result = context[(NSString)"js"].ToString();
result = result.Replace("\"${_", "\"").Replace("}\"","\"");
var stage = StageParser.Parse(result);
return stage;
});
}
开发者ID:Clancey,项目名称:AdobeEdgeAnimations,代码行数:20,代码来源:StageExtensions.cs
示例5: Initialize
public void Initialize()
{
testFunctionsMock = new Mock<TestFunctions>();
Context = new JSContext();
Context.GetGlobalObject().SetProperty("simpleProperties", new SimpleProperties()
{
stringProperty = "stringPropertyValue",
intProperty = 3,
floatProperty = (float)Math.PI,
doubleProperty = GOLDEN_RATIO,
boolProperty = true,
floatsProperty = new float[] { 3.14f, 16/9 },
dictProperty = new Dictionary<object,object>() {
{"123", 2},
{"string", "hello world"}
},
nonGenericDictionary = new Dictionary<string, object>() { { "x", 1 } },
nestedProperty = testFunctionsMock.Object
});
Context.GetGlobalObject().SetProperty("testFunctions", testFunctionsMock.Object);
}
开发者ID:Ashod,项目名称:webkitdotnet,代码行数:23,代码来源:JSIntegration.cs
示例6: RenderStyle
// Constructed by JavaScript runtime only
public RenderStyle(JSContext ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:RenderStyle.cs
示例7: History
// Created by JavaScript runtime only
public History(JSContext ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:History.cs
示例8: Variable
public Variable(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:1,代码来源:Variable.cs
示例9: Font
public Font(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:1,代码来源:Font.cs
示例10: Center
public Center(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:1,代码来源:Center.cs
示例11: CreateWindowScriptObject
private void CreateWindowScriptObject(JSContext context)
{
if (ObjectForScripting != null && context != null)
{
JSObject global = context.GetGlobalObject();
JSObject window = global.GetProperty("window") as JSObject;
if (window != null)
window.SetProperty("external", (object)ObjectForScripting);
}
}
开发者ID:tsupo,项目名称:webkitdotnet,代码行数:10,代码来源:WebKitBrowserCore.cs
示例12: XmlNotation
// Constructed by JavaScript runtime only
public XmlNotation(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:XmlNotation.cs
示例13: SelectionObject
// Constructed by JavaScript runtime only
public SelectionObject(JSContext ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:SelectionObject.cs
示例14: Span
public Span(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:1,代码来源:Span.cs
示例15: DomImplementation
// Created by JavaScript runtime only
public DomImplementation(JSContext ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:DomImplementation.cs
示例16: DomAttribute
// Created by JavaScript runtime only
public DomAttribute(JSContext ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:DomAttribute.cs
示例17: Inserted
public Inserted(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:1,代码来源:Inserted.cs
示例18: XmlParseError
// Constructed by JavaScript runtime only
public XmlParseError(JSContext ctxt)
{
}
开发者ID:modulexcite,项目名称:IL2JS,代码行数:4,代码来源:XmlParseError.cs
示例19: Deleted
public Deleted(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:1,代码来源:Deleted.cs
示例20: XmlDocumentFragment
// Constructed by JavaScript runtime only
public XmlDocumentFragment(JSContext ctxt) : base(ctxt) { }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:2,代码来源:XmlDocumentFragment.cs
注:本文中的JSContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论