Socket
Book a DemoInstallSign in
Socket

debounce-throttle

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

debounce-throttle

lodash debounce and throttle function built by lodash-cli to support UMD

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
400
-2.2%
Maintainers
1
Weekly downloads
 
Created
Source

debounce-throttle

lodash debounce and throttle function built by lodash-cli to support UMD and gain size benefit.

原因

在使用 lodash 库的节流函数时,感觉有 2 个问题不太友好,所以定制了只包含 debounce 和 throttle 函数的库,方便自己使用。

  • 模块化问题:lodash.debounce 和 lodash.throttle 只支持CMD。

  • 文件大小问题:无论是下载 lodash 还是分别下载 lodash.debounce, lodash.throttle 都有代码冗余。因为 lodash.throttle 是用 lodash.debounce 实现的,分别下载 lodash.debounce, lodash.throttle 相当于下载了 2 份代码!

引用

该定制为 UMD 的,所以支持多种引用方式

import 引入

import {debounce, throttle} from 'debounce-throttle'

require 引入

const {debounce, throttle} = require 'debounce-throttle'

定义在全局对象上

const {debounce, throttle} = window._

使用

具体使用见lodash文档

Keywords

lodash

FAQs

Package last updated on 16 May 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.