@@ -86,6 +86,9 @@ namespace CefSharp
8686                }
8787            }
8888        }
89+ 
90+         _jsBindingPropertyName = extraInfo->GetString (" JsBindingPropertyName"  );
91+         _jsBindingPropertyNameCamelCase = extraInfo->GetString (" JsBindingPropertyNameCamelCase"  );
8992    }
9093
9194    void  CefAppUnmanagedWrapper::OnBrowserDestroyed (CefRefPtr<CefBrowser> browser)
@@ -123,13 +126,6 @@ namespace CefSharp
123126        auto  global = context->GetGlobal ();
124127        auto  browserWrapper = FindBrowserWrapper (browser->GetIdentifier ());
125128
126-         auto  cefSharpObj = CefV8Value::CreateObject (NULL , NULL );
127-         global->SetValue (" CefSharp"  , cefSharpObj, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
128- 
129-         // We'll support both CefSharp and cefSharp, for those who prefer the JS style
130-         auto  cefSharpObjCamelCase = CefV8Value::CreateObject (NULL , NULL );
131-         global->SetValue (" cefSharp"  , cefSharpObjCamelCase, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
132- 
133129        // TODO: JSB: Split functions into their own classes
134130        // Browser wrapper is only used for BindObjectAsync
135131        auto  bindObjAsyncFunction = CefV8Value::CreateFunction (kBindObjectAsync , new  BindObjectAsyncHandler (_registerBoundObjectRegistry, _javascriptObjects, browserWrapper));
@@ -138,11 +134,21 @@ namespace CefSharp
138134        auto  isObjectCachedFunction = CefV8Value::CreateFunction (kIsObjectCached , new  RegisterBoundObjectHandler (_javascriptObjects));
139135        auto  postMessageFunction = CefV8Value::CreateFunction (kPostMessage , new  JavascriptPostMessageHandler (rootObject == nullptr  ? nullptr  : rootObject->CallbackRegistry ));
140136
141-         cefSharpObj->SetValue (kBindObjectAsync , bindObjAsyncFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
142-         cefSharpObj->SetValue (kDeleteBoundObject , unBindObjFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
143-         cefSharpObj->SetValue (kRemoveObjectFromCache , removeObjectFromCacheFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
144-         cefSharpObj->SetValue (kIsObjectCached , isObjectCachedFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
145-         cefSharpObj->SetValue (kPostMessage , postMessageFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
137+         if  (!_jsBindingPropertyName.empty ())
138+         {
139+             auto  cefSharpObj = CefV8Value::CreateObject (NULL , NULL );
140+             global->SetValue (_jsBindingPropertyName, cefSharpObj, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
141+ 
142+             cefSharpObj->SetValue (kBindObjectAsync , bindObjAsyncFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
143+             cefSharpObj->SetValue (kDeleteBoundObject , unBindObjFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
144+             cefSharpObj->SetValue (kRemoveObjectFromCache , removeObjectFromCacheFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
145+             cefSharpObj->SetValue (kIsObjectCached , isObjectCachedFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
146+             cefSharpObj->SetValue (kPostMessage , postMessageFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
147+         }
148+ 
149+         // We'll support both CefSharp and cefSharp, for those who prefer the JS style
150+         auto  cefSharpObjCamelCase = CefV8Value::CreateObject (NULL , NULL );
151+         global->SetValue (_jsBindingPropertyNameCamelCase, cefSharpObjCamelCase, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_READONLY);
146152
147153        cefSharpObjCamelCase->SetValue (kBindObjectAsyncCamelCase , bindObjAsyncFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
148154        cefSharpObjCamelCase->SetValue (kDeleteBoundObjectCamelCase , unBindObjFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
0 commit comments