@hackthenorth/analytics
Advanced tools
Comparing version
@@ -1,8 +0,8 @@ | ||
declare type Scalar = string | boolean | number; | ||
declare type AnalyticsEventProps = { | ||
type Scalar = string | boolean | number; | ||
type AnalyticsEventProps = { | ||
[key: string]: string; | ||
}; | ||
declare type AnalyticsEvent = { | ||
type AnalyticsEvent = { | ||
identifier: string; | ||
props: AnalyticsEventProps; | ||
}; |
@@ -1,2 +0,2 @@ | ||
declare type LogEntry = { | ||
type LogEntry = { | ||
identifier: string; | ||
@@ -8,3 +8,3 @@ duration: number; | ||
}; | ||
declare type Config = { | ||
type Config = { | ||
url: string; | ||
@@ -11,0 +11,0 @@ bufferSize: number; |
@@ -19,3 +19,3 @@ "use strict"; | ||
bufferSize: 50, | ||
uuid: uuid_1.v4(), | ||
uuid: (0, uuid_1.v4)(), | ||
}; | ||
@@ -22,0 +22,0 @@ class BatchedLogger { |
@@ -12,3 +12,3 @@ "use strict"; | ||
this.stream = stream; | ||
this.uuid = uuid_1.v4(); | ||
this.uuid = (0, uuid_1.v4)(); | ||
} | ||
@@ -28,4 +28,4 @@ end() { | ||
const duration = span.end(); | ||
return logger_1.log({ identifier: span.identifier, duration, startTime: span.startTime, stream: span.stream, uuid: span.uuid }); | ||
return (0, logger_1.log)({ identifier: span.identifier, duration, startTime: span.startTime, stream: span.stream, uuid: span.uuid }); | ||
} | ||
exports.endSpan = endSpan; |
@@ -6,6 +6,6 @@ "use strict"; | ||
function useAnalyticsSpan(key, stream = "default") { | ||
react_1.useEffect(() => { | ||
const span = span_1.startSpan(key, stream); | ||
(0, react_1.useEffect)(() => { | ||
const span = (0, span_1.startSpan)(key, stream); | ||
return () => { | ||
span_1.endSpan(span); | ||
(0, span_1.endSpan)(span); | ||
}; | ||
@@ -12,0 +12,0 @@ }); |
{ | ||
"name": "@hackthenorth/analytics", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"react": "^16.0.0" | ||
"react": "^19.0.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "dependencies": { |
12059
-0.08%