// Copyright © 2020 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Threading.Tasks; namespace CefSharp.ModelBinding { /// /// Provides the capability intercept async/sync Net method calls made from javascript as part of the /// JavascriptBinding (JSB) implementation. One example use case is logging method calls. /// Extends to add async support. /// public interface IAsyncMethodInterceptor : IMethodInterceptor { /// /// Called before an async method is invoked. You are now responsible for evaluating /// the function and returning the result. Only methods that return a /// will call this method, other non asynchronous types will call /// . /// (async void method will also call Intercept as they do not return a Task). /// /// A Func that represents the method to be called /// paramaters to be passed to /// Name of the method to be called /// A Task representing the method result /// /// Task<object> IAsyncMethodInterceptor.InterceptAsync(Func<object[], object> method, object[] parameters, string methodName) /// { /// object result = method(parameters); /// Debug.WriteLine("Called " + methodName); /// return result; /// } /// Task InterceptAsync(Func method, object[] parameters, string methodName); } }