I cant seem to obfuscate, even when it does get obfuscated it stops working properly and throws error. obfuscators throw either unexpected token or error at async/await. here is the code
class LedgerElement extends HTMLElement {
__columns = [];//obfuscator throws unexpected token error
__footers = [];
__months = [];
constructor() {
super();
this.attachShadow({
mode: 'open'
});
this.shadowRoot.innerHTML = document.querySelector('#tmpLedger').innerHTML;
let parent = this,
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
this.columns = this.getAttribute('cols').split(',');
this.footers = this.getAttribute('fot').split(',');
this.status = this.getAttribute('stats').split(',');
this.months = months;
var d = new Date();
var n = d.getUTCMonth();
this.currentMonth = months[n];
this.shadowRoot.querySelector('#update').addEventListener("click", async function () {
await Promise.all([
getSelectedRows(parent).then((arrList) => {
arrList.forEach(range => getUpdateData(range, parent, "update"))
}),
count = 0,
calculateTotal(parent)
]);
});
for await/*<-obfuscator throws error*/ (let c of parent.querySelectorAll(`bbl-cell[col="8"]`)) {
let balanceCell = parseFloat(parent.querySelector(`bbl-cell[row="${c.row}"][col="9"]`).content);
maxCredit = c.content.length != 0 && c.content == 'YES' ? maxCredit + balanceCell : maxCredit + 0;
}
Thanks in advance, and sorry for my bad english.
I'm guessing you're probably using uglify, which does not support ES6+ syntax. Either transpile it with babel or use terser.
Fix your code and put your for await of loop inside an async function, then copy and paste your code here: https://try.terser.org/
Or use the transpiled output of babel with es2015,es2016, es2017, stage-0 presets on to feed to uglify or your obfuscator: babelified version of your code
There are a few other projects like babel-minify, but terser is one of the mature ones.