Skip to content

Commit

Permalink
0.0.876
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Dec 28, 2024
1 parent c0548f1 commit ab1fcea
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/hookUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 12 additions & 0 deletions lib/hookUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,17 @@ export function hookUp<T extends HTMLElement>(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];
}
(<any>prototype)[key] = handler;
}

return mnt;

}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ab1fcea

Please sign in to comment.