benwinding / command-pal

The hackable command palette for the web, inspired by Visual Studio Code.
https://benwinding.github.io/command-pal/docs
MIT License
75 stars 8 forks source link

Display palette method #28

Open rouilj opened 1 year ago

rouilj commented 1 year ago

This addresses #25.

I am not sure if it's the right way to get App and CommandPal to cooperate, but it works.

// Display the instance
c.displayPalette(true)
// Hide the instance
c.displayPalette(false)
// Toggle from display -> hide or hide -> display
c.displayPalette()
rouilj commented 1 year ago

c.dispatch('close') maybe?

or a wrapper for it for opened/closed and to toggle.

benwinding commented 1 year ago

c.dispatch('close') maybe?

or a wrapper for it for opened/closed and to toggle.

Yeah that would be nice to be able to send events to the Command Pal instance 🤔 Then we'd have c.subscribe('...') and c.dispatch(...)