@sdevs/screen-sizr
v2.0.0
Published
This package is a simple screen size detector for NodeJS. You can get the screensize on your Frontend app with ease. We dont guarantee that this package will work in the Backend.
Downloads
43
Maintainers
Readme
Basic Information.
This package is a simple package that allows you to track the screensize / get the screensize of a device. (this package is made for web / frontend we do not guarantee that this package will work in backend)
Choose Readme type.
Get Started.
Installation.
NPM
npm i @sdevs/screen-sizr
Yarn
yarn add @sdevs/screen-sizr
Usage.
Importing.
import ScreenSizr from '@sdevs/screen-sizr';
Getting the screensize (normal).
import ScreenSizr from '@sdevs/screen-sizr';
const screensize = ScreenSizr.getScreenSize();
Getting the screensize (async).
import ScreenSizr from '@sdevs/screen-sizr';
const screensize = await ScreenSizr.getScreenSizeAsync();
Getting the screensize (async / promise).
import ScreenSizr from '@sdevs/screen-sizr';
ScreenSizr.getScreenSizeAsync().then(screensize => {
console.log(screensize.width, screensize.height);
});
Getting the screensize (async / await).
import ScreenSizr from '@sdevs/screen-sizr';
const screensize = await ScreenSizr.getScreenSizeAsync();
Examples.
Example.
import ScreenSizr from '@sdevs/screen-sizr';
const screensize = ScreenSizr.getScreenSize();
console.log(screensize.width, screensize.height);
Example (async).
import ScreenSizr from '@sdevs/screen-sizr';
const screensize = await ScreenSizr.getScreenSizeAsync();
console.log(screensize.width, screensize.height);
Example (async / promise).
import ScreenSizr from '@sdevs/screen-sizr';
ScreenSizr.getScreenSizeAsync().then(screensize => {
console.log(screensize.width, screensize.height);
});
License.
This package is licensed under the MIT License. See the LICENSE file for more information.
Support.
If you need support, please join our Discord Server and ask your question in the #support channel.
Issues.
If you have any issues, please open an issue on our GitHub Repository.