Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. IIFE support in QML
Qt 6.12 LTS is out! See what's new in the release blog

IIFE support in QML

Scheduled Pinned Locked Moved Solved Mobile and Embedded
3 Posts 1 Posters 1.8k 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.
  • N Offline
    N Offline
    n8behavior
    wrote on last edited by n8behavior
    #1

    Re: BaaS JavaScript API

    Is there away to use immediately invoked function expressions (IIFE) in QML? The post above doesn't actual ever resolve the question. There seems to be confusions where some people think IIFE is part of the DOM spec and not the ECMA spec...my read is it is part of ECMA therefor should be doable in QML. See http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/#question-about-surrounding-parentheses

    Anyway, I'm trying to make sense of this and wondering if anyone has had any luck getting FEs to work in Qt Quick?

    Thanks!

    1 Reply Last reply
    0
    • N Offline
      N Offline
      n8behavior
      wrote on last edited by n8behavior
      #3

      Okay, found the issue. I'll just leave this in case someone else is interested...probably not :)

      I was trying to use atomic.js for XHR 'cause is so nice and simple. https://github.com/cferdinandi/atomic

      Any way, being a JS n00b I missed that when I import it as

      .import "atomic.js" as Atomic
      

      I needed to call it as

      Atomic.atomic.get("/blah");
      

      ...so not the best naming choice by me but...it works!

      1 Reply Last reply
      0
      • N Offline
        N Offline
        n8behavior
        wrote on last edited by
        #2

        I've just tried this code

        (function(){ console.debug("In a FE") }());
        

        And though QtCreator screams about it, it does work. And if I put this into to say fe.js and add

        .import "fe.js" as FE
        

        to my imports, the console.debug does fire on component load as you would expect.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          n8behavior
          wrote on last edited by n8behavior
          #3

          Okay, found the issue. I'll just leave this in case someone else is interested...probably not :)

          I was trying to use atomic.js for XHR 'cause is so nice and simple. https://github.com/cferdinandi/atomic

          Any way, being a JS n00b I missed that when I import it as

          .import "atomic.js" as Atomic
          

          I needed to call it as

          Atomic.atomic.get("/blah");
          

          ...so not the best naming choice by me but...it works!

          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
          • Unsolved