# sizeme

> Library to measure browser size. Edit

Latest version **1.0.2** (published 2018-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install sizeme
pnpm add sizeme
yarn add sizeme
bun add sizeme
```

## 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.2 |
| Published | 2018-03-20 |
| First published | 2018-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Juan Castro Fernández |
| Maintainers | castrofernandez |

## Links

- npm: https://www.npmjs.com/package/sizeme
- Repository: https://github.com/castrofernandez/sizeme
- Homepage: https://github.com/castrofernandez/sizeme#readme
- Issues: https://github.com/castrofernandez/sizeme/issues
- npm.io page: https://npm.io/package/sizeme

## Recent versions

- 1.0.2 (latest) — 2018-03-20
- 1.0.0 — 2018-03-19

## README

# sizeme
Library to measure browser size based on CSS or JS configuration.

1. Install 

```
npm install sizeme
```

2. Usage

```
var sizeme = require('sizeme');

// You can set sizes in JS:
sizeme.load({
    sizes: [
    {
      type: 'mobile',
      maxWidth: 767
    },
    {
      type: 'tablet',
      maxWidth: 1024
    },
    {
      type: 'small_desktop',
      maxWidth: 1200
    }
  ]
});

// OR in CSS (CSS is checked first so it overwrites JS)
<style>
    body:before {
        content: "mobile";
        display: none; /* Prevent from displaying. */
    }

    @media (min-width: 700px) {
        body:before {
            content: "tablet";
        }
    }

    @media (min-width: 1100px) {
        body:before {
            content: "desktop";
        }
    }

    @media (min-width: 1400px) {
        body:before {
            content: "big_desktop";
        }
    }
</style>

sizeme.getDeviceType();
sizeme.isMobile();
sizeme.isDesktop();
```

3. Run tests

```
npm start // or node server.js
npm test
```

4. List of methods

* load: sets configuration settings
* getDeviceType: returns the name of current device
* isMobile: returns true if the document size matches mobile width
* isTablet: returns true if the document size matches tablet width
* isSmallDesktop: returns true if the document size matches small desktop width
* isDesktop: returns true if the document size matches desktop width
* isResponsive: returns true if the document size matches mobile or tablet width

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