text: /**
   * @file fn.js
   */
  'use strict';
  
  Object.defineProperty(exports, '__esModule', {
    value: true
  });
  
  var _guidJs = require('./guid.js');
  
  /**
   * Bind (a.k.a proxy or Context). A simple method for changing the context of a function
   * It also stores a unique id on the function so it can be easily removed from events
   *
   * @param  {*}   context The object to bind as scope
   * @param  {Function} fn      The function to be bound to a scope
   * @param  {Number=}   uid     An optional unique ID for the function to be set
   * @return {Function}
   * @private
   * @method bind
   */
  var bind = function bind(context, fn, uid) {
    // Make sure the function has a unique ID
    if (!fn.guid) {
      fn.guid = (0, _guidJs.newGUID)();
    }
  
    // Create the new function that changes the context
    var ret = function ret() {
      return fn.apply(context, arguments);
    };
  
    // Allow for the ability to individualize this function
    // Needed in the case where multiple objects might share the same prototype
    // IF both items add an event listener with the same function, then you try to remove just one
    // it will remove both because they both have the same guid.
    // when using this, you need to use the bind method when you remove the listener as well.
    // currently used in text tracks
    ret.guid = uid ? uid + '_' + fn.guid : fn.guid;
  
    return ret;
  };
  exports.bind = bind;