just_throttle_it 1.0.0

Dart native js
Flutter Android iOS web

A simple throttle library for limiting consecutive execution of functions

just_throttle_it #

A simple throttle library for Dart.

import 'package:just_throttle_it/just_throttle_it.dart';

Throttle.milliseconds(1000, print, ["Throttle World!"]);

Static methods #

There are three methods available for throttling. A value of true will be returned if the function call is successful, and false if the function has been blocked. All methods differ only by the first parameter used to specify timeout values in different formats:

Throttle.seconds(int timeoutSeconds, 
    Function target,
    [List<dynamic> positionalArguments, 
    Map<Symbol, dynamic> namedArguments])
Throttle.milliseconds(int timeoutMs, 
    Function target,
    [List<dynamic> positionalArguments, 
    Map<Symbol, dynamic> namedArguments])
Throttle.duration(Duration timeout, 
    Function target,
    [List<dynamic> positionalArguments, 
    Map<Symbol, dynamic> namedArguments])

To clear a throttled target, allowing the next throttled call to be immediately executed:

Throttle.clear(Function target)

Example #

A quick demonstration can be found in the example directory. To run the example:

pub run example/main.dart

0
likes
110
pub points
57%
popularity

A simple throttle library for limiting consecutive execution of functions

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

matt@workpail.com

License

MIT (LICENSE)

More

Packages that depend on just_throttle_it