Skip to content

Commit a338369

Browse files
committed
Add IJavascriptObjectRepository.UnRegisterAll
UnRegisterAll all bound objects - does not unbind them from the JS context
1 parent 03bd81c commit a338369

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CefSharp/IJavascriptObjectRepository.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public interface IJavascriptObjectRepository : IDisposable
3535
/// and other advanced options though this class.</param>
3636
void Register(string name, object objectToBind, bool isAsync = false, BindingOptions options = null);
3737
/// <summary>
38+
/// UnRegister all the currently bound objects from the repository. If you unregister an object that is currently
39+
/// bound in JavaScript then the method/property calls will fail.
40+
/// </summary>
41+
void UnRegisterAll();
42+
/// <summary>
3843
/// UnRegister a bound object from the repository. If you unregister an object that is currently
3944
/// bound in JavaScript then the method/property calls will fail.
4045
/// </summary>

CefSharp/Internals/JavascriptObjectRepository.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ public void Register(string name, object value, bool isAsync, BindingOptions opt
160160
AnalyseObjectForBinding(jsObject, analyseMethods: true, analyseProperties: !isAsync, readPropertyValue: false, camelCaseJavascriptNames: camelCaseJavascriptNames);
161161
}
162162

163+
public void UnRegisterAll()
164+
{
165+
objects.Clear();
166+
}
167+
163168
public bool UnRegister(string name)
164169
{
165170
foreach (var kvp in objects)

0 commit comments

Comments
 (0)