Skip to content

jameshsu1125/lesca-sensor-orientation-change

Repository files navigation

React React React React React NPM React NPM

Why use it?

a listener of orientation change for mobile or tablet.

Installation

npm install lesca-sensor-orientation-change --save

Usage

import OrientationChange from 'lesca-sensor-orientation-change';

OrientationChange.addEventListener((e) => {
  console.log(e); // landscape or portrait
});

Development

Methods

method description default
.addEventListener(eventHandler:function) get angle when orentation change
.destroy() remove event

Prop

Features

  • maintain if necessary