Important: Please read the Qt Code of Conduct -

BaaS JavaScript API

  • Companies that are providing Backend services for Apps are usually offering their API in libraries written in Java or JavaScript or REST Api's. Can the Qt Quick JavaScript engine support such a JavaScript library file? does it work only from a browser? Some notable sites are Backendless and Firebase.

  • Hi. It's hard to say without knowing the library requirements. Qt has no support for DOM, for example. So libraries which rely on manipulating HTML would not work. But other than that I think it should work.

  • Qt Champions 2016

  • Hi,
    More specifically, the two libraries that I tried (see links in the original question) use Immediately-Invoked Function Expression IIFE (maybe To Avoid Polluting the Global Scope):

    (function() {
    // the code here is executed once in its own scope

    The problem is that I couldn't call any of the APIs from my QML file. For example with the Backendless library, the code:

    .import 'qrc:/backendless.js' as Backendless

    function init(){
    var APPLICATION_ID = '...';
    var SECRET_KEY = '...';
    var VERSION = '...';



    Fails with the message: TypeError: Property 'initApp' of object [object Object] is not a function

    (this works when called from an html file in a browser)

  • I was checking its source code here

    and you need to make some adjustments yourself. This library assumes that it's running either in a browser or in nodejs and relies on some of their features. It won't run out of the box, but it looks like one can fix it.

  • Hi Leonardo,

    Glad to hear that it's solvable, Working with a backend service for a mobile app is a must. The Qt Cloud services was a great solution and easy to use but since it's closing down then alternatives must be found. None of the other service providers offer a Qt API , working with Javascript Api's can give a big boost to developers.

    What changes do you suggest on doing? How can one call the library APIs with the Qt Javascript way of working?

  • I'm not sure if you managed to get this to work properly, but another option to use Backendless is their REST API.

    I used it, and it works very well. Most things are trivial, using QNetworkManager.

  • Moderators

    only ECMA features are supported.
    So this means only basic JavaScript. But i understand that most people imply the DOM stuff etc into the term "JavaScript"

Log in to reply