Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. BaaS JavaScript API
QtWS25 Last Chance

BaaS JavaScript API

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 5 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    ben0027
    wrote on last edited by
    #1

    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.

    benlauB raven-worxR 2 Replies Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • B ben0027

        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.

        benlauB Offline
        benlauB Offline
        benlau
        Qt Champions 2016
        wrote on last edited by
        #3

        Related projects:

        grassator/qml-commonjs: Experiment in adding CommonJS support to QML.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          ben0027
          wrote on last edited by
          #4

          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 = '...';

          Backendless.initApp(APPLICATION_ID, SECRET_KEY, 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)

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leonardo
            wrote on last edited by
            #5

            I was checking its source code here

            http://api.backendless.com/sdk/js/latest/backendless.js

            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.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              ben0027
              wrote on last edited by
              #6

              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?

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JeroenDierckx
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • B ben0027

                  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.

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @ben0027
                  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"

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved