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

@humblejs/lib

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@humblejs/lib

Common utils library

  • 1.10.16
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-11.11%
Maintainers
1
Weekly downloads
 
Created
Source

Lib

Common utils library

Install

yarn add @humblejs/lib

Style

Following styles must be imported for all the components

@import '@humblejs/lib/dist/css/global.scss';
@import '@humblejs/lib/dist/css/themes/default.scss';

Other available files

  • @humblejs/lib/dist/css/reset.scss
  • @humblejs/lib/dist/css/toc.scss (table of contents)

Usage

Import complete library

import lib from '@humblejs/lib';

Import specific function or module

import { logger } from '@humblejs/lib';

or you can import from direct location like:

import logger from '@humblejs/lib/dist/js/logger';

Modules

NameDirect import
logger ~> { info, debug, error, warn } ,{ isLoggingEnabled }dist/js/logger
Analytics ~> { sendEvent, reset, pageview }dist/js/ga
{ generateToc, addPermaLinkToHeaders }dist/js/toc
{ isBrowser, isIE }dist/js/browser
registerScrollCallback, { isElementInViewport }dist/js/register-scroll-callback
addListener(elem, evt, fn), { addEventListener }dist/js/event/add-listener
removeListener(elem, evt, fn)dist/js/event/remove-listener

logger

Enable/disable console logging. Configuration is based on localStorage

ga

Google analytics wrapper

toc

Table of contents generator

browser

Browser related utility functions

register-scroll-callback

Register callback when user scrolls the page

registerScrollCallback takes options with callback (fn) and scrollRefId (element ID) so when scrollRefId is in view (or passed the point) callback is triggered.

e.g,

window.onload = function() {
  registerScrollCallback({
    scrollRefId: 'menu-bar',
    callback: () => {
      console.log('Just past the menu bar');
    },
  });
}

FAQs

Package last updated on 07 Aug 2022

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