tp_rate_limit version: 0.1.11

Published 2024-03-27

n/a

sdk | dart
repository | svn
platform | n/a
status | deprecated
  • Readme
  • Changelog
  • Versions

rate_limit

Build Status

Provides the following StreamTransformers to limit the rate at which a Stream emits events.

##Throttler

Enforces a wait period between events.

// Avoid excessively updating the position while scrolling.
window.onScroll
 .transform(new Throttler(const Duration(milliseconds: 100)))
 .forEach(updatePosition);
 
// Execute `renewToken` on click, but not more than once every 5 minutes.
querySelector('.interactive').onClick
 .transform(new Throttler(const Duration(minutes: 5), trailing: false))
 .forEach(renewToken);

##Debouncer

Enforces a quiet wait period between events.

// Avoid costly calculations while the window size is in flux.
window.onResize
 .transform(new Debouncer(const Duration(milliseconds: 150)))
 .forEach(calculateLayout);

// Execute `sendMail` on click, debouncing subsequent calls.
querySelector('#postbox').onClick
 .transform(new Debouncer(const Duration(milliseconds: 300), leading: true, trailing: false))
 .forEach(sendMail);

// Ensure `batchLog` is executed once after 1 second of debounced calls.
var source = new EventSource('/stream');
source.onMessage
 .transform(new Debouncer(const Duration(milliseconds: 250), maxWait: const Duration(seconds: 1)))
 .forEach(batchLog);

Inspired by lodash's throttle and debounce.

Changelog

0.1.11 - 2024-03-27

Changed

  • Version bump from 0.1.10 to 0.1.11 (Deprecated this package).

0.1.10 - 2024-02-01

Changed

  • Version bump from 0.1.9 to 0.1.10 (Resolve package version confusions).

0.1.9 - 2023-05-22

Changed

  • Version bump from 0.1.8 to 0.1.9.

0.1.8 - 2023-02-09

Changed

  • Version bump from 0.1.7 to 0.1.8 (Version confusion after compiler bug chaos).

0.1.7 - 2023-01-31

Changed

  • Version bump from 0.1.6 to 0.1.7.

0.1.6 - 2022-12-22

Changed

  • Version bump from 0.1.5 to 0.1.6.

0.1.5 - 2022-12-22

Changed

  • Version bump from 0.1.4 to 0.1.5 (Recompile due to installer optimizations).

0.1.4 - 2022-10-11

Changed

  • Version bump from 0.1.3 to 0.1.4 (Recompile due to wrong GetIt.instance syntax.).

0.1.3 - 2022-10-05

Changed

  • Version bump from 0.1.2 to 0.1.3 (fixed pdflib searchpath macos crash).

0.1.2 - 2022-10-01

Changed

  • Version bump from 0.1.1 to 0.1.2 (pkg_pdflib bundle macos dylib).

0.1.1 - 2022-09-29

Changed

  • Version bump from 0.1.0 to 0.1.1 (dependencies upgraded).

0.1.0 - 2022-01-01

Changed

  • Unknown changes.

0.1.11

2024-03-27 download

0.1.10

2024-02-01 download

0.1.9

2023-05-22 download

0.1.8

2023-02-09 download

0.1.7

2023-01-31 download

0.1.6

2022-12-22 download

0.1.5

2022-12-22 download

0.1.4

2022-10-11 download

0.1.3

2022-10-05 download

0.1.2

2022-10-01 download

0.1.1

2022-09-29 download

0.1.0

2022-01-01 download