API Docs for: 1.7.0
Show:

File: src/js/registerCoreEndpoints.js

'use strict';

/**
 * src/js/registerCoreEndpoints.js
 */

/**
 * Important methods that can be called through the core using the function execute
 * @example
 *  ice.execute(name-of-function, args....);
 * @class CoreEndpoints
 */

define(['./data/PlaceAvailabilityData'], function (PlaceData) {

  var registerFunction = function (plugin, name, callback) {
    plugin.core.registerProxy(name, function () {
      return callback.apply(plugin, arguments);
    });
  };

  var registerCoreEndpoints = function (plugin) {

    /**
     * handles unlocked offers
     * @method unlock-offers
     * @param {Array} password The password used to unlock these offer IDs
     * @param {Array} offerIds A list of offer IDs unlocked by this password
     * @return {Undefined}
     * @example
     *  ice.execute('unlock-offers', places);
     */

    registerFunction(plugin, 'unlock-offers', function (password, unlockedOfferIds) {
      PlaceData.unlockOffers(plugin, password, unlockedOfferIds);
    });

    /**
     * gets place availability data
     * @method get-place-data
     * @example
     *  ice.execute('get-place-data');
     */
    registerFunction(plugin, 'get-place-data', function () {
      return PlaceData.getPlaceData(plugin, plugin.core.map.renderedSections, plugin.placeUpdateInterval);
    });
  };
  return registerCoreEndpoints;
});