feat: Send testdata when localhost
This commit is contained in:
parent
0eff71732e
commit
a4a6fc4bb9
@ -1,10 +1,10 @@
|
||||
import {td} from './telemetry';
|
||||
import {send} from './telemetry';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Functions to open and close a modal
|
||||
function openModal($el) {
|
||||
$el.classList.add('is-active');
|
||||
td.signal("Modal.open", {
|
||||
send("Modal.open", {
|
||||
modal: $el.id
|
||||
});
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import '@fortawesome/fontawesome-free/js/regular';
|
||||
import '@fortawesome/fontawesome-free/js/brands';
|
||||
import './feedback.js';
|
||||
import './main.scss';
|
||||
import {td} from './telemetry';
|
||||
import {send} from './telemetry';
|
||||
|
||||
/////////////////
|
||||
// TRANSLATION //
|
||||
@ -363,7 +363,7 @@ function updateCageCheck() {
|
||||
resultsDiv.appendChild(result);
|
||||
|
||||
// Send telemetry
|
||||
td.signal("Update.CageCheck", {
|
||||
send("Update.CageCheck", {
|
||||
width: width,
|
||||
depth: depth,
|
||||
height: height,
|
||||
@ -391,7 +391,7 @@ function updateCageCalc() {
|
||||
resultsDiv.appendChild(result);
|
||||
|
||||
// Send telemetry
|
||||
td.signal("Update.CageCalc", {
|
||||
send("Update.CageCalc", {
|
||||
numRats: numRats,
|
||||
});
|
||||
|
||||
@ -432,7 +432,7 @@ function updateNumRatsCalculator() {
|
||||
|
||||
|
||||
// Send telemetry
|
||||
td.signal("Update.NumRatsCalc", {
|
||||
send("Update.NumRatsCalc", {
|
||||
width: width,
|
||||
depth: depth,
|
||||
height: height,
|
||||
|
@ -30,7 +30,27 @@ function getOrCreateUUID() {
|
||||
}
|
||||
}
|
||||
|
||||
export const td = new TelemetryDeck({
|
||||
// Send Test Signals when running locally
|
||||
function init() {
|
||||
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
|
||||
const td = new TelemetryDeck({
|
||||
appID: '4A88C6F5-2BDE-489E-9834-34D89FD5473F',
|
||||
clientUser: getOrCreateUUID(),
|
||||
testMode: true
|
||||
});
|
||||
return td;
|
||||
} else {
|
||||
const td = new TelemetryDeck({
|
||||
appID: '4A88C6F5-2BDE-489E-9834-34D89FD5473F',
|
||||
clientUser: getOrCreateUUID()
|
||||
});
|
||||
});
|
||||
return td;
|
||||
}
|
||||
}
|
||||
|
||||
let td = init();
|
||||
|
||||
|
||||
export function send(type, payload) {
|
||||
td.signal(type, payload);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user