File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 8686              '$window' , 
8787              '$log' , 
8888              '$timeout' , 
89+               '$document' , 
8990
9091              function ( 
9192                  $rootScope , 
9293                  $window , 
9394                  $log , 
94-                   $timeout 
95+                   $timeout , 
96+                   $document 
9597              ) { 
9698                function  isStorageSupported ( storageType )  { 
9799
190192
191193                // #6: Use `$window.addEventListener` instead of `angular.element` to avoid the jQuery-specific `event.originalEvent` 
192194                $window . addEventListener  &&  $window . addEventListener ( 'storage' ,  function ( event )  { 
193-                     if  ( storageKeyPrefix  ===  event . key . slice ( 0 ,  prefixLength ) )  { 
195+                     // Reference doc. 
196+                     var  doc  =  $document [ 0 ] ; 
197+                     // Figure out if hasFocus / hasFocus() exists. 
198+                     var  hasDocFocus  =  angular . isDefined ( doc . hasFocus ) ; 
199+ 
200+                     if  (  (  hasDocFocus  ? ( doc . hasFocus  ||  doc . hasFocus ( ) )  : true  )  &&  storageKeyPrefix  ===  event . key . slice ( 0 ,  prefixLength )  )  { 
194201                        event . newValue  ? $storage [ event . key . slice ( prefixLength ) ]  =  deserializer ( event . newValue )  : delete  $storage [ event . key . slice ( prefixLength ) ] ; 
195202
196203                        _last$storage  =  angular . copy ( $storage ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments