@searchspring/snap-profiler 0.25.1 → 0.26.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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Profiler = void 0;
4
4
  var Profiler = /** @class */ (function () {
5
5
  function Profiler(namespace) {
6
- this.namespace = namespace;
6
+ this.namespace = namespace || '';
7
7
  this.profiles = [];
8
8
  }
9
9
  Profiler.prototype.setNamespace = function (namespace) {
@@ -28,10 +28,10 @@ var Profile = /** @class */ (function () {
28
28
  var type = _a.type, name = _a.name, context = _a.context;
29
29
  this.status = 'pending';
30
30
  this.time = {
31
- date: undefined,
32
- begin: undefined,
33
- end: undefined,
34
- run: undefined,
31
+ date: 0,
32
+ begin: 0,
33
+ end: 0,
34
+ run: 0,
35
35
  };
36
36
  this.namespace = namespace;
37
37
  this.type = type;
@@ -47,7 +47,7 @@ var Profile = /** @class */ (function () {
47
47
  return this;
48
48
  };
49
49
  Profile.prototype.stop = function () {
50
- if (!this.time.end) {
50
+ if (!this.time.end && this.time.begin) {
51
51
  this.time.date = Date.now();
52
52
  this.time.end = window.performance.now();
53
53
  this.time.run = +(this.time.end - this.time.begin).toFixed(3);
@@ -1,6 +1,6 @@
1
1
  export class Profiler {
2
2
  constructor(namespace) {
3
- this.namespace = namespace;
3
+ this.namespace = namespace || '';
4
4
  this.profiles = [];
5
5
  }
6
6
  setNamespace(namespace) {
@@ -21,10 +21,10 @@ class Profile {
21
21
  constructor(namespace, { type, name, context }) {
22
22
  this.status = 'pending';
23
23
  this.time = {
24
- date: undefined,
25
- begin: undefined,
26
- end: undefined,
27
- run: undefined,
24
+ date: 0,
25
+ begin: 0,
26
+ end: 0,
27
+ run: 0,
28
28
  };
29
29
  this.namespace = namespace;
30
30
  this.type = type;
@@ -40,7 +40,7 @@ class Profile {
40
40
  return this;
41
41
  }
42
42
  stop() {
43
- if (!this.time.end) {
43
+ if (!this.time.end && this.time.begin) {
44
44
  this.time.date = Date.now();
45
45
  this.time.end = window.performance.now();
46
46
  this.time.run = +(this.time.end - this.time.begin).toFixed(3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@searchspring/snap-profiler",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
4
4
  "description": "Snap Profiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,5 +23,5 @@
23
23
  "files": [
24
24
  "dist/**/*"
25
25
  ],
26
- "gitHead": "56ab4bfc6d2d6c98ea80d7efa0ec65cca9e654ae"
26
+ "gitHead": "e2a217f1492486b497e6fe4be8102d3fb06c573c"
27
27
  }