By baking this right into the browser, the browser controls the performance optimisation, so in the case of a resize event only for large viewports, on smaller viewports we won’t have any resize methods firing.
Jonathan Fielding
@jonthanfielding
On 7 Aug 2014, at 06:57, Simon Pieters <simonp@opera.com> wrote:
> On Wed, 06 Aug 2014 16:32:26 +0200, Jonathan Fielding <hello@jonathanfielding.com> wrote:
>
>> Hi
>>
>> What I meant was a resize event per MediaQueryList, if you look at www.simplestatemanager.com you would see that it allows your to have a enter, leave and resize event.
>>
>> So if we think of this in terms of the MediaQueryList, we currently have
>>
>> var mql = window.matchMedia("screen and (max-width:768px)");
>> mql.addListener(function(e){
>> if(e.matches){
>> console.log(‘matched');
>> }
>> else{
>> console.log(‘unmatched');
>> }
>> });
>>
>> But what we might have instead is:
>>
>> var mql = window.matchMedia("screen and (max-width:768px)”);
>>
>> mql.addEventListener(“match”, function(){
>> console.log(‘ive matched’);
>> });
>>
>> mql.addEventListener(“unmatch”, function(){
>> console.log(‘ive unmatched’);
>> });
>>
>> mql.addEventListener(“resize”, function(){
>> console.log(‘while matched and browser is resized I will fire’);
>> });
>>
>> So this gives us the ability to add a resize event specific to a “state” i.e. while the media query matches.
>
> OK, so this is just sugar, it doesn't enable any new abilities, right?
>
> --
> Simon Pieters
> Opera Software