CSS Media Queries have a method window.matchMedia(), which gives a script the ability to listen for media query changes. Web Devs proposed that CSS Container Queries have the same functionality.
And then, CSSWG resolved this proposal as "RESOLVED: Add a matchContainer method as proposed in issue. Keep issue open to decide if need new observer or if we can reuse the existing".