Webview Lifecycle

There are different Java Script Methods that you can add to your HTML, which will automatically be called during the life time of the webview:

<html>
<head>
<script>

/* This is called after the webview content has loaded*/
function BTTInitialize() {

}

/* This is called before the webview exits and destroys its content*/
function BTTWillCloseWindow() {

}

/* This is called before the webview hides*/
function BTTWillHideWindow() {

}

/* This is called when the webview becomes visible*/
function BTTWindowWillBecomeVisible() {

}

/* This is called when a script variable in BTT changes. */
function BTTNotification(note) {
   let data = JSON.parse(note);
   console.log(data.note, data.name);

   // example to get the currently active app:
   if(data.name == 'BTTActiveAppBundleIdentifier') {
      let data = JSON.parse(note);
      let bundleIdentifier = callBTT('get_string_variable', {variable_name: 'BTTActiveAppBundleIdentifier'});
      console.log(data.note, data.name, bundleIdentifier);
   }

}

</script>
</head>
<body>
</body>
</html>

results matching ""

    No results matching ""