const reverse = function (str: string) {
return str.split('').reverse().join('')
}
const random = () => {
return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16)
}
let currentIdTime : number;
let currentId = 0;
const nextId = () => {
const now = Date.now();
if (currentIdTime !== now) {
currentId = 0;
currentIdTime = now
}
const comingId = ++currentId;
const randomHex = reverse(random()).padStart(15, '0');
const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0'))
const comingIdHex = reverse(comingId.toString(16).padStart(3, '0'))
const newId = `p3x-angular-compile-${timeHex}${comingIdHex}${randomHex}`;
//console.log(newId)
return newId
}