From 6e08a3bf183a6ec20bf9ac8c03630d377ec91d0b Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 24 Aug 2014 21:37:05 -0400 Subject: [PATCH] need to access repo metadata through proper entry point --- js/assets.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/js/assets.js b/js/assets.js index 9e154adf7..63e484abb 100644 --- a/js/assets.js +++ b/js/assets.js @@ -284,7 +284,7 @@ var getRepoMetadata = function(callback) { if ( checksumsChanged ) { updateLocalChecksums(); } - // Fetch and store homeURL associations + // Notify all waiting callers while ( callback = repoMetadata.waiting.pop() ) { callback(repoMetadata); } @@ -342,6 +342,19 @@ var getRepoMetadata = function(callback) { /******************************************************************************/ +exports.setHomeURL = function(path, homeURL) { + var onRepoMetadataReady = function(metadata) { + var entry = metadata.entries[path]; + if ( entry === undefined ) { + entry = metadata.entries[path] = new AssetEntry(); + } + entry.homeURL = homeURL; + } + getRepoMetadata(onRepoMetadataReady); +}; + +/******************************************************************************/ + // Get a local asset, do not look-up repo or remote location if local asset // is not found. @@ -905,16 +918,6 @@ exports.metadata = function(callback) { /******************************************************************************/ -exports.setHomeURL = function(path, homeURL) { - var entry = repoMetadata[path]; - if ( entry === undefined ) { - entry = repoMetadata[path] = new AssetEntry(); - } - entry.homeURL = homeURL; -}; - -/******************************************************************************/ - exports.purge = function(pattern, before) { cachedAssetsManager.remove(pattern, before); };