src/app-registry.js
/**
 * Loads the public and private app registry resources, adds them
 * to the profile, and returns the profile.
 * Called by the profile.loadAppRegistry() alias method.
 * Usage:
 *
 *   ```
 * var profile = solid.getProfile(url, options)
 *   .then(function (profile) {
 *     return profile.loadAppRegistry(options)
 *   })
 *   ```
 * @method loadAppRegistry
 * @param profile {SolidProfile}
 * @param webClient {SolidWebClient}
 * @param [options={}] Options hashmap (see solid.web.solidRequest()
 *   function docs)
 * @return {Promise<SolidProfile>}
 */
Loads the public and private app registry resources, adds them
to the profile, and returns the profile.
Called by the profile.loadAppRegistry() alias method.
Usage.


Loads the public and private app registry resources adds them to the profile and returns the profile . Called by the profile . loadAppRegistry () alias method . Usage .
function loadAppRegistry (profile, webClient, options) {
  options = options || {}
  options.headers = options.headers || {}
  if (!options.headers['Accept']) {
    options.headers['Accept'] = 'text/turtle'
  }
  var links = []
  if (profile.appRegistryListed.uri) {
    links.push(profile.appRegistryListed.uri)
  }
  if (profile.appRegistryUnlisted.uri) {
    links.push(profile.appRegistryUnlisted.uri)
  }
  return webClient.loadParsedGraphs(links, options)
    .then(function (loadedGraphs) {
      loadedGraphs.forEach(function (graph) {
        if (graph && graph.value) {
          profile.addAppRegistry(graph.value, graph.uri)
        }
      })
      return profile
    })
}
function loadAppRegistry ( profile , webClient , options ) { options = options || { } options . headers = options . headers || { } if ( ! options . headers [ 'Accept' ] ) { options . headers [ 'Accept' ] = 'text/turtle' } var links = [ ] if ( profile . appRegistryListed . uri ) { links . push ( profile . appRegistryListed . uri ) } if ( profile . appRegistryUnlisted . uri ) { links . push ( profile . appRegistryUnlisted . uri ) } return webClient . loadParsedGraphs ( links , options ) . then ( function ( loadedGraphs ) { loadedGraphs . forEach ( function ( graph ) { if ( graph && graph . value ) { profile . addAppRegistry ( graph . value , graph . uri ) } } ) return profile } ) }
Loads the public and private app registry resources, adds them
 to the profile, and returns the profile.
Loads the public and private app registry resources adds them to the profile and returns the profile .
// Politely ask for Turtle format // load public and private registry resources // For each registry resource loaded, add it to `profile.appRegistryListed` //  or `profile.appRegistryUnlisted` as appropriate