Skip to content

Instantly share code, notes, and snippets.

@rofe
Last active June 26, 2023 08:58
Show Gist options
  • Save rofe/4d38d9ec8253cc2f4bec3dad757c33fc to your computer and use it in GitHub Desktop.
Save rofe/4d38d9ec8253cc2f4bec3dad757c33fc to your computer and use it in GitHub Desktop.
const foo = ({ detail }) => {
const sk = detail.data;
// your custom code from button.action goes here
};
const sk = document.querySelector('helix-sidekick');
if (sk) {
// sidekick already loaded
sk.addEventListener('custom:foo', foo);
} else {
// wait for sidekick to be loaded
document.addEventListener('sidekick-ready', () => {
document.querySelector('helix-sidekick')
.addEventListener('custom:foo', foo);
}, { once: true });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment