@daign/schedule
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

daign-schedule

CI Coverage NPM package

Utility mechanisms to manage the time-wise execution of functions.

Installation

npm install @daign/schedule --save

Usage

import {Schedule} from '@daign/schedule';

class TestClass {
  private count: number = 0;

  public increment(): void {
    this.count += 1;
    console.log( this.count );
  }
}
const test = new TestClass();

// Throttle the increment method with a waiting period of 40 milliseconds
const wait = 40;
const throttledFunction = Schedule.deferringThrottle( test.increment, wait, test );

// The first call will be executed immediately
throttledFunction();

// The following calls are blocked temporarily, but there will be a single execution after the
// waiting period has elapsed
throttledFunction();
throttledFunction();
throttledFunction();

Scripts

# Build
npm run build

# Run lint analysis
npm run lint

# Run unit tests with code coverage
npm run test

# Get a full lcov report
npm run coverage

Readme

Keywords

Package Sidebar

Install

npm i @daign/schedule

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

9.84 kB

Total Files

7

Last publish

Collaborators

  • daign