Hi René,
> In JS libs before 5.12, I've always used a closure approach to not
> leak a bunch of private variables onto the global module object. This
> results in a layout much like so:
>
> (function(lib) {
> ... closed vars can be declared here ...
>
> lib.bar = function() {
> return "baz";
> };
> })(this);
You can still pass an empty object to your anonymous function and
extract the interesting bits of that into the JS file's global scope
afterwards. Or you can declare a number of vars outside the anonymous
function and assign functions to them from inside. Both options are
indeed a bit uglier, though.
This looks like a regression in Qt 5.12, but I will need to take a
closer look at it. Did we ever document anything about the semantics of
the "this" object in JavaScript libraries?
best regards,
Ulf
_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest