Loads the prefs for this `Scope` from the `Storage`.

@return {Promise} Promise that is resolved once loading is complete
323412
function () {
            var result = new $.Deferred();
            this.storage.load()
                .then(function (data) {
                    var oldKeys = this.getKeys();
                    this.data = data;
                    result.resolve();
                    this.trigger(PREFERENCE_CHANGE, {
                        ids: _.union(this.getKeys(), oldKeys)
                    });
                }.bind(this))
                .fail(function (error) {
                    result.reject(error);
                });
            return result.promise();
        }
41793
function getCache() {
      return new Promise(function(resolve, reject) {
        // create and fetch the cache key
        get(getKey(), function(err, data) {
          if (err) {
            return reject(err);
          }
          resolve(data);
        });
      });
    }
221447
function initCache (cachePath) {
    return new Promise(function (resolve, reject) {
      mkdirp(cachePath, function (err) {
        if (err) {
          reject(err)
        } else {
          resolve()
        }
      })
    })
  }
1258918
function()
    {
        var url       = this.tableUrl;
        var _this     = this;
        var d         = new Q.defer();
        var tableInfo;

        this.getTableInfo()
        .then(function(info) {
            tableInfo = info;
            return Q.nfcall(request, url + '/index.html');
        })
        .then(function(data) {
            var $        = cheerio.load(data);
            var list     = $('#tables li');
            var requests = [];

            list.each(function() {
                var $this = this;
                var title = $this.find('a').text();
                var link  = $this.find('a').attr('href');

                // Once we've got the table, add the description and fire an
                // update back on the promise
                var p = _this.getTableFields(url + '/' + link);
                p.then(function(t) { t.description = tableInfo[t.tableName]; });
                p.then(function(s) { d.notify(s.tableName); });
                requests.push(p);
            });

            Q.spread(requests, function() {
                d.resolve(_(arguments).toArray());
            });

        });

        return d.promise;
    }
1265323
function preferencesInitialize() {
    return this.initializedPromise =
        this._readFromStorage(DEFAULT_PREFERENCES).then(function(prefObj) {
      this.isInitializedPromiseResolved = true;
      if (prefObj) {
        this.prefs = prefObj;
      }
    }.bind(this));
  }
77004
function updateScope(updates, scopeDefinition, currentScope, partialName, updatesName) {
    scopeDefinition = scopeDefinition || {};

    // if no updates, that is an issue
    if (!updates) {
        throw new Error(partialName + ' model() does not return a value');
    }

    // we don't do anything with a partial promise on the server side
    if (updates.toString() !== '[object Promise]') {
        if (updatesName) {
            currentScope[updatesName] = updates;
        }
        else {

            // we are loading each of the update values into the current scope
            _.each(updates, function (updateVal, updateName) {

                // if an update name is on the scope definition, throw error since it is from the parent scope
                if (scopeDefinition[updateName]) {
                    throw new Error(partialName + ' model() returns a value ' + updateName + ' that is from the parent scope.');
                }

                currentScope[updateName] = updateVal;
            });
        }
    }
}
144121
function getPromise(provider, extension) {
			var contentTypeIds = provider.getProperty("contentType") || provider.getProperty("contentTypes"), //$NON-NLS-1$ //$NON-NLS-0$
			    fileTypes = provider.getProperty("fileTypes"); // backwards compatibility //$NON-NLS-0$
			if (contentTypeIds) {
				return Deferred.when(contentTypeService.isSomeExtensionOf(contentType, contentTypeIds)).then(
					function (isMatch) {
						return isMatch ? provider : null;
					});
			} else if (extension && fileTypes && fileTypes.indexOf(extension) !== -1) {
				var d = new Deferred();
				d.resolve(provider);
				return d;
			}
			return null;
		}
923411
function () {
				var that = this;
				return Promise.resolve().then(function () {
					var oCfg = sap.ui.getCore().getConfiguration();
					if (!oCfg.isUI5CacheOn()) {
						safeClearInstance(that);
						sap.ui.getCore().getConfiguration().setUI5CacheOn(true);
					}
					return Promise.resolve();
				});
			}
1097132
function loadPartials (options) {
    // return cached partials if caching enabled
    if (options.cache && GLOBAL.partials) {
        return GLOBAL.partials
    }
    // load partials
    GLOBAL.partials = loadTemplates(GLOBAL.partialDirs, options)
    // return promise that will be resolved with partials
    return GLOBAL.partials
}
169353
function loadScopes(scopes) {
  var scopeMapping = {};
  if (typeof scopes === 'object') {
    for (var s in scopes) {
      var routes = [];
      var entries = scopes[s];
      debug('Scope: %s routes: %j', s, entries);
      if (Array.isArray(entries)) {
        for (var j = 0, k = entries.length; j < k; j++) {
          var route = entries[j];
          if (typeof route === 'string') {
            routes.push({methods: ['all'], path: route,
              regexp: pathToRegexp(route, [], {end: false})});
          } else {
            var methods = helpers.normalizeList(methods);
            if (methods.length === 0) {
              methods.push('all');
            }
            methods = methods.map(toLowerCase);
            routes.push({methods: methods,
              path: route.path,
              regexp: pathToRegexp(route.path, [], {end: false})});
          }
        }
      } else {
        debug('Routes must be an array: %j', entries);
      }
      scopeMapping[s] = routes;
    }
  } else if (typeof scopes === 'string') {
    scopes = helpers.normalizeList(scopes);
    for (var i = 0, n = scopes.length; i < n; i++) {
      scopeMapping[scopes[i]] = [
        {methods: 'all', path: '/.+', regexp: /\/.+/}
      ];
    }
  }
  return scopeMapping;
}
790246
function() {
  return Promise.resolve()
  .then(function() { return npm.loadAsync(); })
  .then(function(npm) {
    npm.config.set('spin', false);
    npm.config.set('global', true);
    npm.config.set('depth', 0);
    return Promise.promisify(npm.commands.list)([], true);
  })
  .then(function(data) { return data; });
}
663393
function _initStorage(options) {
	        var self = this;
	        var dbInfo = {};
	        if (options) {
	            for (var i in options) {
	                dbInfo[i] = options[i];
	            }
	        }

	        dbInfo.keyPrefix = dbInfo.name + '/';

	        if (dbInfo.storeName !== self._defaultConfig.storeName) {
	            dbInfo.keyPrefix += dbInfo.storeName + '/';
	        }

	        self._dbInfo = dbInfo;

	        return new Promise(function (resolve, reject) {
	            resolve(__webpack_require__(3));
	        }).then(function (lib) {
	            dbInfo.serializer = lib;
	            return Promise.resolve();
	        });
	    }
264211
function loadLocale(localeUrl, $locale, localeId, $rootScope, $q, localeCache, $timeout) {

    function overrideValues(oldObject, newObject) {
      if (activeLocale !== localeId) {
        return;
      }
      angular.forEach(oldObject, function(value, key) {
        if (!newObject[key]) {
          delete oldObject[key];
        } else if (angular.isArray(newObject[key])) {
          oldObject[key].length = newObject[key].length;
        }
      });
      angular.forEach(newObject, function(value, key) {
        if (angular.isArray(newObject[key]) || angular.isObject(newObject[key])) {
          if (!oldObject[key]) {
            oldObject[key] = angular.isArray(newObject[key]) ? [] : {};
          }
          overrideValues(oldObject[key], newObject[key]);
        } else {
          oldObject[key] = newObject[key];
        }
      });
    }


    if (promiseCache[localeId]) return promiseCache[localeId];

    var cachedLocale,
      deferred = $q.defer();
    if (localeId === activeLocale) {
      deferred.resolve($locale);
    } else if ((cachedLocale = localeCache.get(localeId))) {
      activeLocale = localeId;
      $rootScope.$evalAsync(function() {
        overrideValues($locale, cachedLocale);
        $rootScope.$broadcast('$localeChangeSuccess', localeId, $locale);
        storage.put(storeKey, localeId);
        deferred.resolve($locale);
      });
    } else {
      activeLocale = localeId;
      promiseCache[localeId] = deferred.promise;
      loadScript(localeUrl, function () {
        // Create a new injector with the new locale
        var localInjector = angular.injector(['ngLocale']),
          externalLocale = localInjector.get('$locale');

        overrideValues($locale, externalLocale);
        localeCache.put(localeId, externalLocale);
        delete promiseCache[localeId];

        $rootScope.$apply(function () {
          $rootScope.$broadcast('$localeChangeSuccess', localeId, $locale);
          storage.put(storeKey, localeId);
          deferred.resolve($locale);
        });
      }, function () {
        delete promiseCache[localeId];

        $rootScope.$apply(function () {
          $rootScope.$broadcast('$localeChangeError', localeId);
          deferred.reject(localeId);
        });
      }, $timeout);
    }
    return deferred.promise;
  }
1246036
function fetchResults(searchText) {
      var items = $scope.$parent.$eval(self.remoteMethod),
        isList = angular.isArray(items),
        isPromise = items ? !!items.then : false; // Every promise should contain a `then` property

      if (isList) onResultsRetrieved(items);
      else if (isPromise) handleAsyncResults(items);

      function handleAsyncResults(items) {
        if (!items) return;

        items = $q.when(items);
        setLoading(true);
        items.then(onResultsRetrieved);
      }

      function onResultsRetrieved(matches) {

        // Just cache the results if the request is now outdated.
        // The request becomes outdated, when the new searchText has changed during the result fetching.
        if ((searchText || '') !== (self.searchText || '')) {
          return;
        }

        handleResults(matches);
      }
    }
1317272
function readFile() {
                    return new Promise(function (resolve, reject) {
                        /** @type {?} */
                        var reader = new FileReader();
                        reader.onload = function (event) {
                            resolve(reader.result);
                        };
                        reader.onerror = function (err) {
                            reject(err);
                        };
                        reader.readAsDataURL(file);
                    });
                }
259540
function preferencesInitialize() {
          return this.initializedPromise = defaultPreferences.then(function (defaults) {
            Object.defineProperty(this, 'defaults', {
              value: Object.freeze(defaults),
              writable: false,
              enumerable: true,
              configurable: false
            });
            this.prefs = cloneObj(defaults);
            return this._readFromStorage(defaults);
          }.bind(this)).then(function (prefObj) {
            this.isInitializedPromiseResolved = true;
            if (prefObj) {
              this.prefs = prefObj;
            }
          }.bind(this));
        }
912983
function(options) {
    var self = this;

    options = options || {};

    var error = options.error;

    var fns = [
      _.bind(self.preFetch, self, options),
      _.bind(PromisedModel.prototype.fetch, self, options),
      _.bind(self.afterFetch, self, options)
    ];
    return sequence(fns).then(function () {
      self.fetchStatus = 'fetched';
      return self;
    }, function (err) {
      if (error) error.call(options, self, err);
      return failWithError(options, err);
    });
  }