Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

KrollCallback - Not available on prototype methods of CommonJS module?

$
0
0

I have a commonJS module that looks more or less like this.

function MyModule() {
    this.property = 0;
    this.myFunction = this.myFunction.bind(this);
}
 
MyModule.prototype.myFunction = function() {
    this.property = 1;  // or whatever.
};
 
module.exports = MyModule;
This results in a fatal error (bind is not a function). When I log the object on IOS I see that this.myFunction == "<KrollCallback: 0xa871a80>" Clearly this poor excuse for a function does not have a bind method. My question is, is there anyway for prototype functions in commonJS modules to just be javascript functions?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>