View Full Version : lanch a javascript after the windows will be ready

Manolo Quijano
20 Sep 2013, 11:19 AM
Hi all,

I need to execute some java function when the windows will be ready. I'm not sure what listener event I can used for that.

Could you help me please?

Another thing is I need to use a timer. Searching for Sencha doc I think I can uses Ext.util.tapRepeater for that, but it is not clear the documentation for me.

Thanks in adavance,
Manolo Q.

23 Sep 2013, 2:04 AM
Question: I need to execute some java function when the windows will be ready
Answer: Either use the launch method inside root/app.js or the show event of the view.

Question: Another thing is I need to use a timer.
Answer: Try Ext.defer(fn, time, scope); E.g. Ext.defer(this.onTimer, 500, this);
The function inside defer is asynchrone, therefore you might want to use the scope, though you do not have to define it.

Manolo Quijano
23 Sep 2013, 4:26 AM
Hi Kurt001,

Thanks for your response.

I have one dough. Using Ext.defer to make the timer. How can I stop it ?

I don't find this option in the documentation.


23 Sep 2013, 10:24 PM
var myTimeout = Ext.defer(Ext.emptyFn, 500, this);

23 Sep 2013, 10:46 PM
Or use

var task =Ext.create (http://sc13-live.sencha.com/touch-docs/#!/api/Ext-method-create)('Ext.util.DelayedTask (http://sc13-live.sencha.com/touch-docs/#!/api/Ext.util.DelayedTask)',{
task.delay(1500);//the callback function will now be called after 1500ms
task.cancel();//the callback function will never be called now, unless we call delay() again

Manolo Quijano
24 Sep 2013, 12:21 AM
Thanks Kurt001,

The problem of DelayedTask is once is execute, not periodically.

Manolo Q.

24 Sep 2013, 3:08 AM
rerunKey: null;

mainFn: function (){

rerunFn: function() {
this.rerunKey = Ext.defer(function () {
// do something
}, 500, this);

cancelRerun: function() {