csimon
19 Oct 2010, 8:39 AM
Hi,
I'm looking for dispatching orientationchange and beforeorientationchange right in the time.
But if you try the simple code below:
log = function(name){
console.log(Ext.util.Format.format('"{0}": {1} msec', name, (new Date()).getMilliseconds()));
}
Ext.setup({
onReady: function() {
var panel = new Ext.Panel({
fullscreen: true,
orientationMonitor:true,
listeners:{
beforeorientationchange:function(){ log("beforeorientationchange"); },
orientationchange:function(){ log("orientationchange"); }
}
});
var e = document.createEvent('Events');
e.initEvent('orientationchange', true, false);
e.orientation = "landscape";
document.dispatchEvent(e);
log("dispatch");
}
});
you get a log like this:
"dispatch": 240 msec
"beforeorientationchange": 671 msec
"orientationchange": 672 msec
where the orientation change events are fired pretty much in the same time and both,
about 0.5 seconds after dispatching orientationchange.
Is possible to set that delay without breaking the sencha event machinery?
It seems that sencha defines beforeorientationchange subject to orientationchange ...
it is possible to separate them?
Thanks and regards,
Simone
I'm looking for dispatching orientationchange and beforeorientationchange right in the time.
But if you try the simple code below:
log = function(name){
console.log(Ext.util.Format.format('"{0}": {1} msec', name, (new Date()).getMilliseconds()));
}
Ext.setup({
onReady: function() {
var panel = new Ext.Panel({
fullscreen: true,
orientationMonitor:true,
listeners:{
beforeorientationchange:function(){ log("beforeorientationchange"); },
orientationchange:function(){ log("orientationchange"); }
}
});
var e = document.createEvent('Events');
e.initEvent('orientationchange', true, false);
e.orientation = "landscape";
document.dispatchEvent(e);
log("dispatch");
}
});
you get a log like this:
"dispatch": 240 msec
"beforeorientationchange": 671 msec
"orientationchange": 672 msec
where the orientation change events are fired pretty much in the same time and both,
about 0.5 seconds after dispatching orientationchange.
Is possible to set that delay without breaking the sencha event machinery?
It seems that sencha defines beforeorientationchange subject to orientationchange ...
it is possible to separate them?
Thanks and regards,
Simone