Quantcast
Channel: .:zefanjas:.
Viewing all articles
Browse latest Browse all 95

EnyoJS and FirefoxOS screen orientation

$
0
0

Today I wanted to implement something in BibleZ NG that depends on the screen orientation (portrait or landscape) of a FxOS device.  Because I don’t use phonegap for this app (maybe later) here is my solution to handle it more EnyoJS-like. I’ve used enyo.Signals to listen for the orientation changed event and than send a custom event that my enyo kinds can listen to.

Put this in your main App.js file:

window.screen.onmozorientationchange = function () {
    enyo.Signals.send("onOrientationChange");
};

Listen to this custom event in your other enyo kinds:

{kind: "Signals", onOrientationChange: "handleOrientation"}

This is an example function to handle the different screen orientations:

handleOrientation: function (inSender, inEvent) {
    var orientation = screen.mozOrientation;
    if (orientation === "portrait-primary" || orientation === "portrait-secondary" ) {
        //do something
    }
    else if (orientation === "landscape-primary" || orientation === "landscape-secondary" ) {
        //do something
    }
}

via

Kommentar hinzufügen


Viewing all articles
Browse latest Browse all 95

Trending Articles


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.


Pokemon para colorear


Presence Quotes – Positive Quotes


Long Distance Relationship Tagalog Love Quotes


Tropa Quotes


“Mali man na ikaw ay ibigin ko, akoy iibig padin sayo”


RE: Mutton Pies (frankie241)


Hato lada ym dei namar ka jingpyrshah jong U JJM Nichols Roy (Bah Joy) ngin...


FORECLOSURE OF REAL ESTATE MORTGAGE


Sapos para colorear


HOY PANGIT, MAGBAYAD KA!


Girasoles para colorear


Love Quotes Tagalog


EASY COME, EASY GO


Top 7 Lies of Boys


Re:Mutton Pies (lleechef)


Ka longiing longsem kaba skhem bad kaba khlain ka pynlong kein ia ka...


Two timer Sad tagalog Love quotes


UPDATE SC IDOL: TWO BECOME ONE