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

viki-web-utils

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viki-web-utils

Utils used by the Viki web app

  • 0.0.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

viki-web-utils

Web utilities used by the Viki web app

Installation

npm install -S viki-web-utils

Documentation

For full documentation, see /docs directory.

ScrollTracker

Keeps track of the furthest point on page that user has scrolled to (in percentage). Returns most updated value everytime percentageSeen() is called.

Usage
import Viki from 'viki-web-utils';

const tracker = new Viki.ScrollTracker();
tracker.init();

console.log('percentage of page seen', tracker.percentageSeen()) // e.g. 5
console.log('percentage of page seen rounded to granularity of 10', tracker.percentageSeenRounded(10)) // e.g. 10

LocalStorageTabCounter

Keeps track of number of tabs user has open in current session. Saves current count to user's localStorage.

Usage
import Viki from 'viki-web-utils';

const counter = new Viki.LocalStorageTabCounter();

// open 2 tabs with current session

console.log(counter.getCount()) // 2

ResizeCounter

Tracks number of times user has resized the window. Debounced at 300ms to prevent too many function calls.

Usage
import Viki from 'viki-web-utils';

const counter = new Viki.ResizeCounter(function() {
  // do something, maybe fire an event
});

// resize browser window

console.log(counter.getCount()) // e.g. 1


Development

Install dependencies

npm install

Run tests

npm run tests

Build and publishing

npm build
npm run build-docs // generates JSDoc documentation to /docs dir
npm publish //script automatically builds before publish

FAQs

Package last updated on 22 Mar 2017

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