@html_first/simple_queue

1.2.0 • Public • Published

simple_queue

  • made for queue handler for @html_first internals;
  • but are generally capable enough for general usages;

how to install

npm i @html_first/simple_queue

usage

  • debouncing using unique id
// @ts-check

import { _Queue, _QueueObject } from '@html_first/simple_queue';

$queue = new _Queue();
$queue.assign(
	new _QueueObject(
		'id' /** <- queue id to prevent spamming action button */,
		() => {
			/**
			 * - callback
			 * - can also be async function
			 */
		},
		false /** <- false or number debounce on each valid(sanitized from spam action */
	)
);
  • handles all with first in first out
// @ts-check

import { _QueueFIFO, _QueueObjectFIFO } from '@html_first/simple_queue';

$queue = new _QueueFIFO();
$queue.assign(
	new _QueueObjectFIFO(() => {
		/**
		 * - callback
		 * - can also be async function
		 */
	}, false /** <- false or number debounce on each valid(sanitized from spam action */)
);

Package Sidebar

Install

npm i @html_first/simple_queue

Weekly Downloads

37

Version

1.2.0

License

MIT

Unpacked Size

5.18 kB

Total Files

8

Last publish

Collaborators

  • hakim_jazuli