public/js/browser-calls.js
/**
    * @typedef {Object} EventPublisher.Options
    * @property {Object} [metadata=undefined] - A publisher_metadata object to send
    *   with each payload.
    * @property {String} [host='eventgw.twilio.com'] - The host address of the EA
    *   server to publish to.
    * @property {Object|Function} [defaultPayload] - A default payload to extend
    *   when creating and sending event payloads. Also takes a function that
    *   should return an object representing the default payload. This is
    *   useful for fields that should always be present when they are
    *   available, but are not always available.
    */
@typedef {Object} EventPublisher.Options
@property {Object} [metadata=undefined] - A publisher_metadata object to send
with each payload.
@property {String} [host='eventgw.twilio.com'] - The host address of the EA
server to publish to.
@property {Object|Function} [defaultPayload] - A default payload to extend
when creating and sending event payloads. Also takes a function that
should return an object representing the default payload. This is
useful for fields that should always be present when they are
available, but are not always available.
@typedef { Object } EventPublisher . Options @property { Object } [ metadata = undefined ] - A publisher_metadata object to send with each payload . @property { String } [ host = ' eventgw . twilio . com ' ] - The host address of the EA server to publish to . @property { Object|Function } [ defaultPayload ] - A default payload to extend when creating and sending event payloads . Also takes a function that should return an object representing the default payload . This is useful for fields that should always be present when they are available but are not always available .
function EventPublisher(productName, token, options) {
  if (!(this instanceof EventPublisher)) {
    return new EventPublisher(productName, token, options);
  }
  options = Object.assign({
    defaultPayload: function defaultPayload() {
      return {};
    },
    host: 'eventgw.twilio.com'
  }, options);
  var defaultPayload = options.defaultPayload;
  if (typeof defaultPayload !== 'function') {
    defaultPayload = function defaultPayload() {
      return Object.assign({}, options.defaultPayload);
    };
  }
  var isEnabled = true;
  var metadata = Object.assign({ app_name: undefined, app_version: undefined }, options.metadata);
  Object.defineProperties(this, {
    _defaultPayload: { value: defaultPayload },
    _isEnabled: {
      get: function get() {
        return isEnabled;
      },
      set: function set(_isEnabled) {
        isEnabled = _isEnabled;
      }
    },
    _host: { value: options.host },
    _request: { value: options.request || request, writable: true },
    _token: { value: token, writable: true },
    isEnabled: {
      enumerable: true,
      get: function get() {
        return isEnabled;
      }
    },
    metadata: {
      enumerable: true,
      get: function get() {
        return metadata;
      }
    },
    productName: { enumerable: true, value: productName },
    token: {
      enumerable: true,
      get: function get() {
        return this._token;
      }
    }
  });
}
function EventPublisher ( productName , token , options ) { if ( ! ( this instanceof EventPublisher ) ) { return new EventPublisher ( productName , token , options ) ; } options = Object . assign ( { defaultPayload : function defaultPayload ( ) { return { } ; } , host : 'eventgw.twilio.com' } , options ) ; var defaultPayload = options . defaultPayload ; if ( typeof defaultPayload !== 'function' ) { defaultPayload = function defaultPayload ( ) { return Object . assign ( { } , options . defaultPayload ) ; } ; } var isEnabled = true ; var metadata = Object . assign ( { app_name : undefined , app_version : undefined } , options . metadata ) ; Object . defineProperties ( this , { _defaultPayload : { value : defaultPayload } , _isEnabled : { get : function get ( ) { return isEnabled ; } , set : function set ( _isEnabled ) { isEnabled = _isEnabled ; } } , _host : { value : options . host } , _request : { value : options . request || request , writable : true } , _token : { value : token , writable : true } , isEnabled : { enumerable : true , get : function get ( ) { return isEnabled ; } } , metadata : { enumerable : true , get : function get ( ) { return metadata ; } } , productName : { enumerable : true , value : productName } , token : { enumerable : true , get : function get ( ) { return this . _token ; } } } ) ; }
@typedef {Object} EventPublisher.Options
 @property {Object} [metadata=undefined] - A publisher_metadata object to send
   with each payload.
@typedef { Object } EventPublisher . Options @property { Object } [ metadata = undefined ] - A publisher_metadata object to send with each payload .
// Apply default options // eslint-disable-next-line camelcase,no-undefined