api.js
function (callback) {
    var plugins = this.internals.plugins;
    var self = this;

    return Promise.resolve(Object.keys(APIHooks))
      .each(function (hook) {
        var plugin = plugins.hook(hook);
        if (!plugin) return;

        var APIHook = APIHooks[hook].bind(self);

        return Promise.resolve(plugin)
          .map(function (plugin) {
            return plugin[hook]();
          })
          .each(function (args) {
            return APIHook.apply(self, args);
          });
      })
      .asCallback(callback);
  }
function (callback) {
    var plugins = this.internals.plugins;
    var self = this;

    return Promise.resolve(Object.keys(APIHooks))
      .each(function (hook) {
        var plugin = plugins.hook(hook);
        if (!plugin) return;

        var APIHook = APIHooks[hook].bind(self);

        return Promise.resolve(plugin)
          .map(function (plugin) {
            return plugin[hook]();
          })
          .each(function (args) {
            return APIHook.apply(self, args);
          });
      })
      .asCallback(callback);
  }
function ( callback ) { var plugins = this . internals . plugins ; var self = this ; return Promise . resolve ( Object . keys ( APIHooks ) ) . each ( function ( hook ) { var plugin = plugins . hook ( hook ) ; if ( ! plugin ) return ; var APIHook = APIHooks [ hook ] . bind ( self ) ; return Promise . resolve ( plugin ) . map ( function ( plugin ) { return plugin [ hook ] ( ) ; } ) . each ( function ( args ) { return APIHook . apply ( self , args ) ; } ) ; } ) . asCallback ( callback ) ; }
Registers and initializes hooks.

@returns Promise
Registers and initializes hooks .