本文整理汇总了C#中Jint.Native.JsObject.DefineOwnProperty方法的典型用法代码示例。如果您正苦于以下问题:C# JsObject.DefineOwnProperty方法的具体用法?C# JsObject.DefineOwnProperty怎么用?C# JsObject.DefineOwnProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jint.Native.JsObject
的用法示例。
在下文中一共展示了JsObject.DefineOwnProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitPrototype
public override void InitPrototype(IGlobal global)
{
Prototype = new JsObject() { Prototype = global.FunctionClass.Prototype };
Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsDictionaryObject>(ToString2), PropertyAttributes.DontEnum);
}
示例2: New
/// <summary>
/// Creates new JsObject, sets a [[Prototype]] to the Prototype parameter and a 'constructor' property to the specified function.
/// </summary>
/// <param name="constructor">JsFunction which is used as a constructor</param>
/// <param name="Prototype">JsObjetc which is used as a prototype</param>
/// <returns>new object</returns>
public JsObject New(JsFunction constructor, JsObject Prototype)
{
JsObject obj = new JsObject(Prototype);
obj.DefineOwnProperty(new ValueDescriptor(obj, CONSTRUCTOR, constructor) { Enumerable = false });
return obj;
}
示例3: InitPrototype
public override void InitPrototype(IGlobal global)
{
Prototype = new JsObject() { Prototype = global.FunctionClass.Prototype };
Prototype.DefineOwnProperty("constructor", this, PropertyAttributes.DontEnum);
#region Methods
Prototype.DefineOwnProperty("toString", global.FunctionClass.New<JsArray>(ToStringImpl), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("toLocaleString", global.FunctionClass.New<JsArray>(ToLocaleStringImpl), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("concat", global.FunctionClass.New<JsObject>(Concat), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("join", global.FunctionClass.New<JsObject>(Join, 1), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("pop", global.FunctionClass.New<JsObject>(Pop), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("push", global.FunctionClass.New<JsObject>(Push, 1), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("reverse", global.FunctionClass.New<JsObject>(Reverse), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("shift", global.FunctionClass.New<JsObject>(Shift), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("slice", global.FunctionClass.New<JsObject>(Slice, 2), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("sort", global.FunctionClass.New<JsObject>(Sort), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("splice", global.FunctionClass.New<JsObject>(Splice, 2), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("unshift", global.FunctionClass.New<JsObject>(UnShift, 1), PropertyAttributes.DontEnum);
#region ES5
Prototype.DefineOwnProperty("indexOf", global.FunctionClass.New<JsObject>(IndexOfImpl, 1), PropertyAttributes.DontEnum);
Prototype.DefineOwnProperty("lastIndexOf", global.FunctionClass.New<JsObject>(LastIndexOfImpl, 1), PropertyAttributes.DontEnum);
#endregion
#endregion
}