# js-dispatch **Repository Path**: zhkumsg/js-dispatch ## Basic Information - **Project Name**: js-dispatch - **Description**: javascript dispatch task,like debounce and throttle - **Primary Language**: Unknown - **License**: MulanPSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-10-11 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # js-dispatch > javascript dispatch task,like debounce and throttle,[To see more details](http://wiki.crqcn.com/performance/debounce-and-throttle.html) ## Install ```bash npm install js-dispatch --save ``` ## Options ```js const options = { ... }; new JSDispatch(options); ``` | Field | Desc | | :-- | :-- | | timer | default:`-1` | | `step` | default:`250` | | flag | default:`false` | ## Useage ### Browser ```html ``` ```js var dispatch = new JSDispatch(); // some logic function handleDebouceMove() { dispatch.debounce(function () { // TODO }) } // some logic function handleThrottleMove() { dispatch.throttle(function (done) { // TODO done() }) } ``` ### ESModules ```js import JSDispatch from 'js-dispatch'; var dispatch = new JSDispatch(); // some logic function handleDebouceMove() { dispatch.debounce(function () { // TODO }) } // some logic function handleThrottleMove() { dispatch.throttle(function (done) { // TODO done() }) } ``` ### Node.js ```js const JSDispatch = require('js-dispatch'); var dispatch = new JSDispatch(); // some logic function handleDebouceMove() { dispatch.debounce(function () { // TODO }) } // some logic function handleThrottleMove() { dispatch.throttle(function (done) { // TODO done() }) } ```