Browse Source
code review: fix updating of non-hosts resources
pull/2/head
Raymond Hill
7 years ago
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with
7 additions and
6 deletions
-
src/js/assets.js
-
src/js/storage.js
|
|
@ -53,9 +53,10 @@ api.removeObserver = function(observer) { |
|
|
|
|
|
|
|
var fireNotification = function(topic, details) { |
|
|
|
var result; |
|
|
|
for ( var i = 0; i < observers.length; i++ ) { |
|
|
|
if ( observers[i](topic, details) === false ) { |
|
|
|
result = false; |
|
|
|
for ( let i = 0; i < observers.length; i++ ) { |
|
|
|
let r = observers[i](topic, details); |
|
|
|
if ( r !== undefined && result === undefined ) { |
|
|
|
result = r; |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
@ -821,7 +822,7 @@ var updateNext = function() { |
|
|
|
if ( cacheEntry && (cacheEntry.writeTime + assetEntry.updateAfter * 86400000) > now ) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if ( fireNotification('before-asset-updated', { assetKey: assetKey }) !== false ) { |
|
|
|
if ( fireNotification('before-asset-updated', { assetKey: assetKey }) ) { |
|
|
|
return assetKey; |
|
|
|
} |
|
|
|
garbageCollectOne(assetKey); |
|
|
|
|
|
@ -558,9 +558,9 @@ |
|
|
|
if ( topic === 'before-asset-updated' ) { |
|
|
|
if ( |
|
|
|
this.liveHostsFiles.hasOwnProperty(details.assetKey) === false || |
|
|
|
this.liveHostsFiles[details.assetKey].off === true |
|
|
|
this.liveHostsFiles[details.assetKey].off !== true |
|
|
|
) { |
|
|
|
return false; |
|
|
|
return true; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|