Skip to content

sygnas/syg-throttle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

syg-throttle

Adjust the timing of event execution.

イベントの実行タイミングを調整。

Description

windowの scrollイベントや、 resizeイベントの実行タイミングをミリ秒間隔で指定して遅延させるもの。

Usage

Install

npm install --save @sygnas/throttle

Script

import throttle from '@sygnas/throttle';

function foo() {
    console.log("scroll");
}

window.addEventListener('scroll', throttle(200, foo, this));

Params

throttle(timing, function, scope)
引数 説明
timing int ミリ秒。ここで指定した時間が経過しないと function を実行しない
function function イベントで実行したい関数
scope object 関数を実行するスコープを指定

License

MIT

About

Adjust the timing of event execution.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published