Added uuid function to element class to easily allow generating uuid's. May move this later. Added reflect() option to reflect properties once changed via a function or another property. Added onResize function that adds a resize observer to the element constructed by a template and cleans it up nicely. Added onTouch event helper function. Modified reflect callback to allow calling functions or setting the value of a property.

This commit is contained in:
2021-01-09 16:24:24 -08:00
parent e58e6e58e4
commit e398b61c08
3 changed files with 88 additions and 3 deletions

View File

@ -299,6 +299,15 @@ class IgniteElement extends HTMLElement {
cleanup() {
}
/**
* Generates a uuid and returns it.
*/
uuid() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
}
export {