a listener of orientation change for mobile or tablet.
npm install lesca-sensor-orientation-change --save
import OrientationChange from 'lesca-sensor-orientation-change';
OrientationChange.addEventListener((e) => {
console.log(e); // landscape or portrait
});
method | description | default |
---|---|---|
.addEventListener(eventHandler:function) | get angle when orentation change | |
.destroy() | remove event |
- maintain if necessary