From ab1fcea7954442e41148fc8a8ce86c3026a1ffa7 Mon Sep 17 00:00:00 2001 From: "Bruce B. Anderson" Date: Sat, 28 Dec 2024 14:32:31 -0500 Subject: [PATCH] 0.0.876 --- lib/hookUp.js | 11 +++++++++++ lib/hookUp.ts | 12 ++++++++++++ package.json | 6 +++++- tests/README.md | 2 +- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/hookUp.js b/lib/hookUp.js index ccadd4d9..9138a56a 100644 --- a/lib/hookUp.js +++ b/lib/hookUp.js @@ -37,4 +37,15 @@ export function hookUp(jsExpr) { this[handler](this, e); } }; + const prototype = mnt.prototype; + for (const key in commands) { + let handler = commands[key]; + let commandType = key; + if (Array.isArray(handler)) { + commandType = handler[0]; + handler = handler[1]; + } + prototype[key] = handler; + } + return mnt; } diff --git a/lib/hookUp.ts b/lib/hookUp.ts index a9ba1a01..07dd6a02 100644 --- a/lib/hookUp.ts +++ b/lib/hookUp.ts @@ -40,5 +40,17 @@ export function hookUp(jsExpr: string){ } } + const prototype = mnt.prototype; + for(const key in commands){ + let handler = commands[key]; + let commandType = key; + if(Array.isArray(handler)){ + commandType = handler[0]; + handler = handler[1]; + } + (prototype)[key] = handler; + } + + return mnt; } \ No newline at end of file diff --git a/package.json b/package.json index 363b8ee3..57292b7c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "test": "playwright test", "doc": "wca analyze trans-render.js --outFile custom-elements.json", "package-check": "package-check", - "safari": "npx playwright wk http://localhost:3030", + "safari": "npx playwright wk http://localhost:8000", "update": "ncu -u && npm install" }, "exports": { @@ -135,6 +135,10 @@ "./lib/getValFromEvent.js": "./lib/getValFromEvent.js", "./lib/Hashit.js": "./lib/Hashit.js", "./lib/homeInOn.js": "./lib/homeInOn.js", + "./lib/hookUp.js": { + "default": "./lib/hookUp.js", + "types": "./lib/hookUp.ts" + }, "./lib/html.js": "./lib/html.js", "./lib/interpolate.js": "./lib/interpolate.js", "./lib/isContainedIn.js": "./lib/isContainedIn.js", diff --git a/tests/README.md b/tests/README.md index df94a64b..3a5348ce 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1491,7 +1491,7 @@ Any web server that can serve static files will do, but... 4. Open command window to folder where you cloned this repo. 5. > npm install 6. > npm run serve -7. Open http://localhost:3030/demo/ in a modern browser. +7. Open http://localhost:8000/demo/ in a modern browser. ## Running Tests