Files
cefsharp/CefSharp/ModelBinding/IPropertyInterceptor.cs
Santosh M Ghanti 9e0236876c Sync Javascript Binding - Add support for property interception (#3935)
* Core - added support for property interceptor

* Incorporated the review comments

* Incorporated the review comments 2

* Review comments exclude trygetproperty and trysetproperty for .netcore app

* Added the unit test cases for trygetproperty and trysetproperty

* Fixed .net core app build failure

* Added the separate test case for property interceptor

Co-authored-by: sghanti <santosh_ghanti@intuit.com>
2022-02-14 13:58:35 +10:00

57 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CefSharp.ModelBinding
{
/// <summary>
/// Provides the capability intercepting get/set property calls made from javascript as part of the
/// JavascriptBinding (JSB) implementation.
/// </summary>
public interface IPropertyInterceptor
{
/// <summary>
/// Called before the get property is invokved. You are now responsible for evaluating
/// the property and returning the result.
/// </summary>
/// <param name="propertyGetter">A Func that represents the property to be called</param>
/// <param name="propertName">Name of the property to be called</param>
/// <returns>The property result</returns>
/// <example>
/// <code>
/// <![CDATA[
/// public object IPropertyInterceptor.InterceptGet(Func<object> propertyGetter, string propertyName)
/// {
/// object result = propertyGetter();
/// Debug.WriteLine("InterceptGet " + propertyName);
/// return result;
/// }
/// ]]>
/// </code>
/// </example>
object InterceptGet(Func<object> propertyGetter, string propertName);
/// <summary>
/// Called before the set property is invokved. You are now responsible for evaluating
/// the property.
/// </summary>
/// <param name="propertySetter">A Func that represents the property to be called</param>
/// <param name="parameter">paramater to be set to property</param>
/// <param name="propertName">Name of the property to be called</param>
/// <example>
/// <code>
/// <![CDATA[
/// public object IPropertyInterceptor.InterceptSet(Action<object> propertySetter, object parameter, string propertName)
/// {
/// Debug.WriteLine("InterceptSet " + propertName);
/// propertySetter(parameter);
/// }
/// ]]>
/// </code>
/// </example>
void InterceptSet(Action<Object> propertySetter, object parameter, string propertName);
}
}