just_debounce_it 3.0.0+1 copy "just_debounce_it: ^3.0.0+1" to clipboard
just_debounce_it: ^3.0.0+1 copied to clipboard

outdated

A simple debounce library for preventing continuous execution of functions

just_debounce_it #

A simple debounce library.

import 'package:just_debounce_it/just_debounce_it.dart';

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

Static methods #

There are three methods available for debouncing. All methods differ only by the first parameter used to specify timeout values in different formats:

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

To immediately dispatch a target that has previously been debounced, use runAndClear. Optional args can be provided to override the debounced arguments:

Debounce.runAndClear( 
    Function target,
    [List<dynamic> positionalArguments, 
    Map<Symbol, dynamic> namedArguments])

To clear a debounced target:

Debounce.clear( 
    Function target,
    [List<dynamic> positionalArguments, 
    Map<Symbol, dynamic> namedArguments])

Example #

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

pub run example/main.dart

Credits

https://gist.github.com/marc-hughes/8302149

https://github.com/dtq

17
likes
0
pub points
86%
popularity

Publisher

verified publisherqrl.app

A simple debounce library for preventing continuous execution of functions

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on just_debounce_it