Overview

The P4JSAPI was built on WebKit, the Web browser engine used by Safari on macOS and iOS. The Qt framework that Helix Core Visual Client (P4V) uses moved off WebKit and adopted the Chromium browser technology, called WebEngine. The new rendering engine is better tuned for multi-processing, uses a smaller memory footprint, and has a larger development community, thus guaranteeing better support for HTML5 and newer JavaScript versions. Because QtWebKit and QtWebEngine are very different, we are adopting a new approach to implementing the API.

Communication in QtWebKit was driven by the WebKit Bridge, a framework that extends WebKit’s JavaScript environment to access Qt Objects published to the bridge. The bridge required P4V to embed WebPages by injecting JavaScript hooks into these pages. Calling P4JSAPI methods directly invoked methods in P4V. Synchronous function invocation was the default, but asynchronous coding could be facilitated.

With the new QtWebEngine integration, every request from the JavaScript environment to the host application is asynchronous. The communication in the P4VJS API implements a request/reply model where every request is implemented as a Promise and async/await calls can help the developer rewrite asynchronous code as if it were synchronous code.

These different approaches require porting of existing P4JSAPI applications. This guide explains:

  • How to port existing code, in particular the syntax of formatting requests. The P4VJS data sent and returned is fully compatible with the formatting that the P4JSAPI expects.

  • Which P4JSAPI features are not ported to P4VJS. This version of P4VJS does not introduce new features to the API, but it does simplify the hosting of pages and adds more flexibility. For details, see the P4VJS Developer Guide.