just_debounce_it

Creator: coderz1093

Last updated:

Add to Cart

Description:

just debounce it

just_debounce_it #
A simple debounce library. Supports debouncing by function and stream debouncing.
import 'package:just_debounce_it/just_debounce_it.dart';

Debounce.milliseconds(1000, print, ["Debounce World!"]);
copied to clipboard
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. The target Function provided must be the same object every time Debounce is called.
Debounce.seconds(int timeoutSeconds,
Function target,
[List<dynamic> positionalArguments,
Map<Symbol, dynamic> namedArguments])
copied to clipboard
Debounce.milliseconds(int timeoutMs,
Function target,
[List<dynamic> positionalArguments,
Map<Symbol, dynamic> namedArguments])
copied to clipboard
Debounce.duration(Duration timeout,
Function target,
[List<dynamic> positionalArguments,
Map<Symbol, dynamic> namedArguments])
copied to clipboard
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])
copied to clipboard
To clear a debounced target:
Debounce.clear(
Function target,
[List<dynamic> positionalArguments,
Map<Symbol, dynamic> namedArguments])
copied to clipboard
Stream Debouncing #
Use DebounceStreamTransfomer to debounce any stream by a specified duration.
DebounceStreamTransfomer(Duration timeout)
copied to clipboard
DebounceStreamTransfomer.seconds(int timeoutSeconds)
copied to clipboard
DebounceStreamTransfomer.milliseconds(int timeoutMs)
copied to clipboard
Stream debounceStream(Stream input) => input.transform(DebounceStreamTransfomer.seconds(1));
copied to clipboard
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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.