Last active
June 26, 2023 08:58
-
-
Save rofe/4d38d9ec8253cc2f4bec3dad757c33fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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