@superherocheesecake/next-resize-manager

2.0.1 • Public • Published

next-resize-manager

Global module that caches the browser diminsions and triggers resize events.

NPM installation

npm i --save @superherocheesecake/next-resize-manager

Import the module

import { resizeManager } from '@superherocheesecake/next-resize-manager';

Events

Listening to the events

resizeManager.addEventListener('resize', this._resizeHandler);
resizeManager.addEventListener('resize:complete', this._resizeCompleteHandler);

Properties

Get viewport dimensions

const viewportWidth = resizeManager.viewportWidth;
const viewportHeight = resizeManager.viewportHeight;

Get document dimensions

const documentWidth = resizeManager.documentWidth;
const documentHeight = resizeManager.documentHeight;

Get and set the remBase

// get
const remBase = resizeManager.remBase;

// set
resizeManager.remBase = [int];

Methods

Use rem

If no base is given, it will ue the current remBase

resizeManager.rem(size [, base]);

Force the value to update

resizeManager.updateViewportDimensions();
resizeManager.updateDocumentDimensions();
resizeManager.updateDocumentFontSize();

Readme

Keywords

none

Package Sidebar

Install

npm i @superherocheesecake/next-resize-manager

Weekly Downloads

0

Version

2.0.1

License

none

Unpacked Size

14.5 kB

Total Files

12

Last publish

Collaborators

  • n0cha
  • edwardmediamonks
  • wesleysmulders
  • ksawery.mediamonks
  • vandenhork25
  • johanholwerda
  • renedrie
  • kristemmerman123
  • odin.schwartz
  • bolex222
  • coco_g
  • frontend_shcc
  • carinashcc
  • lukasfeitsma
  • jameswhite
  • raul.roman
  • jaak.kivinukk