j-templates 7.0.45 → 7.0.46

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.
@@ -174,10 +174,10 @@ function DirtyScope(scope) {
174
174
  else
175
175
  emitter_1.Emitter.Emit(scope.emitter, scope);
176
176
  }
177
- const scopeQueue = new Set();
177
+ const scopeQueue = distinctArray_1.DistinctArray.Create();
178
178
  function ProcessScopeQueue() {
179
- const scopes = Array.from(scopeQueue);
180
- scopeQueue.clear();
179
+ const scopes = distinctArray_1.DistinctArray.Get(scopeQueue);
180
+ distinctArray_1.DistinctArray.Clear(scopeQueue);
181
181
  for (let x = 0; x < scopes.length; x++)
182
182
  DirtyScope(scopes[x]);
183
183
  }
@@ -185,9 +185,9 @@ function OnSet(scope) {
185
185
  if (scope.destroyed)
186
186
  return true;
187
187
  if (scope.async || scope.calcFunctions.length > 0) {
188
- if (scopeQueue.size === 0)
188
+ if (distinctArray_1.DistinctArray.Size(scopeQueue) === 0)
189
189
  queueMicrotask(ProcessScopeQueue);
190
- scopeQueue.add(scope);
190
+ distinctArray_1.DistinctArray.Push(scopeQueue, scope);
191
191
  return;
192
192
  }
193
193
  DirtyScope(scope);
@@ -4,7 +4,9 @@ export type DistinctArray<T> = {
4
4
  array: T[];
5
5
  };
6
6
  export declare namespace DistinctArray {
7
- function Create<T>(id: (value: T) => unknown): DistinctArray<T>;
7
+ function Create<T>(id?: (value: T) => unknown): DistinctArray<T>;
8
8
  function Push<T>(distinctArr: DistinctArray<T>, value: T): void;
9
9
  function Get<T>({ array }: DistinctArray<T>): T[];
10
+ function Size<T>(distinct: DistinctArray<T>): number;
11
+ function Clear<T>(distinct: DistinctArray<T>): void;
10
12
  }
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DistinctArray = void 0;
4
4
  var DistinctArray;
5
5
  (function (DistinctArray) {
6
- function Create(id) {
6
+ function Create(id = (val) => val) {
7
7
  return {
8
8
  id,
9
9
  distinct: null,
10
- array: []
10
+ array: [],
11
11
  };
12
12
  }
13
13
  DistinctArray.Create = Create;
@@ -18,7 +18,9 @@ var DistinctArray;
18
18
  break;
19
19
  case 1: {
20
20
  if (distinctArr.distinct === null) {
21
- distinctArr.distinct = new Set([distinctArr.id(distinctArr.array[0])]);
21
+ distinctArr.distinct = new Set([
22
+ distinctArr.id(distinctArr.array[0]),
23
+ ]);
22
24
  }
23
25
  }
24
26
  default: {
@@ -35,4 +37,13 @@ var DistinctArray;
35
37
  return array;
36
38
  }
37
39
  DistinctArray.Get = Get;
40
+ function Size(distinct) {
41
+ return distinct.distinct.size;
42
+ }
43
+ DistinctArray.Size = Size;
44
+ function Clear(distinct) {
45
+ distinct.array = [];
46
+ distinct.distinct?.clear();
47
+ }
48
+ DistinctArray.Clear = Clear;
38
49
  })(DistinctArray || (exports.DistinctArray = DistinctArray = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.45",
3
+ "version": "7.0.46",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",