Skip to content

Commit

Permalink
[embedlite-components] Make last known orientation as member variable…
Browse files Browse the repository at this point in the history
…. Contributes to JB#35447
  • Loading branch information
rainemak committed Jun 30, 2016
1 parent 5f71dbf commit 615855d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jsscripts/OrientationChangeHandler.jsm
Expand Up @@ -28,25 +28,26 @@ OrientationChangeHandler.prototype = {

lastOrientation: "portrait-primary",
isRegistered: false,
orientationChangeSent: false,

handleOrientationChange: function(evt) {
let that = this;
let newOrientation = that._targetWindow.screen.mozOrientation;
let fullSwitch = (newOrientation.split("-")[0] ==
that.lastOrientation.split("-")[0]);
let changeSent = false;
that.orientationChangeSent = false;
that.lastOrientation = newOrientation;

function sendOrientationChanged() {
if (changeSent) {
if (that.orientationChangeSent) {
return;
}
try {
Services.embedlite.sendAsyncMessage(that._winID, "embed:contentOrientationChanged",
JSON.stringify({
"orientation": newOrientation
"orientation": that.lastOrientation
}));
changeSent = true;
that.orientationChangeSent = true;
} catch (e) {
dump("EmbedLiteOrientationChangeHandler: Failed to report orientation change " + e + "\n")
}
Expand Down

0 comments on commit 615855d

Please sign in to comment.