Skip to content
Snippets Groups Projects
Commit aab3c1fd authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Add function makeId

parent 92cebd58
No related branches found
No related tags found
No related merge requests found
...@@ -91,5 +91,24 @@ export default { ...@@ -91,5 +91,24 @@ export default {
} }
customElements.define(name, constructor, options); customElements.define(name, constructor, options);
return true; return true;
},
/**
* Creates a random id
*
* taken from: https://stackoverflow.com/a/1349426/1581487
*
* @param length
* @returns {string}
*/
makeId: (length) => {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
} }
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment