Add CommandPalette.version property.
rouilj opened this issue · 1 comments
rouilj commented
Would it be possible to add a version property to CommandPal? Would something like:
class CommandPal {
version = "0.2.7";
constructor(options) {
console.log("CommandPal", { options });
this.options = options || {};
this.ps = pubsub.create();
}
make:
cp = new CommandPal({
commands: {
name: "CommandPal version",
handler = () => (alert("CommandPal version " + CommandPal.version )),
},
name: "Another version method",
handler = () => (alert("CommandPal version " + cp.version )),
}
});
work?
Also in the docs, the handler definition is shown as:
// Callback function of the command to execute
handler: (e) => {
// DO SOMETHING
}
What is e
? From my testing it looks like it is undefined.
I assume there is some mechanism driven off of package.json to keep the version identifier up to date?
rouilj commented
Since I got the dev environment running I get an error when trying to define a class property. Neither:
class ... {
version = "0.2.7"
static myversion = "0.2.7"
}
seem to work. It throws a syntax error on the =
sign.
So maybe:
class ... {
version() { return "0.2.7"};
}
method is the way to go here if you think it's worthwhile.