When I add matchMedia listener:
matchMedia('print').onchange = (m) => { console.log('print matches', m.matches)}
And I open print dialog, I always see two logs:
print matches true
print matches false
After firing callback with value true
, there is immediately another callback with value false
even when printing dialog is still open. I would expect that this woud happen only after closing dialog.
Can someone explain to me why it happens?