MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / addCommands

Method addCommands

www/js/_hyperscript.js:1565–1576  ·  view source on GitHub ↗
(...commandClasses)

Source from the content-addressed store, hash-verified

1563 this.#commands[keyword] = definition;
1564 }
1565 addCommands(...commandClasses) {
1566 for (const CommandClass of commandClasses) {
1567 if (!CommandClass.keyword) {
1568 throw new Error(`Command class ${CommandClass.name} must have a static 'keyword' property`);
1569 }
1570 if (!CommandClass.parse) {
1571 throw new Error(`Command class ${CommandClass.name} must have a static 'parse' method`);
1572 }
1573 var keywords = Array.isArray(CommandClass.keyword) ? CommandClass.keyword : [CommandClass.keyword];
1574 for (var kw of keywords) this.addCommand(kw, CommandClass.parse);
1575 }
1576 }
1577 addFeatures(...featureClasses) {
1578 for (const FeatureClass of featureClasses) {
1579 if (!FeatureClass.keyword) {

Callers

nothing calls this directly

Calls 1

addCommandMethod · 0.45

Tested by

no test coverage detected