You can manipulate the data objects in runtime by calling methods. To get access use data for default or data.name to access a named connection using;

List of methods

addflag None Add a flagg to be used as a default when doing request. Can have values:
HTTPS | for setting the request to be sent over https
NO CACHE | will not send cached version from a proxy. Also add header for cache control
NO ESCAPE | URL is not escaped with %code for illegal characters
NO ESCAPE QUERY | query part of url not esacaped with %code for illegal characters
DO ESCAPE | all part of the url exept % will be converted to %code when a illegal char is encountered
checksession json with requestid Checks if the session already are logged in to the server. This can survive restarts of super browser by storing session id in the browser cache and reuse on later starts. If the session have not timed out on the server, you are still logged in like we are used to in a web browser.
delete json with requestid A request with a path and a delete verb and no data.
deleterecord json with requestid A request to delete a record in the table. Parameters is table, query and recno. Returns a json string with result and requestid used to pick up the response message.
generatesessioncookie None Generate a 32 char long session id that we can use with connection to the server
get json with requestid A general get request with path as parameter. The requestid returned will identify the message received by the browser object from where this command is run.
getflags int Retrun the value of all flags sent to request
getlogeventsonrequest bool Return the default set on data object if a log should be run on event and returned together with the data. It will be returned as a array named log when data is sent as a message to the browser doing the request.
getrecord json with requestid A request with table name, query and record number as parameters. The requestid returned will identify the message received by the browser object from where this command is run.
getrecords json with requestid A request with table name, query and record number from and to as parameters. The requestid returned will identify the message received by the browser object from where this command is run.
getreturnheadersonrequest bool Tell if the message will hold header information or not
getsessioncookie string The session cookie set in the data object
isloggedin bool If user has run the logged in command with success or a get session with a already logged in user
login json with requestid Do a login to the userver with stored user name and password
newrecord json with requestid A request with table name and data as string as parameters. The requestid returned will identify the message received by the browser object from where this command is run.
post json with requestid A request with a path, data and a post verb.
put json with requestid A request with a path, data and a put verb
removeflag None Remove a flag set earlier. Can have values:
HTTPS | for setting the request to be sent over https
NO CACHE | will not send cached version from a proxy. Also add header for cache control
NO ESCAPE | URL is not escaped with %code for illegal characters
NO ESCAPE QUERY | query part of url not esacaped with %code for illegal characters
DO ESCAPE | all part of the url exept % will be converted to %code when a illegal char is encountered
setflag None Set a int value with all flags that are supported by WinHttp request
setlogeventsonrequest None Set if a request should log it's events run when calling the server. Default is false. This can be used do debug problems with a server connection to see where it failed. The log will de delivered together with the data as a array named log.
setreturnheadersonrequest None Set if we are to reurn header infromation with all subsequent requests
setsessioncookie None Set the session id to use with subsequent requests.
setusernameandpassword None Set the username and password to be used for logging into the server defined. These can also be set by the definition, but if you want the users to supply their own, this can be used instead.
updaterecord json with requestid A request with table name, query, record number as int and data as string as parameters. The requestid returned will identify the message received by the browser object from where this command is run.

The method list. Proper documentation and examples found in individual documents.

Example of use

As the examples below show, it can be a lot of work using the api via the call object. We recommend that the 2imply.js library are used as that will remove much of the boiler plate code needed for each call. It will also give easy to use objects that hide the async message api for the user.

chrome.webview.hostObjects.sync.debobject.RunCommandOnWithStrRetNone('methodname','data','{["param1", "param2"]}')

All calls that set and get value on the data object can be run synchronously, but all methods involving sending and receiving data to the server will only return the requestid when called and data will be supplied as a message to the browser object that sent the request.

let _toprocess = {}; // this will hold all messages we wait for
const defaultmessageHandler = function(event) {
  let jdata = JSON.parse(event.data);
  if ('requestid' in jdata){
    let cmd = _toprocess[jdata.requestid];
    if (cmd && 'cmd' in cmd){
      if ('setdata' in cmd){
        jdata['cmd'] = cmd.cmd;
        cmd.setdata(jdata);
      } else if ('resolve' in cmd){
        jdata['cmd'] = cmd.cmd;
        cmd.resolve(jdata);
      }
      delete _toprocess[jdata.requestid];
    }
  }
}
window.chrome.webview.addEventListener('message', defaultmessageHandler);

function showloginresult(jdata){
  if (jdata.data.isloggedin)
    $("#message").html("Logged in");
  else
     $("#message").html("Failed to login");
}

let un = $("#username").val();
let pw = $("#password").val();
chrome.webview.hostObjects.sync.debobject.RunCommandOnWithStrRetNone('setusernameandpassword','data', JSON.stringify([un,pw]));
lastresult = chrome.webview.hostObjects.sync.debobject.RunCommandOnWithStrRetStr('login', "data");
if (lastresult && 'requestid' in this.lastresult) 
  _toprocess[this.lastresult.requestid] = {"cmd" : "login", 'setdata' : showloginresult};

How the data flows when calling a method involving the asynchronous call to the server.