Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@kunukn/fuzzytoggle

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kunukn/fuzzytoggle

Fuzzy toggle

latest
Source
npmnpm
Version
0.0.5
Version published
Weekly downloads
4
-60%
Maintainers
1
Weekly downloads
 
Created
Source

FuzzyToggle

About

A toggle with fuzzy state between value [0; 1] from given duration.

Demo

Codepen

Getting started

npm i @kunukn/fuzzytoggle

Usage example

import createToggle from '@kunukn/fuzzytoggle';

let log = console.log;
let onUpdate = ({value:v, motion:m, hasReversed:h}) => { log(v,m,h) };
let onUpdate = ({value:v, motion:m, hasReversed:h}) => { log(v,m,h) };

let fuzzy = createToggle({
    duration: 1000,
    value: 0,
    onUpdate,
    onDone,
});

fuzzy.toggle();
// example: 
// console.log -> 0.2, 'expanding', false

setTimeout(()=>{
    fuzzy.toggle();
// example: 
// console.log -> 0.5, 'collapsing', true
}, 600);

Methods

  • toggle
  • cancel

Event hooks

  • onUpdate
  • onDone
  • onCancel
  • onToggle

Size

ES5 FuzzyToggle.umd.js
UMD minified 2.93 kb (gzipped 1.25 kb)

Keywords

library

FAQs

Package last updated on 31 Mar 2019

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