@nemigo/helpers 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/queue.d.ts CHANGED
@@ -28,6 +28,10 @@ export declare abstract class Queue<T> {
28
28
  * @param item - Элемент для обработки
29
29
  */
30
30
  protected abstract handle(item: T): void;
31
+ /**
32
+ * Сброс таймера шага
33
+ */
34
+ private stop;
31
35
  /**
32
36
  * Сброс очереди
33
37
  */
package/dist/queue.js CHANGED
@@ -27,22 +27,28 @@ export class Queue {
27
27
  * Запускает обработку очереди с задержкой
28
28
  */
29
29
  run() {
30
- this.reset();
30
+ this.stop();
31
31
  this.timeout = setTimeout(() => {
32
32
  if (this._queue.length === 0)
33
- return this.reset();
33
+ return this.stop();
34
34
  const item = this._queue.shift();
35
35
  this.handle(item);
36
- this._queue.length > 0 ? this.run() : this.reset();
36
+ this._queue.length > 0 ? this.run() : this.stop();
37
37
  }, this._delay);
38
38
  }
39
39
  /**
40
- * Сброс очереди
40
+ * Сброс таймера шага
41
41
  */
42
- reset() {
42
+ stop() {
43
43
  if (this.timeout)
44
44
  clearTimeout(this.timeout);
45
45
  this.timeout = 0;
46
+ }
47
+ /**
48
+ * Сброс очереди
49
+ */
50
+ reset() {
51
+ this.stop();
46
52
  this._queue.length = 0;
47
53
  }
48
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nemigo/helpers",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Vlad Logvin",