/// <summary> /// Create a new <see cref="CefV8Value"/> object of type function.<para/> /// This function should only be called from within the scope of a /// <see cref="CefRenderProcessHandler"/>, <see cref="CefV8Handler"/> or /// <see cref="CefV8Accessor"/> callback, or in combination with calling /// <see cref="CefV8Context.Enter"/> and <see cref="CefV8Context.Exit"/> /// on a stored <see cref="CefV8Context"/> reference. /// </summary> /// <returns>Returns a new <see cref="CefV8Value"/> object of type function.</returns> public static CefV8Value CreateFunction(string name, CefV8Handler handler) { if (handler == null) { throw new ArgumentNullException(nameof(handler)); fixed(char *s = name) { var aName = new cef_string_t { Str = s, Length = (name != null ? name.Length : 0) }; return(new CefV8Value(CefNativeApi.cef_v8value_create_function(&aName, handler.GetNativeInstance()))); } }
/// <summary> /// Returns the function handler or NULL if not a CEF-created function. /// </summary> public unsafe virtual CefV8Handler GetFunctionHandler() { return(SafeCall(CefV8Handler.Wrap(CefV8Handler.Create, NativeInstance->GetFunctionHandler()))); }