MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / addCommands

Method addCommands

src/core/kernel.js:271–282  ·  view source on GitHub ↗
(...commandClasses)

Source from the content-addressed store, hash-verified

269 }
270
271 addCommands(...commandClasses) {
272 for (const CommandClass of commandClasses) {
273 if (!CommandClass.keyword) {
274 throw new Error(`Command class ${CommandClass.name} must have a static 'keyword' property`);
275 }
276 if (!CommandClass.parse) {
277 throw new Error(`Command class ${CommandClass.name} must have a static 'parse' method`);
278 }
279 var keywords = Array.isArray(CommandClass.keyword) ? CommandClass.keyword : [CommandClass.keyword];
280 for (var kw of keywords) this.addCommand(kw, CommandClass.parse);
281 }
282 }
283
284 addFeatures(...featureClasses) {
285 for (const FeatureClass of featureClasses) {

Callers

nothing calls this directly

Calls 1

addCommandMethod · 0.95

Tested by

no test coverage detected