Adobe Dreamweaver API Reference CS5 User Manual
Page 372

367
DREAMWEAVER API REFERENCE
Dynamic documents
Last updated 8/27/2013
Dreamweaver 13.1 and later
function OnMMBrowserCtrlLoaded(e)
{
liveViewWindow = cefBrowser.getWindow();
liveViewWindow.initDefaults();
}
function Init_MM_browsercontrol()
{
var cefBrowser = document.getElementById("liveBrowser");
// Add event listener is mandatory to know when the browser is ready.
cefBrowser.addEventListener("BrowserControlLoad", OnMMBrowserCtrlLoaded,false);
cefBrowser.openURL("extention.html");
}
Passing/accessing larger objects across bridging
Passing or accessing larger objects through JS-bridge can be a performance overhead. This can also cause failures
especially when there are size limitations for copying objects across processes.The following example shows how this
can be handled:
Example:
Prior to Dreamweaver 13.1
Consider the media query dialog box.
DW code (Commands\Media Query Manager.js):
gBrowserCtrl = document.getElementById("browserCtrl");
...
...
gBrowserCtrl.getWindow().parentWindow = window; // DON'T DO THIS
In
Dreamweaver 13.1 and later
DW code:
gBrowserCtrl.getWindow().SetParentWindowOnClickGridRow( window.onClickGridRow);
mm:browsercontrol code:
function SetParentWindowOnClickGridRow(callback)
{
parentWindowOnClickGridRow = callback;
}
...
Use asynchronous calls
Since CEF3 is a multi-process, asynchronous platform, synchronous APIs are no longer available. Although
synchronous calls from Dreamweaver to Render Processes (spawned off by mm:browsercontrol) are simulated,
synchronous calls from the Render Processes are not supported.The following examples illustrate how you can change
synchronous calls to asynchronous: