Skip to content

Commit 70f13fc

Browse files
committed
add match to unmatch support
1 parent 5e557c9 commit 70f13fc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

matchMedia.addListener.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
last = false,
1111
timer,
1212
check = function(){
13-
var list = oldMM( q );
14-
if( list.matches && !last ){
13+
var list = oldMM( q ),
14+
unmatchToMatch = list.matches && !last,
15+
matchToUnmatch = !list.matches && last;
16+
if( unmatchToMatch || matchToUnmatch ){
1517
for( var i =0, il = listeners.length; i< il; i++ ){
1618
listeners[ i ].call( ret, list );
1719
}

0 commit comments

Comments
 (0)