@marcoscaceres, the `lock` promise will resolve with `undefined`, and actually we don't need `if...else` at all.
```
async function fixpositionscreen(){
try {
alert('trying...');
await screen.orientation.lock('portrait-primary'));
alert('yes, it was blocked');
}
catch(err){
alert('no, it was not blocked....');
alert(err);
}
}
fixpositionscreen();
```
@r4-2017, you can use the [`onchange`](https://w3c.github.io/screen-orientation/#dom-screenorientation-onchange) event handler to monitor actual orientation change.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/screen-orientation/issues/123#issuecomment-438538751