[OpenLayers-Dev] settimeout and OpenLayers.Function.bind
    Dejung Gewissler 
    dejung.gewissler at oit.state.nj.us
       
    Tue Feb 26 17:15:21 EST 2008
    
    
  
Hi again Devs,
Does anyone have any experience with the OpenLayers.Function.bind and 
settimeout? I have built a control and would like to have a function in 
it invoked after a certain period of time. The code below is simplified 
to show my intent:
OpenLayers.Control.MyControl= OpenLayers.Class(OpenLayers.Control.Panel, {
   
    hello:0,
    initialize: function(layer, options) {
    ....
    },
    doBuffer: function(geometry){
    window.setTimeout(OpenLayers.Function.bind(this.delayedCall, this, 
1), 3000);
    },
     
    delayedCall: function(x) {
        this.hello=3;
        OpenLayers.Console.warn("xxx" + this.hello+ "  " +x);
    },
    CLASS_NAME: "OpenLayers.Control.MyControl"
});
Ideally I would like the delayedCall method to be called 3 seconds after 
the doBuffer is called. However the error that I get is:
    func has no properties
    (no name)()
    return func.apply(object, newArgs);
Am I missing something here?
Thanks,
Dejung
    
    
More information about the Dev
mailing list