[solved] How to hide functions and values in javasript module from qml?
-
Hello there,
this might be an rather javascripty question but ...
I am writing javascript lib and I want to hide some of the stuff in there from qml. But I do not know how to or if it's even possible.
Let's say I have the following javascript file, and don't want the qml objects to access "aFunctionIdLikeToHide" or "aValueIdLikeToHide" how do I do that?
@// mylib.jsfunction someFunction() {
aValueIdLikeToHide += 1
if (aValueIdLikeToHide > 99)
sFunctionIdLikeToHide()return aValueIdLikeToHide
}function aFunctionIdLikeToHide() {
aValueIdLikeToHide = 0
}val aValueIdLikeToHide = 0
@ -
Have two separate js files:
mylib_impl.js - containing the "hidden" implementation functions
mylib.js - containing the APImylib.js should ".import "mylib_impl.js" as impl", and your qmldir file should only list mylib.js as an importable resource.
Cheers,
Chris.