JSPM

throttle-typescript

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1251
  • Score
    100M100P100Q108549F
  • License MIT

Helper that returns a throttled function (TypeScript types included - works without TypeScript also)

Package Exports

  • throttle-typescript

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (throttle-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

throttle-typescript

Install

You can install via npm or yarn.

npm

npm install --save throttle-typescript

yarn

yarn add throttle-typescript

Usage

You can import using ES6 imports. If you are using typescript this package includes a typings file.

import { throttle } from 'throttle-typescript';

The throttle helper takes two parameters, a function you want to throttle, and a limit (milliseconds). It will return a throttled version of that function that can be used as shown below:

function myFunction() {
    // Do the thing
}

window.addEventListener('resize', throttle(myFunction, 100));