javascript - Object has no method when using prototype -
i'm kind of noobie in javascript, , when try use prototypes extend object, following error code :
object function processmanager() {...} has no method 'startbrowsing'
here code. execute code in nodejs.
the code
function processmanager(){ this.browser = new browser(); this.salepagestovisit = []; this.salepagescurrent = []; this.salepagesdone = []; this.categorypagestovisit = []; this.categorypagescurrent = []; this.categorypagesdone = []; this.listpagestovisit = []; this.listpagescurrent = []; this.listpagesdone = []; } processmanager.prototype.startbrowsing = function () { winston.log('verbose', 'starting scrapping bazarchic'); } var processmanager = new processmanager(); processmanager.startbrowsing();
in code sample, you're calling startbrowsing
it's static method on constructor function processmanager
.
methods added prototype of constructor function available methods on instances. should calling startbrowsing
on instance of processmanager
:
var processmanager = new processmanager(); processmanager.startbrowsing();
Comments
Post a Comment