Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CommandPalette.version property. #16

Open
rouilj opened this issue Jan 31, 2023 · 1 comment
Open

Add CommandPalette.version property. #16

rouilj opened this issue Jan 31, 2023 · 1 comment

Comments

@rouilj
Copy link
Contributor

rouilj commented Jan 31, 2023

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
Copy link
Contributor Author

rouilj commented Jan 31, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant