vendredi 30 janvier 2015

JS.Prototype.Cannot read property 'apply' of undefined

Trying to make little module for searching some stuff.



function SearchModule() {
this.softName = "",
this.userLogin = undefined,
this.init.apply(this, arguments);
}

SearchModule.prototype = {
init: function (softname, userlogin) {
this.softName = softname;
this.userLogin = userlogin;
},
clearField: function () {
//whatever
},
searchData:function(args){
//whatever
}

}


When I try to call it I get an error



Uncaught TypeError: Cannot read property 'apply' of undefined



I use it like this



var searchObject;
function searchTestPart1() {
searchObject = SearchModule("PPC", usermail);
searchObject.getSearchData("Test");

}


Whats wrong? P.S. Maybe I making some silly mistake, sorry. But for some reason I don't understand what's wrong here





Aucun commentaire:

Enregistrer un commentaire