1

This is part of my program code.

        makeQRCode : function() {
            var URL = 'http://127.0.0.1:5000';

            this.socket = io.connect(URL + '/socket', {'force new connection': true});
            console.log(this.myMaker);  //print Maker's functions

            this.socket.on('connect', function(){
                console.log('connect');
                console.log(URL);   //print 'http://127.0.0.1:5000'
                //console.log(this.myMaker);    //how can I call myMaker In this function
            });
        }

Since 'this' in socket.io function indicate 'socket', cannot access class member. How can I access class member in there.

DK2
  • 651
  • 1
  • 7
  • 34
  • ...and just about 100 others. This post on my blog may also help [*You must remember `this`](http://blog.niftysnippets.org/2008/04/you-must-remember-this.html)*. – T.J. Crowder Jan 25 '15 at 12:38
  • I googled with uncorrect word. Thanks alot @T.J.Crowder. do I have to do something to close this question? – DK2 Jan 25 '15 at 12:56
  • Glad that helped. :-) It's already closed, but if you don't think it'll help people to find this info in the future, you can delete it. (Probably go ahead and do that, there are a *huge* number of these already.) – T.J. Crowder Jan 25 '15 at 13:09

0 Answers0