This is quite frustrating, because from what I understand this should work just fine. So, here’s a little example of what I’m doing:
my Qml file:
import "js/functions.js" as Funct
// This item is only used to run javascript
Item {
Component.onCompleted: Funct.myFunction();
}
my functions.js file:
function myFunction() {
//Do stuff here
}
But when I run it, it throws the error: TypeError: Object [object Object] has no method ‘myFunction’
If anyone can think of anything that could possibly cause something so simple to not work, please do tell.
↧