Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

viewport-dimensions

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewport-dimensions

Simple utility for watching and retrieving browser viewport width, height, vmin and vmax

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
166K
increased by2.87%
Maintainers
1
Weekly downloads
 
Created
Source

Travis CI status Coveralls status devDependencies status

Sauce Labs status

Viewport

Simple utility for watching and retrieving browser viewport width, height, vmin and vmax.

documentElement.clientWidth is used (rather than window.innerWidth), so reported viewport dimensions will exclude scrollbar dimensions.

Install

Bower

bower install -S viewport-dimensions

npm

npm i -S viewport-dimensions

(One object is exported:)

var viewport = require('viewport');

API

#width()

Returns {number} - Browser viewport width.

viewport.width(); // (e.g.) 1024

#height()

Returns {number} - Browser viewport height.

viewport.height(); // (e.g.) 768

#max()

Returns {number} - Maximum browser dimension (width/height).

viewport.max(); // (e.g.) 1024

#min()

Returns {number} - Minimum browser dimension (width/height).

viewport.height(); // (e.g.) 768

#setDimensions()

Set internal dimension references to current browser viewport width and height.

viewport.setDimensions();

Environment

Won't generate errors if run server-side, but won't do anything too useful either.

Development

  1. Clone repo and npm install
  2. Make changes and ensure linting (gulp lint) & tests (gulp test) pass (combined task: gulp dev)
  3. Create distributable files (gulp dist) - combined dev + dist task: gulp

Use gulp watch to run linter and tests on each file change (equivalent to manually running gulp dev).

Keywords

FAQs

Package last updated on 03 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc