Results 1 to 4 of 4
  1.    #1  
    Hello, guys
    I've got new stupied question.

    I want to do some actions, if I open some theme(i.e. I open scene and it does it by itself)

    Code:
    MainAssistant.prototype.setup = function() {
    //First one doesn't work
     this.controller.listen(this.controller.scene,Mojo.Event.activate,this.myFunc.bing(this) );
    
    //This - works
    this.controller.listen($('test_button'),Mojo.Event.tap,this.myFunc.bind(this)  );
    }
    .............
    
    MainAssistant.prototype.myFunc = function()
    {
    	this.controller.serviceRequest('palm://com.palm.connectionmanager', {
    	    method: 'getstatus',
    	    parameters: {subscribe:true},
    	    onSuccess: this.isWifiOn
    	});
    }
    
     
    MainAssistant.prototype.isWifiOn = function(wifistatus)
    {
    	if (wifistatus.wifi.state=="connected")
    	{
    		$('area-to-update').update("WiFi is " + Object.toJSON(wifistatus.wifi.state));																	 
    	}
    }
    
    .............
    MainAssistant.prototype.cleanup = function(event) {
    	this.controller.stopListening(this.controller.scene,Mojo.Event.activate,this.myFunc.bing(this) );
    	this.controller.stopListening($('test_button'),Mojo.Event.tap, this.myFunc.bind(this) );
    }
    Please, tell me, what should I change, to make it works? Spent extremly long time trying fixed, but without sucсess.

    in my opinion - construction this.controller.listen(this.controller.scene,Mojo.Event.activate,this.myFunc.bing(this) ); should wait until scene was activated and then opened myFunc..

    ps. this.controller.scene - is this costruction really returns name of my scene?

    thanks a lot
    Last edited by Small-Poni; 01/15/2010 at 01:59 AM.
  2. #2  
    Try changing this.myFunc.bing(this) to this.myFunc.bind(this)
  3.    #3  
    Well.
    In fact, everything is much more easy then I thought:

    Solution: write in 'this.myFunc();'(or any other function you want to be start ) instead of listening events such as activation theme.

    Hope, it would help someone during his first steps in webos =)
  4.    #4  
    double
    Last edited by Small-Poni; 01/15/2010 at 04:01 AM.

Posting Permissions