{ "version": 3, "sources": [ "node_modules/browserify/node_modules/browser-pack/_prelude.js", "/Users/johann/Development/network.js/lib/EventDispatcher.js", "/Users/johann/Development/network.js/lib/Http/BandwidthModule.js", "/Users/johann/Development/network.js/lib/Http/HttpModule.js", "/Users/johann/Development/network.js/lib/Http/LatencyModule.js", "/Users/johann/Development/network.js/lib/Network.js", "/Users/johann/Development/network.js/lib/Timing.js", "/Users/johann/Development/network.js/utils/helpers.js" ], "names": [], "mappings": "AAAA;;;;;;;;;;;;;;ICGqB,eAAe;;;;;;;;;;AAUrB,aAVM,eAAe,GAWhC;8BAXiB,eAAe;;;;;;;AAiB5B,YAAI,CAAC,eAAe,GAAG,EAAE,CAAC;KAC7B;;iBAlBgB,eAAe;;;;;;;;;;;eA4B9B,YAAC,MAAM,EAAE,QAAQ,EACnB;;;AACI,kBAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;;AAEnD,kBAAM,CAAC,OAAO,CAAC,UAAA,KAAK,EAAI;AACpB,oBAAI,cAAc,GAAG,MAAK,eAAe,CAAC,KAAK,CAAC,GAAG,MAAK,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;;;AAGrF,oBAAI,EAAC,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AACpC,kCAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACjC;aACJ,CAAC,CAAC;;AAEH,mBAAO,IAAI,CAAC;SACf;;;;;;;;;;;;eAUE,aAAC,MAAM,EACV;;;gBADY,QAAQ,gCAAG,IAAI;;AAEvB,kBAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;;AAEnD,kBAAM,CAAC,OAAO,CAAC,UAAA,KAAK,EAAI;AACpB,oBAAI,cAAc,GAAG,OAAK,eAAe,CAAC,KAAK,CAAC,CAAC;;;AAGj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CAAK,OAAO;AAAP,eAAO;;;AAEhD,WAAO,OAAO,mBAAC,IAAI,EAAE,MAAM,SAAK,OAAO,EAAC,CAAC;CAC5C;;;;;;;;;;;AAUM,SAAS,MAAM,CAAC,GAAG,EAAE,UAAU,EACtC;AACI,QAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;;AAExB,cAAU,CAAC,OAAO,CAAC,UAAA,KAAK;eAAI,OAAO,OAAO,CAAC,KAAK,CAAC;KAAA,CAAC,CAAC;;AAEnD,WAAO,OAAO,CAAC;CAClB;;;;;;;;;;AASM,SAAS,KAAK,GACrB;QADsB,IAAI,gCAAG,YAAM,EAAE;;;;;;AAMjC,WAAO;qBACQ,kBACX;;;AACI,gBAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACpB;;;;;;;;;;mBAOE,eACH;AACI,oBAAI,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;AAC3B,uBAAO,IAAI,CAAC,IAAI,CAAC;aACpB;;;;WACJ,CAAC;CACL", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o {\n var eventCallbacks = this._eventCallbacks[event] = this._eventCallbacks[event] || [];\n\n // If the callback isn't already registered, store it.\n if (!~eventCallbacks.indexOf(callback)) {\n eventCallbacks.push(callback);\n }\n });\n\n return this;\n }\n\n /**\n * Detach a callback from one or more events.\n * @public\n * @method EventDispatcher#off\n * @param {string|string[]} events One or multiple event names.\n * @param {EventDispatcher~eventHandler} callback An event handler.\n * @returns {EventDispatcher}\n */\n off(events, callback = null)\n {\n events = Array.isArray(events) ? events : [events];\n\n events.forEach(event => {\n var eventCallbacks = this._eventCallbacks[event];\n\n // If there is no specified callback, simply delete all the callbacks binded to the provided event.\n if (!callback && eventCallbacks) {\n delete this._eventCallbacks[event];\n } else {\n var callbackIndex = eventCallbacks ? eventCallbacks.indexOf(callback) : -1;\n\n // If the callback is registered, remove it from the array.\n if (callbackIndex != -1) {\n eventCallbacks.splice(callbackIndex, 1);\n }\n }\n });\n\n return this;\n }\n\n /**\n * Trigger an event.\n * @public\n * @method EventDispatcher#trigger\n * @param {string} event An event name.\n * @param {...*} extraParameters Some extra parameters to pass to the event handlers.\n * @returns {boolean} Returns `false` if one of the event handlers explicitly returned `false`.\n */\n trigger(event, ...extraParameters)\n {\n var eventCallbacks = this._eventCallbacks[event] || [];\n\n // A callback can return a boolean value which will be logically compared to the other callbacks values before\n // being returned by the trigger() method. This allows a callback to send a \"signal\" to the caller, like\n // cancelling an action.\n var returnValue = true;\n\n eventCallbacks.forEach(eventCallback => {\n // A callback must explicitly return false if it wants the trigger() method to return false, undefined will\n // not work. This avoids crappy callbacks to mess up with the triggering system.\n var value = eventCallback(...extraParameters);\n value = value !== false ? true : false;\n\n returnValue = returnValue && value; // Compare the result of the callback to the actual return value\n });\n\n return returnValue;\n }\n\n}\n", "import HttpModule from './HttpModule';\nimport Timing from '../Timing';\nimport {defer} from '../../utils/helpers';\n\n/**\n * @public\n * @typedef {Object} BandwidthModule~settingsObject\n * @extends HttpModule~settingsObject\n * @property {Object} data\n * @property {number} data.size The amount of data to initially use.\n * @property {number} [data.multiplier=2] If the measure period can't reach the delay defined in the settings, the data amount is multiplied by the following value.\n */\n\n/**\n * Apply a new set of custom settings.\n * @public\n * @method BandwidthModule#settings\n * @param {BandwidthModule~settingsObject} settings A set of custom settings.\n * @returns {BandwidthModule}\n */\n/**\n * Return the current set of settings.\n * @public\n * @method BandwidthModule#settings^2\n * @returns {BandwidthModule~settingsObject}\n */\n\n/**\n * @class BandwidthModule\n * @extends HttpModule\n * @param {string} loadingType The loading type, `upload` or `download`.\n * @param {BandwidthModule~settingsObject} [settings={}] A set of custom settings.\n */\nexport default class BandwidthModule extends HttpModule {\n\n constructor(loadingType, settings = {})\n {\n loadingType = (~['upload', 'download'].indexOf(loadingType)) ? loadingType : 'download';\n\n super(loadingType);\n\n this._extendDefaultSettings({\n data: {\n // 2 MB for upload, 10 MB for download\n size: loadingType == 'upload' ? (2 * 1024 * 1024) : (10 * 1024 * 1024),\n multiplier: 2\n }\n }).settings(settings);\n\n // Define the object properties\n this._loadingType = loadingType;\n\n this._intendedEnd = false;\n this._isRestarting = false;\n\n this._lastLoadedValue = null;\n this._speedRecords = [];\n this._avgSpeed = null;\n\n this._requestID = 0;\n this._progressID = 0;\n\n this._started = false;\n this._firstProgress = true;\n this._deferredProgress;\n\n // Unique labels for each request, exclusively used to make measures.\n this._timingLabels = {\n start: null,\n progress: null,\n end: null,\n measure: null\n };\n\n // Bind to XHR events\n this.on('xhr-upload-loadstart', () => Timing.mark(this._timingLabels.start));\n this.on('xhr-readystatechange', xhr => {\n if (!this._started && xhr.readyState == XMLHttpRequest.LOADING) {\n Timing.mark(this._timingLabels.start);\n this._started = true;\n }\n });\n\n var eventsPrefix = (loadingType == 'upload') ? 'xhr-upload' : 'xhr';\n\n this.on(`${eventsPrefix}-progress`, (xhr, event) => this._progress(event));\n this.on(`${eventsPrefix}-timeout`, () => this._timeout());\n this.on(`${eventsPrefix}-loadend`, () => this._end());\n }\n\n /**\n * Start requesting the server to make measures.\n * @public\n * @method BandwidthModule#start\n * @returns {BandwidthModule}\n */\n start()\n {\n var loadingType = this._loadingType,\n dataSettings = this.settings().data,\n reqID = this._requestID++;\n\n this._intendedEnd = false;\n this._lastLoadedValue = null;\n this._speedRecords = [];\n this._started = false;\n this._firstProgress = true;\n this._deferredProgress = defer();\n\n // Trigger the start event\n if (!this._isRestarting) {\n this.trigger('start', dataSettings.size);\n }\n\n // Create unique timing labels for the new request\n var labels = this._timingLabels;\n labels.start = `${loadingType}-${reqID}-start`;\n labels.progress = `${loadingType}-${reqID}-progress`;\n labels.end = `${loadingType}-${reqID}-end`;\n labels.measure = `${loadingType}-${reqID}-measure`;\n\n // Generate some random data to upload to the server. Here we're using a Blob instead of an ArrayBuffer because\n // of a bug in Chrome (tested in v33.0.1750.146), causing a freeze of the page while trying to directly upload\n // an ArrayBuffer (through an ArrayBufferView). The freeze lasts nearly 4.5s for 10MB of data. Using a Blob\n // seems to solve the problem.\n var blob = (loadingType == 'upload') ? new Blob([new ArrayBuffer(dataSettings.size)]) : null;\n\n var type = (loadingType == 'download') ? 'GET' : 'POST';\n\n // Initiate and send a new request\n this._newRequest(type, {\n size: dataSettings.size\n })._sendRequest(blob);\n\n return this;\n }\n\n /**\n * Abort the measures.\n * @public\n * @method BandwidthModule#abort\n * @returns {BandwidthModule}\n */\n abort()\n {\n this._intendedEnd = true;\n return this._abort();\n }\n\n /**\n * Make bandwidth measures for the current request.\n * @private\n * @method BandwidthModule#_progress\n * @param {ProgressEvent} event The event associated with the progress event of the current request.\n * @returns {BandwidthModule}\n */\n _progress(event)\n {\n // Ignore the first progress event, it generally contributes to get incoherent values.\n if (this._firstProgress) return this._firstProgress = false;\n\n // Execute the previous progress trigger\n this._deferredProgress.run();\n\n var labels = this._timingLabels,\n progressID = this._progressID++,\n markLabel = `${labels.progress}-${progressID}`,\n loaded = event.loaded;\n\n Timing.mark(markLabel);\n\n // Measure the average speed (B/s) since the request started\n var avgMeasure = Timing.measure(\n `${labels.measure}-avg-${progressID}`,\n labels.start,\n markLabel\n ),\n avgSpeed = loaded / avgMeasure * 1000;\n\n var instantSpeed;\n\n if (!this._lastLoadedValue) { // We are executing the first progress event of the current request\n instantSpeed = avgSpeed; // The instant speed of the first progress event is equal to the average one\n } else {\n // Measure the instant speed (B/s), which defines the speed between two progress events.\n var instantMeasure = Timing.measure(\n `${labels.measure}-instant-${progressID}`,\n // Set the mark of the previous progress event as the starting point\n `${labels.progress}-${progressID - 1}`,\n markLabel\n );\n instantSpeed = (loaded - this._lastLoadedValue) / instantMeasure * 1000;\n }\n\n // Save the `loaded` property of the event for the next progress event\n this._lastLoadedValue = loaded;\n\n // Defer measures saving and event triggering, this allows to cancel the last progress event, which can generate\n // incoherent values.\n this._deferredProgress = defer(() => {\n this._avgSpeed = avgSpeed;\n this._speedRecords.push(instantSpeed);\n\n this.trigger('progress', avgSpeed, instantSpeed);\n });\n\n return this;\n }\n\n /**\n * Mark the current request as entirely finished (this means it ended after a time out).\n * @private\n * @method BandwidthModule#_timeout\n * @returns {BandwidthModule}\n */\n _timeout()\n {\n this._intendedEnd = true;\n return this;\n }\n\n /**\n * End the measures.\n * @private\n * @method BandwidthModule#_end\n * @returns {BandwidthModule}\n */\n _end()\n {\n // A timeout or an abort occured, bypass the further requests and trigger the \"end\" event.\n if (this._intendedEnd) {\n this._isRestarting = false;\n this.trigger('end', this._avgSpeed, this._speedRecords);\n }\n\n // The request ended to early, restart it with an increased data size.\n else {\n var loadingType = this._loadingType,\n dataSettings = this.settings().data;\n\n dataSettings.size *= dataSettings.multiplier;\n\n this.trigger('restart', dataSettings.size);\n\n this._isRestarting = true;\n this.start();\n }\n\n return this;\n }\n\n\n}\n", "import EventDispatcher from '../EventDispatcher';\nimport {isObject, assign, assignStrict} from '../../utils/helpers';\n\n/**\n * @public\n * @typedef {Object} HttpModule~settingsObject\n * @property {string} [endpoint=./network.php] Where is located your `network.php` file.\n * @property {number} [delay=8000] The delay while you want to take measures.\n */\n\n/**\n * @class HttpModule\n * @extends EventDispatcher\n * @param {string} moduleName The name of the instanciated module.\n * @param {HttpModule~settingsObject} [settings={}] A set of custom settings.\n */\nexport default class HttpModule extends EventDispatcher {\n\n constructor(moduleName, settings = {})\n {\n super();\n\n this._extendDefaultSettings({\n endpoint: './network.php',\n delay: 8000\n });\n\n this.settings(settings);\n\n this._moduleName = moduleName;\n this._xhr = null;\n this._lastURLToken = null;\n\n this._requestingOverridden = false;\n this._requesting = false;\n\n // Each time a request starts or ends, set the requesting value unless it has been overridden with the\n // _setRequesting() method.\n this.on(['xhr-loadstart', 'xhr-upload-loadstart'], () => {\n if (!this._requestingOverridden) {\n this._requesting = true;\n }\n });\n\n this.on(['xhr-loadend', 'xhr-upload-loadend'], () => {\n if (!this._requestingOverridden) {\n this._requesting = false;\n }\n });\n }\n\n /**\n * Apply a new set of custom settings.\n * @public\n * @method HttpModule#settings\n * @param {HttpModule~settingsObject} settings A set of custom settings.\n * @returns {HttpModule}\n */\n /**\n * Return the current set of settings.\n * @public\n * @method HttpModule#settings^2\n * @returns {HttpModule~settingsObject}\n */\n settings(settings = null)\n {\n if (isObject(settings)) {\n this._settings = assignStrict(this._defaultSettings || {}, this._settings || {}, settings);\n return this;\n } else {\n return this._settings || this._defaultSettings || {};\n }\n }\n\n /**\n * Return if the module is currently making a request.\n * @public\n * @method HttpModule#isRequesting\n * @returns {boolean} `true` if the module is requesting, otherwise `false`.\n */\n isRequesting()\n {\n return this._requesting;\n }\n\n /**\n * Extend the set of default settings.\n * @protected\n * @method HttpModule#_extendDefaultSettings\n * @param {Object} settings The new properties to add to the default settings.\n * @returns {HttpModule}\n */\n _extendDefaultSettings(settings)\n {\n this._defaultSettings = assign(this._defaultSettings || {}, settings);\n return this;\n }\n\n /**\n * Create a new XHR request.\n * @protected\n * @method HttpModule#_newRequest\n * @param {string} httpMethod The HTTP method to use with the request, GET or POST.\n * @param {Object} queryParams The query parameters to use with the request.\n * @returns {HttpModule}\n */\n _newRequest(httpMethod, queryParams)\n {\n // Check if a callback binded to the \"_newRequest\" event returns false, if it's the case, cancel the request\n // creation. If the requesting status has been overridden, there's no need to cancel the request since the user\n // should know what he's doing.\n if (!this.trigger('_newRequest') && !this._requestingOverridden) {\n console.warn('To ensure accurate measures, you can only make one request at a time.');\n return this;\n }\n\n let settings = this.settings(),\n xhr = new XMLHttpRequest(),\n validHttpMethods = ['GET', 'POST'];\n\n // Prepare the new request.\n if (!~validHttpMethods.indexOf(httpMethod)) {\n console.warn('The HTTP method must be GET or POST.');\n return this;\n }\n\n queryParams = queryParams || {};\n\n // Generate an URL token to avoid any caching issues. This token will also allow to identify the request in the\n // Resource Timing entries.\n let tokenSuffix = (new Date).getTime();\n this._lastURLToken = `network-${tokenSuffix}`;\n\n // Append the query parameters\n let url = settings.endpoint;\n url += ~url.indexOf('?') ? '&' : '?';\n url += `module=${this._moduleName}`;\n\n Object.keys(queryParams).forEach(param => {\n let value = encodeURIComponent(queryParams[param]);\n url += `&${param}=${value}`;\n });\n\n url += `&${this._lastURLToken}`;\n\n xhr.open(httpMethod, url);\n\n // Abort the previous request if it hasn't been sent\n if (this._xhr && this._xhr.readyState == XMLHttpRequest.OPENED) {\n this._xhr.abort();\n }\n\n // Replace the old request by the new one\n this._xhr = xhr;\n\n // Bind all the XHR events\n const events = [\n 'loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend', 'readystatechange'\n ];\n\n events.forEach(eventType => {\n xhr.addEventListener(eventType, (...args) => {\n // A last progress event can be triggered once a request has timed out, ignore it.\n if (eventType == 'progress' && !this._requesting) return;\n\n this.trigger(`xhr-${eventType}`, xhr, ...args);\n });\n\n // The XMLHttpRequestUpload interface supports all the above event types except the \"readystatechange\" one\n if (eventType != 'readystatechange') {\n xhr.upload.addEventListener(eventType, (...args) => {\n this.trigger(`xhr-upload-${eventType}`, xhr, ...args);\n });\n }\n });\n\n // Define the timeout of the request. We don't use the native `timeout` property since it can distort the\n // measures.\n // See: https://github.com/nesk/network.js/issues/26\n const startTimeout = xhr => {\n this.trigger('xhr-timeout');\n this.trigger('xhr-upload-timeout');\n setTimeout(() => xhr.abort(), settings.delay);\n };\n\n this.on('xhr-upload-loadstart', startTimeout).on('xhr-readystatechange', (timeoutStarted => {\n return xhr => {\n if (!timeoutStarted && xhr.readyState == XMLHttpRequest.LOADING) {\n timeoutStarted = true;\n startTimeout(xhr);\n }\n };\n })(false));\n\n return this;\n }\n\n /**\n * Send a newly created XHR request.\n * @protected\n * @method HttpModule#_sendRequest\n * @param {?*} [data=null] The data to send with the request.\n * @returns {HttpModule}\n */\n _sendRequest(data = null)\n {\n if (this._xhr && this._xhr.readyState == XMLHttpRequest.OPENED) {\n this._xhr.send(data);\n } else {\n console.warn('A request must have been created before sending any data.');\n }\n\n return this;\n }\n\n /**\n * Abort the current request.\n * @protected\n * @method HttpModule#_abort\n * @returns {HttpModule}\n */\n _abort()\n {\n if (this._xhr) {\n this._xhr.abort();\n }\n\n return this;\n }\n\n /**\n * Get the Resource Timing entry associated to the current request.\n * @protected\n * @method HttpModule#_getTimingEntry\n * @param {HttpModule~timingCallback} callback A callback used to send back the timing entry.\n * @returns {HttpModule}\n */\n _getTimingEntry(callback)\n {\n // The Resource Timing entries aren't immediately available once the 'load' event is triggered by an\n // XMLHttpRequest, we must wait for another process tick to check for a refreshed list.\n setTimeout((lastURLToken => {\n return () => {\n // Filter the timing entries to return only the one concerned by the last request made\n let entries = performance.getEntriesByType('resource').filter(function(entry) {\n return ~entry.name.indexOf(lastURLToken);\n });\n\n /**\n * A callback used to send back the timing entry.\n * @private\n * @callback HttpModule~timingCallback\n * @param {PerformanceResourceTiming} entry The Resource Timing entry associated to the current request.\n */\n callback(entries.length ? entries[0] : null);\n };\n })(this._lastURLToken), 0);\n\n return this;\n }\n\n /**\n * Override the requesting status of the module.\n * @protected\n * @method HttpModule#_setRequesting\n * @param {boolean} isRequesting The requesting status.\n * @returns {HttpModule}\n */\n _setRequesting(isRequesting)\n {\n this._requestingOverridden = true;\n this._requesting = isRequesting;\n return this;\n }\n\n}\n", "import HttpModule from './HttpModule';\nimport Timing from '../Timing';\nimport {isObject, assignStrict, except} from '../../utils/helpers';\n\n/**\n * @public\n * @typedef {Object} LatencyModule~settingsObject\n * @property {string} [endpoint=./network.php] Where is located your `network.php` file.\n * @property {number} [measures=5] How many measures should be returned.\n * @property {number} [attempts=3] How much attempts to get a valid value should be done for each measure.\n */\n\n/**\n * @class LatencyModule\n * @extends HttpModule\n * @param {LatencyModule~settingsObject} [settings={}] A set of custom settings.\n */\nexport default class LatencyModule extends HttpModule {\n\n constructor(settings = {})\n {\n super('latency');\n\n this._extendDefaultSettings({\n measures: 5,\n attempts: 3\n }).settings(settings);\n\n // Define the object properties\n this._requestsLeft = 0;\n this._attemptsLeft = 0;\n\n this._latencies = [];\n this._requestID = 0;\n\n // Unique labels for each request, exclusively used to make measures.\n this._timingLabels = {\n start: null,\n end: null,\n measure: null\n };\n\n // Measure the latency with the Resource Timing API once the request is finished\n if (Timing.supportsResourceTiming()) {\n this.on('xhr-load', () => this._measure());\n }\n\n // If the browser doesn't support the Resource Timing API, we fallback on a Datetime solution.\n else {\n // Set a mark when the request starts\n this.on('xhr-loadstart', () => Timing.mark(this._timingLabels.start));\n\n // Then make a measure with the previous mark\n this.on('xhr-readystatechange', xhr => this._measure(xhr));\n }\n }\n\n /**\n * Apply a new set of custom settings.\n * @public\n * @method LatencyModule#settings\n * @param {LatencyModule~settingsObject} settings A set of custom settings.\n * @returns {LatencyModule}\n */\n /**\n * Return the current set of settings.\n * @public\n * @method LatencyModule#settings^2\n * @returns {LatencyModule~settingsObject}\n */\n settings(settings = null)\n {\n if (isObject(settings)) {\n return super.settings(assignStrict(settings, {\n delay: 0 // We dont want any timeout during a latency calculation\n }));\n } else {\n return except(super.settings(), ['delay']);\n }\n }\n\n /**\n * Start requesting the server to make measures.\n * @public\n * @method LatencyModule#start\n * @returns {LatencyModule}\n */\n start()\n {\n // Set the number of requests required to establish the network latency. If the browser doesn't support the\n // Resource Timing API, add a request that will be ignored to avoid a longer request due to a possible\n // DNS/whatever fetch.\n let {measures, attempts} = this.settings();\n\n this._requestsLeft = measures;\n this._attemptsLeft = attempts * measures;\n\n if (!Timing.supportsResourceTiming()) {\n this._requestsLeft++;\n this._attemptsLeft++;\n }\n\n // Override the requesting value since a complete latency request consists off multiple ones\n this._setRequesting(true);\n\n this._latencies = [];\n this._nextRequest();\n\n return this;\n }\n\n /**\n * Initiate the next request used for latency measures.\n * @private\n * @method LatencyModule#_nextRequest\n * @param {boolean} [retry=false] Defines if the next request is a retry due to a failing request or not.\n * @returns {LatencyModule}\n */\n _nextRequest(retry = false)\n {\n const reqID = this._requestID++;\n let requestsLeft = retry ? this._requestsLeft : this._requestsLeft--;\n\n if (this._attemptsLeft-- && (requestsLeft || retry)) {\n // Create unique timing labels for the new request\n var labels = this._timingLabels;\n labels.start = `latency-${reqID}-start`;\n labels.end = `latency-${reqID}-end`;\n labels.measure = `latency-${reqID}-measure`;\n\n // Create the new request and send it\n this._newRequest('GET')._sendRequest();\n } else {\n // All the requests are finished, set the requesting status to false.\n this._setRequesting(false);\n\n // If all the requests have been executed, calculate the average latency. Since the _getTimingEntry() method\n // is asynchronous, wait for the next process tick to execute the _end() method, to be sure that all the\n // latencies have been retrieved.\n setTimeout(() => this._end(), 0);\n }\n\n return this;\n }\n\n /**\n * Make latency measures for the last request.\n * @private\n * @method LatencyModule#_measure\n * @param {?XMLHttpRequest} [xhr=null] The concerned XMLHttpRequest if the browser doesn't support the Resource Timing API.\n * @returns {LatencyModule}\n */\n _measure(xhr = null)\n {\n // With Resource Timing API\n if (!xhr) {\n this._getTimingEntry(entry => {\n // The latency calculation differs between an HTTP and an HTTPS connection\n // See: http://www.w3.org/TR/resource-timing/#processing-model\n let latency = !entry.secureConnectionStart\n ? entry.connectEnd - entry.connectStart\n : entry.secureConnectionStart - entry.connectStart;\n\n if (latency) this._latencies.push(latency);\n this._nextRequest(!latency);\n });\n }\n\n // Without Resource Timing API\n else if (this._requestsLeft < this.settings().measures) {\n\n // Measure and save the latency if the headers have been received\n if (xhr.readyState == XMLHttpRequest.HEADERS_RECEIVED) {\n let labels = this._timingLabels;\n\n Timing.mark(labels.end);\n let latency = Timing.measure(labels.measure, labels.start, labels.end);\n\n if (latency) this._latencies.push(latency);\n\n // Abort the current request before we run a new one\n this._abort();\n this._nextRequest(!latency);\n }\n\n }\n\n // Ignore the first request when using the XHR states. See the comments in the start() method for explanations.\n else {\n this._nextRequest();\n }\n\n return this;\n }\n\n /**\n * End the measures.\n * @private\n * @method LatencyModule#_end\n * @returns {LatencyModule}\n */\n _end()\n {\n let latencies = this._latencies;\n\n // Get the average latency\n let avgLatency = latencies.reduce((a, b) => a + b, 0) / (latencies.length || 1);\n avgLatency = avgLatency || null;\n\n // If there is not enough measures, display a warning.\n if (latencies.length < this.settings().measures) {\n let {measures, attempts} = this.settings();\n\n console.warn([\n 'An insufficient number of measures have been processed, this could be due to your web server using',\n `persistant connections or to your client settings (measures: ${measures}, attempts: ${attempts})`\n ].join(' '));\n }\n\n // Trigger the \"end\" event with the average latency and the latency list as parameters\n this.trigger('end', avgLatency, latencies);\n\n return this;\n }\n\n}\n", "import EventDispatcher from './EventDispatcher';\nimport HttpModule from './Http/HttpModule';\nimport LatencyModule from './Http/LatencyModule';\nimport BandwidthModule from './Http/BandwidthModule';\nimport Timing from './Timing';\nimport {getGlobalObject, isObject, assign, except} from '../utils/helpers';\n\n/**\n * @public\n * @typedef {Object} Network~settingsObject\n * @property {LatencyModule~settingsObject} latency\n * @property {BandwidthModule~settingsObject} upload\n * @property {BandwidthModule~settingsObject} download\n * @example\n * {\n * // Top-level properties are applied to all the modules\n * endpoint: './my-new-endpoint/',\n *\n * // Top-level properties will be overridden by the ones specified in each module\n * latency: {\n * endpoint: './my-new-latency-endpoint/'\n * }\n * }\n */\n\n/**\n * @class Network\n * @param {Network~settingsObject} [settings={}] A set of custom settings.\n * @member {LatencyModule} latency The latency module.\n * @member {BandwidthModule} upload The upload module.\n * @member {BandwidthModule} download The download module.\n */\nexport default class Network {\n\n /**\n * Expose all the internal classes to the global scope. Only for testing purposes!\n * @private\n * @method Network._exposeInternalClasses\n * @returns {Network}\n */\n static _exposeInternalClasses()\n {\n let global = getGlobalObject(),\n classes = {EventDispatcher, HttpModule, LatencyModule, BandwidthModule, Timing};\n\n Object.keys(classes).forEach(name => {\n global[name] = classes[name];\n });\n\n return this;\n }\n\n constructor(settings = {})\n {\n this._modules = {};\n this._modulesInitialized = false;\n this._pendingSettings = {};\n\n this._registerModule('latency', settings => new LatencyModule(settings))\n ._registerModule('upload', settings => new BandwidthModule('upload', settings))\n ._registerModule('download', settings => new BandwidthModule('download', settings));\n\n this._initModules(this.settings(settings));\n }\n\n /**\n * Apply a new set of custom settings.\n * @public\n * @method Network#settings\n * @param {Network~settingsObject} settings A set of custom settings.\n * @returns {Network}\n */\n /**\n * Return the current set of settings.\n * @public\n * @method Network#settings^2\n * @returns {Network~settingsObject}\n */\n settings(settings = null)\n {\n let moduleNames = Object.keys(this._modules);\n\n if (isObject(settings)) {\n // Extract the global settings\n let globalSettings = except(settings, moduleNames);\n\n // Extract the local settings\n let localSettings = except(settings, Object.keys(globalSettings));\n\n // Create new settings with the global ones nested in the local ones\n settings = moduleNames.reduce((settings, moduleName) => {\n return assign(settings, {[moduleName]: globalSettings});\n }, {});\n\n // Apply the local settings to the new settings\n settings = assign(settings, localSettings);\n\n // Apply the settings to the modules\n if (this._modulesInitialized) {\n Object.keys(this._modules).forEach(name => {\n this._modules[name].settings(settings[name]);\n });\n }\n\n // If the modules aren't instanciated, store the settings.\n else {\n this._pendingSettings = settings;\n }\n\n return this;\n } else {\n return moduleNames.reduce((settings, moduleName) => {\n return assign(settings, {[moduleName]: this._modules[moduleName].settings()});\n }, {});\n }\n }\n\n /**\n * Return if a module is currently making a request.\n * @public\n * @method Network#isRequesting\n * @returns {boolean} `true` if a module is requesting, otherwise `false`.\n */\n isRequesting()\n {\n let requesting = false;\n\n for (let name in this._modules) {\n if (this._modules.hasOwnProperty(name)) {\n requesting = requesting || this._modules[name].isRequesting();\n }\n }\n\n return requesting;\n }\n\n /**\n * Register a new module for the current `Network` instance.\n * @private\n * @method Network#registerModule\n * @param {string} name The name of the module. Will be used to create the property `Network.`.\n * @param {Network~moduleCallback} moduleCallback A callback used to initialize a module with a set of settings.\n * @returns {Network}\n */\n _registerModule(name, moduleCallback)\n {\n /**\n * A callback used to initialize a module with a set of settings.\n * @private\n * @callback Network~moduleCallback\n * @param {Object} settings A set of custom settings.\n * @returns {HttpModule} An instanciated subclass of `HttpModule`.\n */\n this._modules[name] = moduleCallback;\n return this;\n }\n\n /**\n * Initialize all the registered modules with the settings passed to the constructor.\n * @private\n * @method Network#_initModules\n * @returns {Network}\n */\n _initModules()\n {\n if (!this._modulesInitialized) {\n // Initialize the modules with their respective settings\n Object.keys(this._modules).forEach(name => {\n this._modules[name] = this._modules[name](this._pendingSettings[name]).on('_newRequest', () => {\n return !this.isRequesting();\n });\n\n this[name] = this._modules[name];\n });\n\n this._modulesInitialized = true;\n }\n\n return this;\n }\n\n}\n", "import {getGlobalObject} from '../utils/helpers';\n\n/**\n * @private\n * @class Timing\n */\nclass Timing {\n\n constructor()\n {\n const global = getGlobalObject();\n\n /**\n * Defines if the current browser supports some specific Timing APIs.\n * @private\n * @member {Object} _support\n * @property {boolean} performance `true` if the Performance API is available.\n * @property {boolean} userTiming `true` if the User Timing API is available.\n * @property {boolean} resourceTiming `true` if the Resource Timing API is available.\n */\n this._support = {\n performance: !!global.performance,\n userTiming: global.performance && performance.mark,\n resourceTiming: global.performance\n && (typeof performance.getEntriesByType == \"function\")\n && performance.timing\n };\n\n /**\n * Contains all the marks created by the `mark` method.\n * @private\n * @member {Object} _marks\n */\n this._marks = {};\n\n /**\n * Contains all the measures created by the `measure` method.\n * @private\n * @member {Object} _measures\n */\n this._measures = {};\n }\n\n /**\n * Create a new timing mark.\n * @public\n * @method Timing#mark\n * @param {string} label A label associated to the mark.\n * @returns {Timing}\n */\n mark(label)\n {\n const support = this._support,\n marks = this._marks;\n\n if (support.userTiming) {\n performance.mark(label);\n }\n\n if (support.performance) {\n marks[label] = performance.now();\n } else {\n marks[label] = (new Date).getTime();\n }\n\n return this;\n }\n\n /**\n * Measure the delay between two marks.\n * @public\n * @method Timing#measure\n * @param {string} measureLabel A label associated to the measure.\n * @param {string} markLabelA The label of the first mark.\n * @param {string} markLabelB The label of the second mark.\n * @returns {number} The measured value.\n */\n measure(measureLabel, markLabelA, markLabelB)\n {\n const support = this._support,\n marks = this._marks,\n measures = this._measures;\n\n if (typeof measures[measureLabel] == 'undefined') {\n const measureWithoutUserTiming = marks[markLabelB] - marks[markLabelA];\n\n if (support.userTiming) {\n performance.measure(measureLabel, markLabelA, markLabelB);\n const entriesByName = performance.getEntriesByName(measureLabel);\n\n // The performance API could return no corresponding entries in Firefox so we must use a fallback.\n // See: https://github.com/nesk/network.js/issues/32#issuecomment-118434305\n measures[measureLabel] = entriesByName.length ? entriesByName[0].duration : measureWithoutUserTiming;\n } else {\n measures[measureLabel] = measureWithoutUserTiming;\n }\n }\n\n return measures[measureLabel];\n }\n\n /**\n * Determine if the current browser supports the Resource Timing API.\n * @public\n * @method Timing#supportsResourceTiming\n * @returns {boolean} `true` if the Resource Timing API is supported, otherwise `false`.\n */\n supportsResourceTiming()\n {\n return this._support.resourceTiming;\n }\n\n}\n\nexport default new Timing();\n", "/**\n * Return the global object.\n * @private\n * @function getGlobalObject\n * @return {Object}\n * @see https://gist.github.com/rauschma/1bff02da66472f555c75\n */\nexport function getGlobalObject() {\n // Workers don’t have `window`, only `self`.\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n }\n\n // Not all environments allow `eval` and `Function`, use only as a last resort.\n return new Function('return this')();\n}\n\n/**\n * Determine if the provided value is an object.\n * @private\n * @function isObject\n * @param {*} obj The value to check.\n * @returns {boolean} `true` if the value is an object, otherwise `false`.\n */\nexport function isObject(obj)\n{\n return obj != undefined && obj != null && typeof obj.valueOf() == 'object';\n}\n\n/**\n * Make a deep copy of any value.\n * @private\n * @function copy\n * @param {*} value The value to copy.\n * @returns {*} The copied value.\n */\nexport function copy(value)\n{\n return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Copy the properties in the source objects over to the destination object.\n * @private\n * @function _assign\n * @param {boolean} strict Given `true`, new properties will not be copied.\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nfunction _assign(strict, target = {}, ...sources)\n{\n target = copy(target);\n\n sources.forEach(source => {\n Object.keys(source).forEach(key => {\n if (!strict || target.hasOwnProperty(key)) {\n let value = source[key];\n target[key] = isObject(value) ? _assign(strict, target[key], value) : value;\n }\n })\n });\n\n return target;\n}\n\n/**\n * Copy all the properties in the source objects over to the destination object.\n * @private\n * @function assign\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nexport function assign(target = {}, ...sources)\n{\n return _assign(false, target, ...sources);\n}\n\n/**\n * Copy the properties (but no new ones) in the source objects over to the destination object.\n * @private\n * @function assignStrict\n * @param {Object} [target={}] The destination object.\n * @param {...Object} sources The source objects.\n * @returns {Object} The destination object once the properties are copied.\n */\nexport function assignStrict(target = {}, ...sources)\n{\n return _assign(true, target, ...sources);\n}\n\n/**\n * Get a copy of an object without some of its properties.\n * @private\n * @function except\n * @param {Object} obj The original object.\n * @param {string[]} properties The properties to exclude from the copied object.\n * @returns {Object} The copied object without the specified properties.\n */\nexport function except(obj, properties)\n{\n let objCopy = copy(obj);\n\n properties.forEach(index => delete objCopy[index]);\n\n return objCopy;\n}\n\n/**\n * Defer the execution of a function.\n * @private\n * @function defer\n * @param {Function} func The function to defer.\n * @returns {Defer} The Defer object used to execute the function when needed.\n */\nexport function defer(func = () => {})\n{\n /**\n * @private\n * @class Defer\n */\n return new class {\n constructor()\n {\n this.func = func;\n }\n\n /**\n * Execute the deferred function.\n * @public\n * @method Defer#run\n */\n run()\n {\n if (this.func) this.func();\n delete this.func;\n }\n };\n}\n" ] }