Re: [screen-orientation] Locking to 'current' orientation

On Tuesday, 26 November 2013 at 15:30, Kenneth Rohde Christiansen wrote:

> hi,
> On Tue, Nov 26, 2013 at 4:25 PM, Marcos Caceres < (> wrote:
> > On Tuesday, 26 November 2013 at 15:16, Mounir Lamouri wrote:
> > > Hi,
> > > 
> > > I got some requests from different organizations to add the ability to
> > > lock to the 'current' orientation in the Screen Orientation API.
> > > 
> > > > From Javascript, that would allow writing
> > > window.screen.lockOrientation('current');
> > > instead of
> > > window.screen.lockOrientation(window.screen.orientation);
> > > Basically, a syntax sugar.
> > 
> current is nice because it works for the manifest as well.
IMHO, it would be confusing to have an app that when you launch it the first time locks one way... but when you launch it the next time, locks another way. 

In the 300 apps we've been cataloguing for orientation [1], there is not a single instance of that exhibits this behaviour. I've also never personally seen any app do this on startup.  

Mounir, what is the use case for locking to "current" on startup? Which applications do you know that exhibit this behaviour? 

> > the one with JavaScript seems more clear to me (as it's more evident that it's dynamically derived). "current" is kinda weird because setting the orientation is an async operation, so by the time you work out what "current" is, it might not longer be the "current" one... so it's kind or a race condition.
> Why? If it rotating at the moment you call it, it could just fail, if
> it is not, it could lock immediately. It is no different from using
> the window.screen.orientation.

Sure, but it's more about setting expectations. For me personally, using "window.screen.orientation" is more explicit about what I want... like:

var current = screen.orientation; 
console.log("ok! locking it to:", current );

"current" is more like requesting. That's just me tho. 


Received on Tuesday, 26 November 2013 15:51:15 UTC