Skip to content

andrelaszlo/cordova-plugin-device-rotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova Plugin: Device Rotation

This is the first version of an Android only (for now) Cordova plugin that gives developers access to the device rotation in a very simple way.

There are no tests and the plugin has not been used in production. Feel free to submit PR:s, but if they are large please submit an issue first to discuss your work.

This plugin has two simple interfaces, onOrientationChange and getOrientation. Both take a callback, which is called with the current orientation. The possible orientations are "up", "down" and "unknown".

onOrientationChange

Registers a callback which is called each time the orientation changes.

CordovaPluginDeviceRotation.onOrientationChange(newOrientation => {
  console.log("New orientation", newOrientation);
});

getOrientation

Get the current orientation. The callback is only called once.

CordovaPluginDeviceRotation.getOrientation(currentOrientation => {
  console.log("New orientation", newOrientation);
});

About

Gives Cordova developers information about device orientation: is it facing up or down?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published