You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if it was possible to return an object when onMissingElement is set to 'exception'.
Sometimes I need to broadcast cards positioned according to a predefined order to my users. However, depending on what the user is looking for, the order may change or the card I'm using to position the new element with an insertAdjacentHtml may not be present on the page. I therefore use a specific method that allows me to deal with the error and find the position of the new card if necessary.
To make things easier, I'd need to know the operation that triggered the error, in order to retrieve the html and change the selector if necessary.
Something like this in cable_ready.js would be really great
constwarning=`CableReady ${name||''} operation failed due to missing DOM element for selector: '${operation.selector}'`switch(options.onMissingElement){case'ignore':
breakcase'event':
dispatch(document,'cable-ready:missing-element',{
warning,
operation
})breakcase'exception':
throw{name: 'MissingDOMError',operation: operation}default:
console.warn(warning)}}
Thanks,
Antoine
The text was updated successfully, but these errors were encountered:
Hello there,
I was wondering if it was possible to return an object when onMissingElement is set to 'exception'.
Sometimes I need to broadcast cards positioned according to a predefined order to my users. However, depending on what the user is looking for, the order may change or the card I'm using to position the new element with an insertAdjacentHtml may not be present on the page. I therefore use a specific method that allows me to deal with the error and find the position of the new card if necessary.
To make things easier, I'd need to know the operation that triggered the error, in order to retrieve the html and change the selector if necessary.
Something like this in
cable_ready.js
would be really greatThanks,
Antoine
The text was updated successfully, but these errors were encountered: