Skip to content
Discussion options

You must be logged in to vote

This should work:

const ref = document.querySelector("[data-md-component=palette]")
component$.subscribe(component => {
  if (component.ref === ref) {
    alert$.next(`Changed to "${component.color.scheme}"`)
    console.log(component.index, component.color)
  }
})

In general you can monitor all components through the component$ observable. There's also the document$ observable to monitor document changes (instant loading) and location$ to track location changes, and more:

window.document$ = document$ /* Document observable */
window.location$ = location$ /* Location subject */
window.target$ =

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eyllanesc
Comment options

Answer selected by eyllanesc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants