# browser-size-react

> Browser Size React is a very small javascript which detect browser size and only execute your code when it matches the predefined configuration.

Latest version **1.0.5** (published 2018-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install browser-size-react
pnpm add browser-size-react
yarn add browser-size-react
bun add browser-size-react
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2018-09-25 |
| First published | 2018-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Cuong Vu |
| Maintainers | cuongcycle |
| Keywords | browser size, browser size detect, browser size react |

## Links

- npm: https://www.npmjs.com/package/browser-size-react
- npm.io page: https://npm.io/package/browser-size-react

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2018-09-25
- 1.0.4 — 2018-09-25
- 1.0.3 — 2018-09-25
- 1.0.2 — 2018-09-25
- 1.0.1 — 2018-09-25
- 1.0.0 — 2018-09-25

## README

# Browser Size React

Browser Size React is a very small javascript which detect browser size and only execute your code when it matches the predefined configuration.

## Install:

	yarn add browser-size-react

## Configuration
Ignore this configuration if you want to use the default one. If not, please declare your config before:

	window.browserSizeReact(options);

<br>Customized configuration:
	
	window.browserSizeReactConfig = {
		layoutSmartphone: {
			minimumWidth: 0,
			maximumWidth: 767,
			orientation: 'smartphone',
		},
		layoutTablet: {
			minimumWidth: 768,
			maximumWidth: 1079,
			orientation: 'tablet',
		},
		layoutDesktop: {
			minimumWidth: 1080,
			maximumWidth: Number.POSITIVE_INFINITY,
			orientation: 'desktop',
		}
	};

## How To Use
Import from node_modules:
	
	import 'browser-size-react';

<br>Use it:
	
	window.browserSizeReact({
		onSmartphone: function() {
			// example: init the slider only for mobile screen
			// replace this code below by your code
			$('.my-slider').slick();
		},
		onTablet: () => {
			// example: destroy the slider on tablet
			// replace this code below by your code
			if($('.my-slider.slick-initialized').length) {
				$('.my-slider').slick('unslick');
			}
		},
		onDesktop: () => {
			// example: destroy the slider on desktop
			// replace this code below by your code
			if($('.my-slider.slick-initialized').length) {
				$('.my-slider').slick('unslick');
			}
		},
  });

## License:
It is FREE

---
_Source: https://npm.io/package/browser-size-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
