Listening to MediaQueries Events with MatchMedia

With the method matchMedia you can listen to MediaQueries change events caused by device's breakpoints:

const media = matchMedia('(min-width: 600px)');
media.addEventListener("change", ({ media,matches}) => console.log(media,matches)); action:

See you at "Build to last" effectively progressive applications with webstandards only -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or (online).

Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition the podcast:

Stay in touch:


Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments