2.0.1 • Published 3 years ago

@superherocheesecake/next-resize-manager v2.0.1

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

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();
2.0.1

3 years ago

2.0.0

3 years ago

1.0.4-canary.4

3 years ago

1.0.4-canary.3

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago