Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

[SOLVED]"TypeError: Object [object Object] has no method" when using function from imported Javascript file

$
0
0
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.

Viewing all articles
Browse latest Browse all 4972

Trending Articles