@ixfx/debug 0.38.0 → 0.39.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/README.md ADDED
@@ -0,0 +1 @@
1
+ A few things useful for debugging.
@@ -1,2 +1,21 @@
1
+ /**
2
+ * Calculates frames per second.
3
+ *
4
+ * Returns a function which needs to be called at the end of each frame.
5
+ *
6
+ * ```js
7
+ * const fps = fpsCounter();
8
+ *
9
+ * function loop() {
10
+ * fps(); // Calculate fps
11
+ * window.requestAnimationFrame(loop);
12
+ * }
13
+ *
14
+ * loop();
15
+ * ```
16
+ * @param autoDisplay If true (default), prints out the FPS to the console
17
+ * @param computeAfterFrames Calculates after this many frames. Higher numbers smoothes the value somewhat
18
+ * @returns
19
+ */
1
20
  export declare const fpsCounter: (autoDisplay?: boolean, computeAfterFrames?: number) => () => number;
2
21
  //# sourceMappingURL=fps-counter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fps-counter.d.ts","sourceRoot":"","sources":["../../src/fps-counter.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,qBAAkB,EAAE,2BAAwB,iBAetE,CAAA"}
1
+ {"version":3,"file":"fps-counter.d.ts","sourceRoot":"","sources":["../../src/fps-counter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,GAAI,qBAAkB,EAAE,2BAAwB,iBAetE,CAAA"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * Calculates frames per second.
3
+ *
4
+ * Returns a function which needs to be called at the end of each frame.
5
+ *
6
+ * ```js
7
+ * const fps = fpsCounter();
8
+ *
9
+ * function loop() {
10
+ * fps(); // Calculate fps
11
+ * window.requestAnimationFrame(loop);
12
+ * }
13
+ *
14
+ * loop();
15
+ * ```
16
+ * @param autoDisplay If true (default), prints out the FPS to the console
17
+ * @param computeAfterFrames Calculates after this many frames. Higher numbers smoothes the value somewhat
18
+ * @returns
19
+ */
1
20
  export const fpsCounter = (autoDisplay = true, computeAfterFrames = 500) => {
2
21
  let count = 0;
3
22
  let lastFps = 0;
@@ -1,5 +1,10 @@
1
1
  export * from './types.js';
2
2
  export * from './logger.js';
3
3
  export * from './fps-counter.js';
4
+ /**
5
+ * Returns a string representation of an error
6
+ * @param ex
7
+ * @returns
8
+ */
4
9
  export declare const getErrorMessage: (ex: unknown) => string;
5
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AAEjC,eAAO,MAAM,eAAe,GAAI,IAAI,OAAO,KAAG,MAM7C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,OAAO,KAAG,MAM7C,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  export * from './types.js';
2
2
  export * from './logger.js';
3
3
  export * from './fps-counter.js';
4
+ /**
5
+ * Returns a string representation of an error
6
+ * @param ex
7
+ * @returns
8
+ */
4
9
  export const getErrorMessage = (ex) => {
5
10
  if (typeof ex === `string`)
6
11
  return ex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixfx/debug",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,