public RetValue(mbWebView mbWebView, IntPtr param, mbJsExecState mbJsExecState, mbJsValue mbJsValue) { WebView = mbWebView; ValueType = NativeMethods.mbGetJsValueType(mbJsExecState, mbJsValue); switch (ValueType) { default: case mbJsType.kMbJsTypeUndefined: case mbJsType.kMbJsTypeNull: Result = null; break; case mbJsType.kMbJsTypeNumber: Result = NativeMethods.mbJsToDouble(mbJsExecState, mbJsValue); break; case mbJsType.kMbJsTypeBool: Result = NativeMethods.mbJsToBoolean(mbJsExecState, mbJsValue); break; case mbJsType.kMbJsTypeString: Result = NativeMethods.mbJsToString(mbJsExecState, mbJsValue); break; } }
internal static void RunJsCallback(mbWebView webview, IntPtr token, mbJsExecState es, mbJsValue v) { RetValue retValue = new RetValue(webview, token, es, v); if (s_runJsCallbackDict.TryRemove(token, out TaskCompletionSource <RetValue> taskCompletionSource)) { taskCompletionSource.SetResult(retValue); } }
public extern static bool mbJsToBoolean(mbJsExecState es, mbJsValue v);
public extern static utf8 mbJsToString(mbJsExecState es, mbJsValue v);
public extern static double mbJsToDouble(mbJsExecState es, mbJsValue v);