<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Browser Control RegisterJSObject window.external.notify in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Browser-Control-RegisterJSObject-window-external-notify/m-p/307112#M1757</link>
    <description>&lt;P&gt;I'm using the Archicad browser control with the "Browser_Control" example. The example project works as intended and javascript can communicate to the browser control through the registered javascript objects from the example ("GetSelectedElements", "AddElementToSelection" and "RemoveElementFromSelection"). Now I have changed the javascript page from the example, to my own webpage that utilizes "window.external.notify" and I want to register a javascript object, so that I can hook up on this event/method. I have issues with this part and can't seem to subscribe or bind to this "external" object. In the example project I have tried to add and register this javascript object in the method "BrowserPallette::RegisterACAPIJavaScriptObject".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void BrowserPalette::RegisterACAPIJavaScriptObject ()
{
DG::JSObject* jsACAPI = new DG::JSObject ("external");
jsACAPI-&amp;gt;AddItem(new DG::JSFunction("notify", [](GS::Ref&amp;lt;DG::JSBase&amp;gt; param) {
Authentication(GetStringFromJavaScriptVariable(param)); // my own method that I want javascript to trigger.
return ConvertToJavaScriptVariable (true);
}));
browser.RegisterAsynchJSObject(jsACAPI);
}

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone tried something similar or maybe have some good ideas I can try? I haven't tried using a CEF browser before so I'm not at all experienced in communicating from javascript to the Archicad browser control. I might be missing something obvious like defining my javascript object wrong, that I want to register with "RegisterAsynchJSObject".&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Sep 2021 12:36:22 GMT</pubDate>
    <dc:creator>gunners6522</dc:creator>
    <dc:date>2021-09-26T12:36:22Z</dc:date>
    <item>
      <title>Browser Control RegisterJSObject window.external.notify</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Browser-Control-RegisterJSObject-window-external-notify/m-p/307112#M1757</link>
      <description>&lt;P&gt;I'm using the Archicad browser control with the "Browser_Control" example. The example project works as intended and javascript can communicate to the browser control through the registered javascript objects from the example ("GetSelectedElements", "AddElementToSelection" and "RemoveElementFromSelection"). Now I have changed the javascript page from the example, to my own webpage that utilizes "window.external.notify" and I want to register a javascript object, so that I can hook up on this event/method. I have issues with this part and can't seem to subscribe or bind to this "external" object. In the example project I have tried to add and register this javascript object in the method "BrowserPallette::RegisterACAPIJavaScriptObject".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void BrowserPalette::RegisterACAPIJavaScriptObject ()
{
DG::JSObject* jsACAPI = new DG::JSObject ("external");
jsACAPI-&amp;gt;AddItem(new DG::JSFunction("notify", [](GS::Ref&amp;lt;DG::JSBase&amp;gt; param) {
Authentication(GetStringFromJavaScriptVariable(param)); // my own method that I want javascript to trigger.
return ConvertToJavaScriptVariable (true);
}));
browser.RegisterAsynchJSObject(jsACAPI);
}

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has anyone tried something similar or maybe have some good ideas I can try? I haven't tried using a CEF browser before so I'm not at all experienced in communicating from javascript to the Archicad browser control. I might be missing something obvious like defining my javascript object wrong, that I want to register with "RegisterAsynchJSObject".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2021 12:36:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Browser-Control-RegisterJSObject-window-external-notify/m-p/307112#M1757</guid>
      <dc:creator>gunners6522</dc:creator>
      <dc:date>2021-09-26T12:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Browser Control RegisterJSObject window.external.notify</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Browser-Control-RegisterJSObject-window-external-notify/m-p/307893#M1758</link>
      <description>&lt;P&gt;Managed to subscribe to window.external.notify this way, if anyone should be interested:&lt;/P&gt;&lt;P&gt;- Changing the name of jsACAPI from "external" to "aarchicad" (could be anything)&lt;/P&gt;&lt;P&gt;- browser.RegisterAsynchJSObject(jsACAPI)&lt;/P&gt;&lt;P&gt;- browser.ExecuteJS(GS::UniString("window.external.notify = aarchicad.notify;"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when the webpage calls window.external.notify, the browser gets notified and the function aarchicad.notify gets triggered.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 06:55:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Browser-Control-RegisterJSObject-window-external-notify/m-p/307893#M1758</guid>
      <dc:creator>gunners6522</dc:creator>
      <dc:date>2021-09-30T06:55:47Z</dc:date>
    </item>
  </channel>
</rss>

