Ejemplo n.º 1
0
        private async void ScriptCallback(IntPtr self, IntPtr op, IntPtr notification, IntPtr message)
        {
            IntPtr body     = ObjC.Call(message, "body");
            IntPtr isString = ObjC.Call(body, "isKindOfClass:", Foundation.GetClass("NSString"));

            if (isString != IntPtr.Zero)
            {
                string data = NSString.GetString(body);
                await bridge.HandleScriptCall(data);
            }
        }
Ejemplo n.º 2
0
 private static async void ScriptCallback(CocoaWebview instance, IntPtr message)
 {
     if (instance.EnableScriptInterface)
     {
         IntPtr body     = ObjC.Call(message, "body");
         IntPtr isString = ObjC.Call(body, "isKindOfClass:", Foundation.GetClass("NSString"));
         if (isString != IntPtr.Zero)
         {
             string data = NSString.GetString(body) !;
             await instance.bridge.HandleScriptCall(data);
         }
     }
 }