Improving the 3 apps

This commit is contained in:
metacryst
2025-11-07 20:14:38 -06:00
parent cb526b5ec0
commit e17efce338
13 changed files with 364 additions and 84 deletions

View File

@@ -1,6 +1,7 @@
/*
Sam Russell
Captured Sun
11.7.25 - changed registerShadow() to register(), changed onClick() to be like onHover()
11.6.25 - adding default value for "button()" "children" parameter
10.29.25 - adding "gap()" and "label()" functions
*/
@@ -186,7 +187,7 @@ window.Shadow = class extends HTMLElement {
super()
}
}
window.registerShadow = (el, tagname) => {
window.register = (el, tagname) => {
if (typeof el.prototype.render !== 'function') {
throw new Error("Element must have a render: " + el.prototype.constructor.name)
}
@@ -713,7 +714,10 @@ HTMLElement.prototype.onAppear = function(func) {
};
HTMLElement.prototype.onClick = function(func) {
this._storeListener("click", func);
const onMouseDown = () => func.call(this, true);
const onMouseUp = () => func.call(this, false);
this._storeListener("mousedown", onMouseDown);
this._storeListener("mouseup", onMouseUp);
return this;
};