1.2.3 • Published 3 years ago

tlence v1.2.3

Weekly downloads
156
License
ISC
Repository
github
Last release
3 years ago

tlence

tlence

NPM

install size dependencies

debounce and throttle techniques for performance

install

npm install tlence

use

Throttle

import { throttle } from 'tlence';

function log(server) {
  console.log('connecting to', server);
}

const throttleLog = throttle(log, 5000);
// just run first call to 5s
throttleLog('local');
throttleLog('local');
throttleLog('local');
throttleLog('local');
throttleLog('local');
throttleLog('local');

Debounce

import { debounce, delay } from 'tlence';
const debounceLog = debounce(log, 5000);
// just run last call to 5s
debounceLog('local');
debounceLog('local');
debounceLog('local');
debounceLog('local');
debounceLog('local');
debounceLog('local');

Delay

import { delay } from 'tlence';
console.log('delay 1');
await delay(5000);
// run after 5s
console.log('delay 2');
1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago