@woosh/meep-engine 2.42.1 → 2.42.2

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.
@@ -42,6 +42,21 @@ export class RingBuffer {
42
42
  this.data = new Array(size);
43
43
  }
44
44
 
45
+ /**
46
+ *
47
+ * @param {number} new_size
48
+ */
49
+ resize(new_size) {
50
+ const array = new Array(new_size);
51
+
52
+ this.data = array;
53
+ this.size = new_size;
54
+
55
+ this.clear();
56
+
57
+ // TODO implement a way to keep the old data, need to figure out the correct adjustments to head and tail
58
+ }
59
+
45
60
  /**
46
61
  *
47
62
  * @return {V}
@@ -2,6 +2,7 @@ export class AbstractMetric {
2
2
  /**
3
3
  *
4
4
  * @param {number} value
5
+ * @returns {void}
5
6
  */
6
7
  record(value) {
7
8
  throw new Error('Not implemented');
@@ -23,7 +24,7 @@ export class AbstractMetric {
23
24
  throw new Error('Not implemented');
24
25
  }
25
26
 
26
- clear(){
27
+ clear() {
27
28
  throw new Error('Not implemented');
28
29
  }
29
30
  }
@@ -9,9 +9,23 @@ export class RingBufferMetric extends AbstractMetric {
9
9
  constructor(size = 100) {
10
10
  super();
11
11
 
12
+ /**
13
+ *
14
+ * @type {RingBuffer}
15
+ * @readonly
16
+ * @private
17
+ */
12
18
  this.__data = new RingBuffer(size);
13
19
  }
14
20
 
21
+ /**
22
+ * Resize underlying buffer to be able to keep a different number of records
23
+ * @param {number} size
24
+ */
25
+ resize(size) {
26
+ this.__data.resize(size);
27
+ }
28
+
15
29
  getLastRecord() {
16
30
  return this.__data.getHead();
17
31
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.42.1",
8
+ "version": "2.42.2",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",