@ludens-reklame/profiler-client
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -23,4 +23,5 @@ interface Opts { | ||
updateContact(opts: UpdateContactOpts): Promise<void>; | ||
private handlePersonalizations; | ||
private network; | ||
} | ||
export default Profiler; |
@@ -46,2 +46,3 @@ "use strict"; | ||
} | ||
this.handlePersonalizations(); | ||
} | ||
@@ -97,5 +98,39 @@ Profiler.prototype.push = function (opts) { | ||
}; | ||
Profiler.prototype.handlePersonalizations = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response, data_1, error_3; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 4, , 5]); | ||
if (!window) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, fetch(profilerURL + "/personalizations", { | ||
mode: 'cors' | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
if (!(response.status === 200)) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, response.json()]; | ||
case 2: | ||
data_1 = (_a.sent()); | ||
document.addEventListener('DOMContentLoaded', function () { | ||
for (var i = 0; i < data_1.length; i++) { | ||
var ps = data_1[i]; | ||
document.body.innerHTML += ps.code; | ||
} | ||
}); | ||
_a.label = 3; | ||
case 3: return [3 /*break*/, 5]; | ||
case 4: | ||
error_3 = _a.sent(); | ||
console.error(error_3); | ||
return [3 /*break*/, 5]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Profiler.prototype.network = function (endpoint, data, asJSON) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, response, json, error_3; | ||
var url, response, json, error_4; | ||
return __generator(this, function (_a) { | ||
@@ -128,4 +163,4 @@ switch (_a.label) { | ||
case 3: | ||
error_3 = _a.sent(); | ||
console.error(error_3); | ||
error_4 = _a.sent(); | ||
console.error(error_4); | ||
return [3 /*break*/, 4]; | ||
@@ -132,0 +167,0 @@ case 4: return [2 /*return*/]; |
{ | ||
"name": "@ludens-reklame/profiler-client", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"description": "Profiler for all", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12235
203
2