-
-
Notifications
You must be signed in to change notification settings - Fork 8
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 expectElement() #23
Conversation
Unfortunately I think the only way to achieve this would be to pre-wrap every callback to provide the source, .e.g. observe(selector, wrap(import.meta.url, addButton));
function addButton(parent) {
parent.append(<button/>)
} // utils.js
function wrap(feature, callback) {
return (...args) => {
try {
callback(...args)
} catch (error) {
features.log.error(feature, error);
}
}
} I think this would work, if we remember to wrap each and every callback 😬 This is where decorators would be useful, too bad they're only available to classes 🤦♂️ @callback(import.meta.url)
function addButton(parent) {
parent.append(<button/>)
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Looks great |
Closes #20