コード例 #1
0
        public bool IsInstanceOfConstructor(JSObject constructor)
        {
            var exception = IntPtr.Zero;
            var result    = JSValueIsInstanceOfConstructor(Context.Raw, Raw, constructor.Raw, ref exception);

            JSException.Proxy(Context, exception);
            return(result);
        }
コード例 #2
0
        public bool IsEqual(JSValue value)
        {
            var exception = IntPtr.Zero;
            var result    = JSValueIsEqual(Context.Raw, Raw, value.Raw, ref exception);

            JSException.Proxy(Context, exception);
            return(result);
        }
コード例 #3
0
        public string ToJsonString(uint indent)
        {
            var exception = IntPtr.Zero;
            var result    = JSString.ToStringAndRelease(JSValueCreateJSONString(Context.Raw,
                                                                                Raw, indent, ref exception));

            JSException.Proxy(Context, exception);
            return(result);
        }
コード例 #4
0
        public JSValue EvaluateScript(JSString script, JSObject thisObject,
                                      JSString sourceUrl, int startingLineNumber)
        {
            var exception = IntPtr.Zero;
            var result    = JSEvaluateScript(Raw, script,
                                             thisObject == null ? IntPtr.Zero : thisObject.Raw,
                                             sourceUrl, startingLineNumber, ref exception);

            JSException.Proxy(this, exception);
            return(new JSValue(this, result));
        }
コード例 #5
0
        public void SetProperty(string propertyName, JSValue value, JSPropertyAttribute attributes)
        {
            var exception = IntPtr.Zero;
            var property  = JSString.New(propertyName);

            try {
                JSObjectSetProperty(Context.Raw, Raw, property, value.Raw, attributes, ref exception);
                JSException.Proxy(Context, exception);
            } finally {
                property.Release();
            }
        }
コード例 #6
0
        public bool DeleteProperty(string propertyName)
        {
            var exception = IntPtr.Zero;
            var property  = JSString.New(propertyName);

            try {
                var result = JSObjectDeleteProperty(Context.Raw, Raw, property, ref exception);
                JSException.Proxy(Context, exception);
                return(result);
            } finally {
                property.Release();
            }
        }
コード例 #7
0
        public JSValue GetProperty(string propertyName)
        {
            var exception = IntPtr.Zero;
            var property  = JSString.New(propertyName);

            try {
                var result = JSObjectGetProperty(Context.Raw, Raw, property, ref exception);
                JSException.Proxy(Context, exception);
                return(new JSValue(Context, result));
            } finally {
                property.Release();
            }
        }
コード例 #8
0
        public JSError(JSContext context, string name, string message) : base(context, IntPtr.Zero)
        {
            var exception = IntPtr.Zero;

            Raw = JSObjectMakeError(context.Raw, IntPtr.Zero, IntPtr.Zero, ref exception);
            JSException.Proxy(context, exception);

            if (name != null)
            {
                SetProperty("name", new JSValue(context, name));
            }

            if (message != null)
            {
                SetProperty("message", new JSValue(context, message));
            }
        }
コード例 #9
0
        public JSValue CallAsFunction(JSObject thisObject, JSValue [] args)
        {
            var exception   = IntPtr.Zero;
            var args_native = new IntPtr[args.Length];

            for (int i = 0; i < args.Length; i++)
            {
                args_native[i] = args[i].Raw;
            }

            var result = new JSValue(Context.Raw, JSObjectCallAsFunction(Context.Raw, Raw,
                                                                         thisObject == null ? IntPtr.Zero : thisObject.Raw, new IntPtr(args.Length),
                                                                         args_native, ref exception));

            JSException.Proxy(Context, exception);

            return(result);
        }