IIFE support in QML
-
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!
-
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!
-
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.
-
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!