is there any way to put something like Token or UUID generator function like :
function generateToken() {
var d = new Date().getTime();
if(window.performance && typeof window.performance.now === "function"){
d += performance.now();; //use high-precision timer if available
}
var uuid = 'xxxxxxxxxxxx9xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
});
return uuid;
};
function getUUID() {
var d = new Date().getTime();
if(window.performance && typeof window.performance.now === "function"){
d += performance.now();; //use high-precision timer if available
}
var uuid = 'xxxxxxxxxxxx7xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
});
return uuid;
};
https://mobileapp.mydomain.com/gettoken
https://mobileapp.mydomain.com/getUUID
Yes.
You could put it in a mixin which gets added to every model or create a middleware component which performs these functions which you can call.
Hi,
thanks but i dont know why this line is not accepted and shows error.
if(window.performance && typeof window.performance.now === "function"){
d += performance.now();; //use high-precision timer if available
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.
Most helpful comment
Yes.
You could put it in a mixin which gets added to every model or create a middleware component which performs these functions which you can call.