simple_throttle_debounce 1.0.4 copy "simple_throttle_debounce: ^1.0.4" to clipboard
simple_throttle_debounce: ^1.0.4 copied to clipboard

It's a simple pure dart package which implements throttle/debounce functionality, and it's a rewrite work of the original js version (JavaScript patterns: Throttle and Debounce)

A simple throttle/debounce library for Dart developers.

Created from templates made available by Stagehand under a BSD-style license.

Usage #

A simple usage example:

import 'dart:async';

import 'package:simple_throttle_debounce/simple_throttle_debounce.dart';

void main() async {
  var limit = 100;
  var tick = 0;
  var interval = 1000;
  var simpleTask = (tick, {name = 'simpleTask'}) => print('tick: $tick, name: $name');
  dynamic throttleSimpleTask = throttle(simpleTask, interval);
  dynamic debounceSimpleTask = debounce(simpleTask, interval);
  while (true) {
    print(tick);
    throttleSimpleTask(tick, name: 'throttleSimpleTask');
    debounceSimpleTask(tick, name: 'debounceSimpleTask');
    await Future.delayed(Duration(milliseconds: 100), () => tick++);
    if (tick > limit) break;
  }
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

References #

License #

MIT License

Copyright (c) 2020 liudonghua

1
likes
140
pub points
2%
popularity

Publisher

unverified uploader

It's a simple pure dart package which implements throttle/debounce functionality, and it's a rewrite work of the original js version (JavaScript patterns: Throttle and Debounce)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on simple_throttle_debounce