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


EASY COME, EASY GO


Pokemon para colorear


Conejos para colorear


tagalog love Quotes – Tiwala Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Patama tagalog quotes – Move On Quotes


Ligaw Quotes – Courting Quotes – Sweet Tagalog Quotes


Re:Mutton Pies (lleechef)


Vimeo 10.7.0 by Vimeo.com, Inc.


FORECLOSURE OF REAL ESTATE MORTGAGE


Girasoles para colorear


Sapos para colorear


Maganda Quotes – tagalog Quotes – Inggit Quotes


“Tado” Jimenez Quotes Collections Online


Patama Quotes – Tanga love tagalog quotes


Mga Patama sa mga Nagmamahal the Best Tagalog love quotes for you


Hugot Lines 2020 Patama : ML Edition


RE: Mutton Pies (frankie241)


Vimeo 10.7.1 by Vimeo.com, Inc.