@chapeaux/cpx-user
Advanced tools
Comparing version 0.7.4 to 0.8.0
@@ -22,2 +22,3 @@ export declare class CPXUser extends HTMLElement { | ||
_worker: any; | ||
get worker(): any; | ||
constructor(); | ||
@@ -29,4 +30,5 @@ connectedCallback(): void; | ||
camelCase(str: String, to?: boolean): string; | ||
onMessage(e: any): void; | ||
onmessage(e: any): void; | ||
dispatchEDDL(): Promise<void>; | ||
initWorker(): Promise<void>; | ||
} |
@@ -19,4 +19,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this._ready = false; | ||
this._worker = new Worker(import.meta.url.replace('cpx-user.js', 'user.js')); | ||
this.onMessage = this.onMessage.bind(this); | ||
this.onmessage = this.onmessage.bind(this); | ||
} | ||
@@ -86,3 +85,3 @@ get userId() { | ||
set user(val) { | ||
if (this._user === val) | ||
if (this._user === val || typeof val === 'undefined') | ||
return; | ||
@@ -112,2 +111,3 @@ this._user = val; | ||
} | ||
get worker() { return this._worker; } | ||
connectedCallback() { | ||
@@ -121,3 +121,3 @@ let data = this.querySelector("script"); | ||
}); | ||
this._worker.onmessage = this.onMessage; | ||
this.initWorker(); | ||
} | ||
@@ -151,3 +151,3 @@ static get observedAttributes() { | ||
} | ||
onMessage(e) { | ||
onmessage(e) { | ||
const data = e.data; | ||
@@ -174,3 +174,3 @@ if (data.action) { | ||
custKey: this.user['custKey'], | ||
accountID: this.user['account_number'] || '', | ||
ebsAccountNumber: this.user['account_number'] || '', | ||
userID: this.user['userID'], | ||
@@ -186,3 +186,15 @@ lastLoginDate: this.user['auth_time'], | ||
} | ||
initWorker() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
this._worker = new Worker(import.meta.url.replace('cpx-user.js', 'user.js')); | ||
this.worker['onmessage'] = this.onmessage; | ||
} | ||
catch (_a) { | ||
const { Peasant } = yield import(import.meta.url.replace('cpx-user.js', 'peasant.js')); | ||
this._worker = new Peasant(this); | ||
} | ||
}); | ||
} | ||
} | ||
window.customElements.define("cpx-user", CPXUser); |
{ | ||
"name": "@chapeaux/cpx-user", | ||
"version": "0.7.4", | ||
"version": "0.8.0", | ||
"description": "Chapeaux User Component", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -10,3 +10,3 @@ "use strict"; | ||
for (const [key, value] of values) { | ||
obj[value] = cookieMap.get(key); | ||
obj[value] = cookieMap.get(key) || ''; | ||
} | ||
@@ -13,0 +13,0 @@ return obj; |
50087
10
318