Library to get the device orientation in Fuse. Currently supports iOS only.
Because sometimes you want the device's orientation even if the orientation is locked.
- Clone this repo
- Add a reference to the local
fuse-orientation.unoproj
in your project's .unoproj file, e.g.
"Projects": [
"../fuse-orientation/fuse-orientation.unoproj",
],
- In the root of your app, subscribe to orientation updates:
var orientation = require("OrientationChangeListener");
orientation.subscribe();
- Elsewhere, you can listen to the event:
var listener = require("OrientationChangeListener");
listener.on("orientationChanged", function(val) {
// val will be one of "portrait_up", "portrait_down", "landscape_left", or "landscape_right"
});