3367 lines
100 KiB
JavaScript
3367 lines
100 KiB
JavaScript
var Faye =
|
||
/******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId]) {
|
||
/******/ return installedModules[moduleId].exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ i: moduleId,
|
||
/******/ l: false,
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.l = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/******/
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
/******/
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
/******/
|
||
/******/ // define getter function for harmony exports
|
||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||
/******/ }
|
||
/******/ };
|
||
/******/
|
||
/******/ // define __esModule on exports
|
||
/******/ __webpack_require__.r = function(exports) {
|
||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
/******/ }
|
||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
/******/ };
|
||
/******/
|
||
/******/ // create a fake namespace object
|
||
/******/ // mode & 1: value is a module id, require it
|
||
/******/ // mode & 2: merge all properties of value into the ns
|
||
/******/ // mode & 4: return value when already ns object
|
||
/******/ // mode & 8|1: behave like require
|
||
/******/ __webpack_require__.t = function(value, mode) {
|
||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||
/******/ if(mode & 8) return value;
|
||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||
/******/ var ns = Object.create(null);
|
||
/******/ __webpack_require__.r(ns);
|
||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||
/******/ return ns;
|
||
/******/ };
|
||
/******/
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = function(module) {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ function getDefault() { return module['default']; } :
|
||
/******/ function getModuleExports() { return module; };
|
||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/
|
||
/******/ // Object.prototype.hasOwnProperty.call
|
||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||
/******/
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
/******/
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = "./src/faye_browser.js");
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ({
|
||
|
||
/***/ "./node_modules/asap/browser-asap.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/asap/browser-asap.js ***!
|
||
\*******************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
// rawAsap provides everything we need except exception management.
|
||
var rawAsap = __webpack_require__(/*! ./raw */ "./node_modules/asap/browser-raw.js");
|
||
// RawTasks are recycled to reduce GC churn.
|
||
var freeTasks = [];
|
||
// We queue errors to ensure they are thrown in right order (FIFO).
|
||
// Array-as-queue is good enough here, since we are just dealing with exceptions.
|
||
var pendingErrors = [];
|
||
var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
|
||
|
||
function throwFirstError() {
|
||
if (pendingErrors.length) {
|
||
throw pendingErrors.shift();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Calls a task as soon as possible after returning, in its own event, with priority
|
||
* over other events like animation, reflow, and repaint. An error thrown from an
|
||
* event will not interrupt, nor even substantially slow down the processing of
|
||
* other events, but will be rather postponed to a lower priority event.
|
||
* @param {{call}} task A callable object, typically a function that takes no
|
||
* arguments.
|
||
*/
|
||
module.exports = asap;
|
||
function asap(task) {
|
||
var rawTask;
|
||
if (freeTasks.length) {
|
||
rawTask = freeTasks.pop();
|
||
} else {
|
||
rawTask = new RawTask();
|
||
}
|
||
rawTask.task = task;
|
||
rawAsap(rawTask);
|
||
}
|
||
|
||
// We wrap tasks with recyclable task objects. A task object implements
|
||
// `call`, just like a function.
|
||
function RawTask() {
|
||
this.task = null;
|
||
}
|
||
|
||
// The sole purpose of wrapping the task is to catch the exception and recycle
|
||
// the task object after its single use.
|
||
RawTask.prototype.call = function () {
|
||
try {
|
||
this.task.call();
|
||
} catch (error) {
|
||
if (asap.onerror) {
|
||
// This hook exists purely for testing purposes.
|
||
// Its name will be periodically randomized to break any code that
|
||
// depends on its existence.
|
||
asap.onerror(error);
|
||
} else {
|
||
// In a web browser, exceptions are not fatal. However, to avoid
|
||
// slowing down the queue of pending tasks, we rethrow the error in a
|
||
// lower priority turn.
|
||
pendingErrors.push(error);
|
||
requestErrorThrow();
|
||
}
|
||
} finally {
|
||
this.task = null;
|
||
freeTasks[freeTasks.length] = this;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/asap/browser-raw.js":
|
||
/*!******************************************!*\
|
||
!*** ./node_modules/asap/browser-raw.js ***!
|
||
\******************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
// Use the fastest means possible to execute a task in its own turn, with
|
||
// priority over other events including IO, animation, reflow, and redraw
|
||
// events in browsers.
|
||
//
|
||
// An exception thrown by a task will permanently interrupt the processing of
|
||
// subsequent tasks. The higher level `asap` function ensures that if an
|
||
// exception is thrown by a task, that the task queue will continue flushing as
|
||
// soon as possible, but if you use `rawAsap` directly, you are responsible to
|
||
// either ensure that no exceptions are thrown from your task, or to manually
|
||
// call `rawAsap.requestFlush` if an exception is thrown.
|
||
module.exports = rawAsap;
|
||
function rawAsap(task) {
|
||
if (!queue.length) {
|
||
requestFlush();
|
||
flushing = true;
|
||
}
|
||
// Equivalent to push, but avoids a function call.
|
||
queue[queue.length] = task;
|
||
}
|
||
|
||
var queue = [];
|
||
// Once a flush has been requested, no further calls to `requestFlush` are
|
||
// necessary until the next `flush` completes.
|
||
var flushing = false;
|
||
// `requestFlush` is an implementation-specific method that attempts to kick
|
||
// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
|
||
// the event queue before yielding to the browser's own event loop.
|
||
var requestFlush;
|
||
// The position of the next task to execute in the task queue. This is
|
||
// preserved between calls to `flush` so that it can be resumed if
|
||
// a task throws an exception.
|
||
var index = 0;
|
||
// If a task schedules additional tasks recursively, the task queue can grow
|
||
// unbounded. To prevent memory exhaustion, the task queue will periodically
|
||
// truncate already-completed tasks.
|
||
var capacity = 1024;
|
||
|
||
// The flush function processes all tasks that have been scheduled with
|
||
// `rawAsap` unless and until one of those tasks throws an exception.
|
||
// If a task throws an exception, `flush` ensures that its state will remain
|
||
// consistent and will resume where it left off when called again.
|
||
// However, `flush` does not make any arrangements to be called again if an
|
||
// exception is thrown.
|
||
function flush() {
|
||
while (index < queue.length) {
|
||
var currentIndex = index;
|
||
// Advance the index before calling the task. This ensures that we will
|
||
// begin flushing on the next task the task throws an error.
|
||
index = index + 1;
|
||
queue[currentIndex].call();
|
||
// Prevent leaking memory for long chains of recursive calls to `asap`.
|
||
// If we call `asap` within tasks scheduled by `asap`, the queue will
|
||
// grow, but to avoid an O(n) walk for every task we execute, we don't
|
||
// shift tasks off the queue after they have been executed.
|
||
// Instead, we periodically shift 1024 tasks off the queue.
|
||
if (index > capacity) {
|
||
// Manually shift all values starting at the index back to the
|
||
// beginning of the queue.
|
||
for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
|
||
queue[scan] = queue[scan + index];
|
||
}
|
||
queue.length -= index;
|
||
index = 0;
|
||
}
|
||
}
|
||
queue.length = 0;
|
||
index = 0;
|
||
flushing = false;
|
||
}
|
||
|
||
// `requestFlush` is implemented using a strategy based on data collected from
|
||
// every available SauceLabs Selenium web driver worker at time of writing.
|
||
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
|
||
|
||
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
|
||
// have WebKitMutationObserver but not un-prefixed MutationObserver.
|
||
// Must use `global` or `self` instead of `window` to work in both frames and web
|
||
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
|
||
|
||
/* globals self */
|
||
var scope = typeof global !== "undefined" ? global : self;
|
||
var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
|
||
|
||
// MutationObservers are desirable because they have high priority and work
|
||
// reliably everywhere they are implemented.
|
||
// They are implemented in all modern browsers.
|
||
//
|
||
// - Android 4-4.3
|
||
// - Chrome 26-34
|
||
// - Firefox 14-29
|
||
// - Internet Explorer 11
|
||
// - iPad Safari 6-7.1
|
||
// - iPhone Safari 7-7.1
|
||
// - Safari 6-7
|
||
if (typeof BrowserMutationObserver === "function") {
|
||
requestFlush = makeRequestCallFromMutationObserver(flush);
|
||
|
||
// MessageChannels are desirable because they give direct access to the HTML
|
||
// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
|
||
// 11-12, and in web workers in many engines.
|
||
// Although message channels yield to any queued rendering and IO tasks, they
|
||
// would be better than imposing the 4ms delay of timers.
|
||
// However, they do not work reliably in Internet Explorer or Safari.
|
||
|
||
// Internet Explorer 10 is the only browser that has setImmediate but does
|
||
// not have MutationObservers.
|
||
// Although setImmediate yields to the browser's renderer, it would be
|
||
// preferrable to falling back to setTimeout since it does not have
|
||
// the minimum 4ms penalty.
|
||
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
|
||
// Desktop to a lesser extent) that renders both setImmediate and
|
||
// MessageChannel useless for the purposes of ASAP.
|
||
// https://github.com/kriskowal/q/issues/396
|
||
|
||
// Timers are implemented universally.
|
||
// We fall back to timers in workers in most engines, and in foreground
|
||
// contexts in the following browsers.
|
||
// However, note that even this simple case requires nuances to operate in a
|
||
// broad spectrum of browsers.
|
||
//
|
||
// - Firefox 3-13
|
||
// - Internet Explorer 6-9
|
||
// - iPad Safari 4.3
|
||
// - Lynx 2.8.7
|
||
} else {
|
||
requestFlush = makeRequestCallFromTimer(flush);
|
||
}
|
||
|
||
// `requestFlush` requests that the high priority event queue be flushed as
|
||
// soon as possible.
|
||
// This is useful to prevent an error thrown in a task from stalling the event
|
||
// queue if the exception handled by Node.js’s
|
||
// `process.on("uncaughtException")` or by a domain.
|
||
rawAsap.requestFlush = requestFlush;
|
||
|
||
// To request a high priority event, we induce a mutation observer by toggling
|
||
// the text of a text node between "1" and "-1".
|
||
function makeRequestCallFromMutationObserver(callback) {
|
||
var toggle = 1;
|
||
var observer = new BrowserMutationObserver(callback);
|
||
var node = document.createTextNode("");
|
||
observer.observe(node, {characterData: true});
|
||
return function requestCall() {
|
||
toggle = -toggle;
|
||
node.data = toggle;
|
||
};
|
||
}
|
||
|
||
// The message channel technique was discovered by Malte Ubl and was the
|
||
// original foundation for this library.
|
||
// http://www.nonblocking.io/2011/06/windownexttick.html
|
||
|
||
// Safari 6.0.5 (at least) intermittently fails to create message ports on a
|
||
// page's first load. Thankfully, this version of Safari supports
|
||
// MutationObservers, so we don't need to fall back in that case.
|
||
|
||
// function makeRequestCallFromMessageChannel(callback) {
|
||
// var channel = new MessageChannel();
|
||
// channel.port1.onmessage = callback;
|
||
// return function requestCall() {
|
||
// channel.port2.postMessage(0);
|
||
// };
|
||
// }
|
||
|
||
// For reasons explained above, we are also unable to use `setImmediate`
|
||
// under any circumstances.
|
||
// Even if we were, there is another bug in Internet Explorer 10.
|
||
// It is not sufficient to assign `setImmediate` to `requestFlush` because
|
||
// `setImmediate` must be called *by name* and therefore must be wrapped in a
|
||
// closure.
|
||
// Never forget.
|
||
|
||
// function makeRequestCallFromSetImmediate(callback) {
|
||
// return function requestCall() {
|
||
// setImmediate(callback);
|
||
// };
|
||
// }
|
||
|
||
// Safari 6.0 has a problem where timers will get lost while the user is
|
||
// scrolling. This problem does not impact ASAP because Safari 6.0 supports
|
||
// mutation observers, so that implementation is used instead.
|
||
// However, if we ever elect to use timers in Safari, the prevalent work-around
|
||
// is to add a scroll event listener that calls for a flush.
|
||
|
||
// `setTimeout` does not call the passed callback if the delay is less than
|
||
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
|
||
// even then.
|
||
|
||
function makeRequestCallFromTimer(callback) {
|
||
return function requestCall() {
|
||
// We dispatch a timeout with a specified delay of 0 for engines that
|
||
// can reliably accommodate that request. This will usually be snapped
|
||
// to a 4 milisecond delay, but once we're flushing, there's no delay
|
||
// between events.
|
||
var timeoutHandle = setTimeout(handleTimer, 0);
|
||
// However, since this timer gets frequently dropped in Firefox
|
||
// workers, we enlist an interval handle that will try to fire
|
||
// an event 20 times per second until it succeeds.
|
||
var intervalHandle = setInterval(handleTimer, 50);
|
||
|
||
function handleTimer() {
|
||
// Whichever timer succeeds will cancel both timers and
|
||
// execute the callback.
|
||
clearTimeout(timeoutHandle);
|
||
clearInterval(intervalHandle);
|
||
callback();
|
||
}
|
||
};
|
||
}
|
||
|
||
// This is for `asap.js` only.
|
||
// Its name will be periodically randomized to break any code that depends on
|
||
// its existence.
|
||
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
|
||
|
||
// ASAP was originally a nextTick shim included in Q. This was factored out
|
||
// into this ASAP package. It was later adapted to RSVP which made further
|
||
// amendments. These decisions, particularly to marginalize MessageChannel and
|
||
// to capture the MutationObserver implementation in a closure, were integrated
|
||
// back into ASAP proper.
|
||
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/webpack/buildin/global.js":
|
||
/*!***********************************!*\
|
||
!*** (webpack)/buildin/global.js ***!
|
||
\***********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports) {
|
||
|
||
var g;
|
||
|
||
// This works in non-strict mode
|
||
g = (function() {
|
||
return this;
|
||
})();
|
||
|
||
try {
|
||
// This works if eval is allowed (see CSP)
|
||
g = g || new Function("return this")();
|
||
} catch (e) {
|
||
// This works if the window reference is available
|
||
if (typeof window === "object") g = window;
|
||
}
|
||
|
||
// g can still be undefined, but nothing to do about it...
|
||
// We return undefined, instead of nothing here, so it's
|
||
// easier to handle this case. if(!global) { ...}
|
||
|
||
module.exports = g;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/faye_browser.js":
|
||
/*!*****************************!*\
|
||
!*** ./src/faye_browser.js ***!
|
||
\*****************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var constants = __webpack_require__(/*! ./util/constants */ "./src/util/constants.js"),
|
||
Logging = __webpack_require__(/*! ./mixins/logging */ "./src/mixins/logging.js");
|
||
|
||
var Faye = {
|
||
VERSION: constants.VERSION,
|
||
|
||
Client: __webpack_require__(/*! ./protocol/client */ "./src/protocol/client.js"),
|
||
Scheduler: __webpack_require__(/*! ./protocol/scheduler */ "./src/protocol/scheduler.js")
|
||
};
|
||
|
||
Logging.wrapper = Faye;
|
||
|
||
module.exports = Faye;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/mixins/deferrable.js":
|
||
/*!**********************************!*\
|
||
!*** ./src/mixins/deferrable.js ***!
|
||
\**********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js");
|
||
|
||
module.exports = {
|
||
then: function(callback, errback) {
|
||
var self = this;
|
||
if (!this._promise)
|
||
this._promise = new Promise(function(resolve, reject) {
|
||
self._resolve = resolve;
|
||
self._reject = reject;
|
||
});
|
||
|
||
if (arguments.length === 0)
|
||
return this._promise;
|
||
else
|
||
return this._promise.then(callback, errback);
|
||
},
|
||
|
||
callback: function(callback, context) {
|
||
return this.then(function(value) { callback.call(context, value) });
|
||
},
|
||
|
||
errback: function(callback, context) {
|
||
return this.then(null, function(reason) { callback.call(context, reason) });
|
||
},
|
||
|
||
timeout: function(seconds, message) {
|
||
this.then();
|
||
var self = this;
|
||
this._timer = global.setTimeout(function() {
|
||
self._reject(message);
|
||
}, seconds * 1000);
|
||
},
|
||
|
||
setDeferredStatus: function(status, value) {
|
||
if (this._timer) global.clearTimeout(this._timer);
|
||
|
||
this.then();
|
||
|
||
if (status === 'succeeded')
|
||
this._resolve(value);
|
||
else if (status === 'failed')
|
||
this._reject(value);
|
||
else
|
||
delete this._promise;
|
||
}
|
||
};
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/mixins/logging.js":
|
||
/*!*******************************!*\
|
||
!*** ./src/mixins/logging.js ***!
|
||
\*******************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js");
|
||
|
||
var Logging = {
|
||
LOG_LEVELS: {
|
||
fatal: 4,
|
||
error: 3,
|
||
warn: 2,
|
||
info: 1,
|
||
debug: 0
|
||
},
|
||
|
||
writeLog: function(messageArgs, level) {
|
||
var logger = Logging.logger || (Logging.wrapper || Logging).logger;
|
||
if (!logger) return;
|
||
|
||
var args = Array.prototype.slice.apply(messageArgs),
|
||
banner = '[Faye',
|
||
klass = this.className,
|
||
|
||
message = args.shift().replace(/\?/g, function() {
|
||
try {
|
||
return toJSON(args.shift());
|
||
} catch (error) {
|
||
return '[Object]';
|
||
}
|
||
});
|
||
|
||
if (klass) banner += '.' + klass;
|
||
banner += '] ';
|
||
|
||
if (typeof logger[level] === 'function')
|
||
logger[level](banner + message);
|
||
else if (typeof logger === 'function')
|
||
logger(banner + message);
|
||
}
|
||
};
|
||
|
||
for (var key in Logging.LOG_LEVELS)
|
||
(function(level) {
|
||
Logging[level] = function() {
|
||
this.writeLog(arguments, level);
|
||
};
|
||
})(key);
|
||
|
||
module.exports = Logging;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/mixins/publisher.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/mixins/publisher.js ***!
|
||
\*********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
EventEmitter = __webpack_require__(/*! ../util/event_emitter */ "./src/util/event_emitter.js");
|
||
|
||
var Publisher = {
|
||
countListeners: function(eventType) {
|
||
return this.listeners(eventType).length;
|
||
},
|
||
|
||
bind: function(eventType, listener, context) {
|
||
var slice = Array.prototype.slice,
|
||
handler = function() { listener.apply(context, slice.call(arguments)) };
|
||
|
||
this._listeners = this._listeners || [];
|
||
this._listeners.push([eventType, listener, context, handler]);
|
||
return this.on(eventType, handler);
|
||
},
|
||
|
||
unbind: function(eventType, listener, context) {
|
||
this._listeners = this._listeners || [];
|
||
var n = this._listeners.length, tuple;
|
||
|
||
while (n--) {
|
||
tuple = this._listeners[n];
|
||
if (tuple[0] !== eventType) continue;
|
||
if (listener && (tuple[1] !== listener || tuple[2] !== context)) continue;
|
||
this._listeners.splice(n, 1);
|
||
this.removeListener(eventType, tuple[3]);
|
||
}
|
||
}
|
||
};
|
||
|
||
assign(Publisher, EventEmitter.prototype);
|
||
Publisher.trigger = Publisher.emit;
|
||
|
||
module.exports = Publisher;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/mixins/timeouts.js":
|
||
/*!********************************!*\
|
||
!*** ./src/mixins/timeouts.js ***!
|
||
\********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
module.exports = {
|
||
addTimeout: function(name, delay, callback, context) {
|
||
this._timeouts = this._timeouts || {};
|
||
if (this._timeouts.hasOwnProperty(name)) return;
|
||
var self = this;
|
||
this._timeouts[name] = global.setTimeout(function() {
|
||
delete self._timeouts[name];
|
||
callback.call(context);
|
||
}, 1000 * delay);
|
||
},
|
||
|
||
removeTimeout: function(name) {
|
||
this._timeouts = this._timeouts || {};
|
||
var timeout = this._timeouts[name];
|
||
if (!timeout) return;
|
||
global.clearTimeout(timeout);
|
||
delete this._timeouts[name];
|
||
},
|
||
|
||
removeAllTimeouts: function() {
|
||
this._timeouts = this._timeouts || {};
|
||
for (var name in this._timeouts) this.removeTimeout(name);
|
||
}
|
||
};
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/channel.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/protocol/channel.js ***!
|
||
\*********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
Publisher = __webpack_require__(/*! ../mixins/publisher */ "./src/mixins/publisher.js"),
|
||
Grammar = __webpack_require__(/*! ./grammar */ "./src/protocol/grammar.js");
|
||
|
||
var Channel = Class({
|
||
initialize: function(name) {
|
||
this.id = this.name = name;
|
||
},
|
||
|
||
push: function(message) {
|
||
this.trigger('message', message);
|
||
},
|
||
|
||
isUnused: function() {
|
||
return this.countListeners('message') === 0;
|
||
}
|
||
});
|
||
|
||
assign(Channel.prototype, Publisher);
|
||
|
||
assign(Channel, {
|
||
HANDSHAKE: '/meta/handshake',
|
||
CONNECT: '/meta/connect',
|
||
SUBSCRIBE: '/meta/subscribe',
|
||
UNSUBSCRIBE: '/meta/unsubscribe',
|
||
DISCONNECT: '/meta/disconnect',
|
||
|
||
META: 'meta',
|
||
SERVICE: 'service',
|
||
|
||
expand: function(name) {
|
||
var segments = this.parse(name),
|
||
channels = ['/**', name];
|
||
|
||
var copy = segments.slice();
|
||
copy[copy.length - 1] = '*';
|
||
channels.push(this.unparse(copy));
|
||
|
||
for (var i = 1, n = segments.length; i < n; i++) {
|
||
copy = segments.slice(0, i);
|
||
copy.push('**');
|
||
channels.push(this.unparse(copy));
|
||
}
|
||
|
||
return channels;
|
||
},
|
||
|
||
isValid: function(name) {
|
||
return Grammar.CHANNEL_NAME.test(name) ||
|
||
Grammar.CHANNEL_PATTERN.test(name);
|
||
},
|
||
|
||
parse: function(name) {
|
||
if (!this.isValid(name)) return null;
|
||
return name.split('/').slice(1);
|
||
},
|
||
|
||
unparse: function(segments) {
|
||
return '/' + segments.join('/');
|
||
},
|
||
|
||
isMeta: function(name) {
|
||
var segments = this.parse(name);
|
||
return segments ? (segments[0] === this.META) : null;
|
||
},
|
||
|
||
isService: function(name) {
|
||
var segments = this.parse(name);
|
||
return segments ? (segments[0] === this.SERVICE) : null;
|
||
},
|
||
|
||
isSubscribable: function(name) {
|
||
if (!this.isValid(name)) return null;
|
||
return !this.isMeta(name) && !this.isService(name);
|
||
},
|
||
|
||
Set: Class({
|
||
initialize: function() {
|
||
this._channels = {};
|
||
},
|
||
|
||
getKeys: function() {
|
||
var keys = [];
|
||
for (var key in this._channels) keys.push(key);
|
||
return keys;
|
||
},
|
||
|
||
remove: function(name) {
|
||
delete this._channels[name];
|
||
},
|
||
|
||
hasSubscription: function(name) {
|
||
return this._channels.hasOwnProperty(name);
|
||
},
|
||
|
||
subscribe: function(names, subscription) {
|
||
var name;
|
||
for (var i = 0, n = names.length; i < n; i++) {
|
||
name = names[i];
|
||
var channel = this._channels[name] = this._channels[name] || new Channel(name);
|
||
channel.bind('message', subscription);
|
||
}
|
||
},
|
||
|
||
unsubscribe: function(name, subscription) {
|
||
var channel = this._channels[name];
|
||
if (!channel) return false;
|
||
channel.unbind('message', subscription);
|
||
|
||
if (channel.isUnused()) {
|
||
this.remove(name);
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
},
|
||
|
||
distributeMessage: function(message) {
|
||
var channels = Channel.expand(message.channel);
|
||
|
||
for (var i = 0, n = channels.length; i < n; i++) {
|
||
var channel = this._channels[channels[i]];
|
||
if (channel) channel.trigger('message', message);
|
||
}
|
||
}
|
||
})
|
||
});
|
||
|
||
module.exports = Channel;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/client.js":
|
||
/*!********************************!*\
|
||
!*** ./src/protocol/client.js ***!
|
||
\********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var asap = __webpack_require__(/*! asap */ "./node_modules/asap/browser-asap.js"),
|
||
Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js"),
|
||
array = __webpack_require__(/*! ../util/array */ "./src/util/array.js"),
|
||
browser = __webpack_require__(/*! ../util/browser */ "./src/util/browser/event.js"),
|
||
constants = __webpack_require__(/*! ../util/constants */ "./src/util/constants.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
validateOptions = __webpack_require__(/*! ../util/validate_options */ "./src/util/validate_options.js"),
|
||
Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js"),
|
||
Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js"),
|
||
Publisher = __webpack_require__(/*! ../mixins/publisher */ "./src/mixins/publisher.js"),
|
||
Channel = __webpack_require__(/*! ./channel */ "./src/protocol/channel.js"),
|
||
Dispatcher = __webpack_require__(/*! ./dispatcher */ "./src/protocol/dispatcher.js"),
|
||
Error = __webpack_require__(/*! ./error */ "./src/protocol/error.js"),
|
||
Extensible = __webpack_require__(/*! ./extensible */ "./src/protocol/extensible.js"),
|
||
Publication = __webpack_require__(/*! ./publication */ "./src/protocol/publication.js"),
|
||
Subscription = __webpack_require__(/*! ./subscription */ "./src/protocol/subscription.js");
|
||
|
||
var Client = Class({ className: 'Client',
|
||
UNCONNECTED: 1,
|
||
CONNECTING: 2,
|
||
CONNECTED: 3,
|
||
DISCONNECTED: 4,
|
||
|
||
HANDSHAKE: 'handshake',
|
||
RETRY: 'retry',
|
||
NONE: 'none',
|
||
|
||
CONNECTION_TIMEOUT: 60,
|
||
|
||
DEFAULT_ENDPOINT: '/bayeux',
|
||
INTERVAL: 0,
|
||
|
||
initialize: function(endpoint, options) {
|
||
this.info('New client created for ?', endpoint);
|
||
options = options || {};
|
||
|
||
validateOptions(options, ['interval', 'timeout', 'endpoints', 'proxy', 'retry', 'scheduler', 'websocketExtensions', 'tls', 'ca']);
|
||
|
||
this._channels = new Channel.Set();
|
||
this._dispatcher = Dispatcher.create(this, endpoint || this.DEFAULT_ENDPOINT, options);
|
||
|
||
this._messageId = 0;
|
||
this._state = this.UNCONNECTED;
|
||
|
||
this._responseCallbacks = {};
|
||
|
||
this._advice = {
|
||
reconnect: this.RETRY,
|
||
interval: 1000 * (options.interval || this.INTERVAL),
|
||
timeout: 1000 * (options.timeout || this.CONNECTION_TIMEOUT)
|
||
};
|
||
this._dispatcher.timeout = this._advice.timeout / 1000;
|
||
|
||
this._dispatcher.bind('message', this._receiveMessage, this);
|
||
|
||
if (browser.Event && global.onbeforeunload !== undefined)
|
||
browser.Event.on(global, 'beforeunload', function() {
|
||
if (array.indexOf(this._dispatcher._disabled, 'autodisconnect') < 0)
|
||
this.disconnect();
|
||
}, this);
|
||
},
|
||
|
||
addWebsocketExtension: function(extension) {
|
||
return this._dispatcher.addWebsocketExtension(extension);
|
||
},
|
||
|
||
disable: function(feature) {
|
||
return this._dispatcher.disable(feature);
|
||
},
|
||
|
||
setHeader: function(name, value) {
|
||
return this._dispatcher.setHeader(name, value);
|
||
},
|
||
|
||
// Request
|
||
// MUST include: * channel
|
||
// * version
|
||
// * supportedConnectionTypes
|
||
// MAY include: * minimumVersion
|
||
// * ext
|
||
// * id
|
||
//
|
||
// Success Response Failed Response
|
||
// MUST include: * channel MUST include: * channel
|
||
// * version * successful
|
||
// * supportedConnectionTypes * error
|
||
// * clientId MAY include: * supportedConnectionTypes
|
||
// * successful * advice
|
||
// MAY include: * minimumVersion * version
|
||
// * advice * minimumVersion
|
||
// * ext * ext
|
||
// * id * id
|
||
// * authSuccessful
|
||
handshake: function(callback, context) {
|
||
if (this._advice.reconnect === this.NONE) return;
|
||
if (this._state !== this.UNCONNECTED) return;
|
||
|
||
this._state = this.CONNECTING;
|
||
var self = this;
|
||
|
||
this.info('Initiating handshake with ?', this._dispatcher.endpoint.href);
|
||
this._dispatcher.selectTransport(constants.MANDATORY_CONNECTION_TYPES);
|
||
|
||
this._sendMessage({
|
||
channel: Channel.HANDSHAKE,
|
||
version: constants.BAYEUX_VERSION,
|
||
supportedConnectionTypes: this._dispatcher.getConnectionTypes()
|
||
|
||
}, {}, function(response) {
|
||
|
||
if (response.successful) {
|
||
this._state = this.CONNECTED;
|
||
this._dispatcher.clientId = response.clientId;
|
||
|
||
this._dispatcher.selectTransport(response.supportedConnectionTypes);
|
||
|
||
this.info('Handshake successful: ?', this._dispatcher.clientId);
|
||
|
||
this.subscribe(this._channels.getKeys(), true);
|
||
if (callback) asap(function() { callback.call(context) });
|
||
|
||
} else {
|
||
this.info('Handshake unsuccessful');
|
||
global.setTimeout(function() { self.handshake(callback, context) }, this._dispatcher.retry * 1000);
|
||
this._state = this.UNCONNECTED;
|
||
}
|
||
}, this);
|
||
},
|
||
|
||
// Request Response
|
||
// MUST include: * channel MUST include: * channel
|
||
// * clientId * successful
|
||
// * connectionType * clientId
|
||
// MAY include: * ext MAY include: * error
|
||
// * id * advice
|
||
// * ext
|
||
// * id
|
||
// * timestamp
|
||
connect: function(callback, context) {
|
||
if (this._advice.reconnect === this.NONE) return;
|
||
if (this._state === this.DISCONNECTED) return;
|
||
|
||
if (this._state === this.UNCONNECTED)
|
||
return this.handshake(function() { this.connect(callback, context) }, this);
|
||
|
||
this.callback(callback, context);
|
||
if (this._state !== this.CONNECTED) return;
|
||
|
||
this.info('Calling deferred actions for ?', this._dispatcher.clientId);
|
||
this.setDeferredStatus('succeeded');
|
||
this.setDeferredStatus('unknown');
|
||
|
||
if (this._connectRequest) return;
|
||
this._connectRequest = true;
|
||
|
||
this.info('Initiating connection for ?', this._dispatcher.clientId);
|
||
|
||
this._sendMessage({
|
||
channel: Channel.CONNECT,
|
||
clientId: this._dispatcher.clientId,
|
||
connectionType: this._dispatcher.connectionType
|
||
|
||
}, {}, this._cycleConnection, this);
|
||
},
|
||
|
||
// Request Response
|
||
// MUST include: * channel MUST include: * channel
|
||
// * clientId * successful
|
||
// MAY include: * ext * clientId
|
||
// * id MAY include: * error
|
||
// * ext
|
||
// * id
|
||
disconnect: function() {
|
||
if (this._state !== this.CONNECTED) return;
|
||
this._state = this.DISCONNECTED;
|
||
|
||
this.info('Disconnecting ?', this._dispatcher.clientId);
|
||
var promise = new Publication();
|
||
|
||
this._sendMessage({
|
||
channel: Channel.DISCONNECT,
|
||
clientId: this._dispatcher.clientId
|
||
|
||
}, {}, function(response) {
|
||
if (response.successful) {
|
||
this._dispatcher.close();
|
||
promise.setDeferredStatus('succeeded');
|
||
} else {
|
||
promise.setDeferredStatus('failed', Error.parse(response.error));
|
||
}
|
||
}, this);
|
||
|
||
this.info('Clearing channel listeners for ?', this._dispatcher.clientId);
|
||
this._channels = new Channel.Set();
|
||
|
||
return promise;
|
||
},
|
||
|
||
// Request Response
|
||
// MUST include: * channel MUST include: * channel
|
||
// * clientId * successful
|
||
// * subscription * clientId
|
||
// MAY include: * ext * subscription
|
||
// * id MAY include: * error
|
||
// * advice
|
||
// * ext
|
||
// * id
|
||
// * timestamp
|
||
subscribe: function(channel, callback, context) {
|
||
if (channel instanceof Array)
|
||
return array.map(channel, function(c) {
|
||
return this.subscribe(c, callback, context);
|
||
}, this);
|
||
|
||
var subscription = new Subscription(this, channel, callback, context),
|
||
force = (callback === true),
|
||
hasSubscribe = this._channels.hasSubscription(channel);
|
||
|
||
if (hasSubscribe && !force) {
|
||
this._channels.subscribe([channel], subscription);
|
||
subscription.setDeferredStatus('succeeded');
|
||
return subscription;
|
||
}
|
||
|
||
this.connect(function() {
|
||
this.info('Client ? attempting to subscribe to ?', this._dispatcher.clientId, channel);
|
||
if (!force) this._channels.subscribe([channel], subscription);
|
||
|
||
this._sendMessage({
|
||
channel: Channel.SUBSCRIBE,
|
||
clientId: this._dispatcher.clientId,
|
||
subscription: channel
|
||
|
||
}, {}, function(response) {
|
||
if (!response.successful) {
|
||
subscription.setDeferredStatus('failed', Error.parse(response.error));
|
||
return this._channels.unsubscribe(channel, subscription);
|
||
}
|
||
|
||
var channels = [].concat(response.subscription);
|
||
this.info('Subscription acknowledged for ? to ?', this._dispatcher.clientId, channels);
|
||
subscription.setDeferredStatus('succeeded');
|
||
}, this);
|
||
}, this);
|
||
|
||
return subscription;
|
||
},
|
||
|
||
// Request Response
|
||
// MUST include: * channel MUST include: * channel
|
||
// * clientId * successful
|
||
// * subscription * clientId
|
||
// MAY include: * ext * subscription
|
||
// * id MAY include: * error
|
||
// * advice
|
||
// * ext
|
||
// * id
|
||
// * timestamp
|
||
unsubscribe: function(channel, subscription) {
|
||
if (channel instanceof Array)
|
||
return array.map(channel, function(c) {
|
||
return this.unsubscribe(c, subscription);
|
||
}, this);
|
||
|
||
var dead = this._channels.unsubscribe(channel, subscription);
|
||
if (!dead) return;
|
||
|
||
this.connect(function() {
|
||
this.info('Client ? attempting to unsubscribe from ?', this._dispatcher.clientId, channel);
|
||
|
||
this._sendMessage({
|
||
channel: Channel.UNSUBSCRIBE,
|
||
clientId: this._dispatcher.clientId,
|
||
subscription: channel
|
||
|
||
}, {}, function(response) {
|
||
if (!response.successful) return;
|
||
|
||
var channels = [].concat(response.subscription);
|
||
this.info('Unsubscription acknowledged for ? from ?', this._dispatcher.clientId, channels);
|
||
}, this);
|
||
}, this);
|
||
},
|
||
|
||
// Request Response
|
||
// MUST include: * channel MUST include: * channel
|
||
// * data * successful
|
||
// MAY include: * clientId MAY include: * id
|
||
// * id * error
|
||
// * ext * ext
|
||
publish: function(channel, data, options) {
|
||
validateOptions(options || {}, ['attempts', 'deadline']);
|
||
var publication = new Publication();
|
||
|
||
this.connect(function() {
|
||
this.info('Client ? queueing published message to ?: ?', this._dispatcher.clientId, channel, data);
|
||
|
||
this._sendMessage({
|
||
channel: channel,
|
||
data: data,
|
||
clientId: this._dispatcher.clientId
|
||
|
||
}, options, function(response) {
|
||
if (response.successful)
|
||
publication.setDeferredStatus('succeeded');
|
||
else
|
||
publication.setDeferredStatus('failed', Error.parse(response.error));
|
||
}, this);
|
||
}, this);
|
||
|
||
return publication;
|
||
},
|
||
|
||
_sendMessage: function(message, options, callback, context) {
|
||
message.id = this._generateMessageId();
|
||
|
||
var timeout = this._advice.timeout
|
||
? 1.2 * this._advice.timeout / 1000
|
||
: 1.2 * this._dispatcher.retry;
|
||
|
||
this.pipeThroughExtensions('outgoing', message, null, function(message) {
|
||
if (!message) return;
|
||
if (callback) this._responseCallbacks[message.id] = [callback, context];
|
||
this._dispatcher.sendMessage(message, timeout, options || {});
|
||
}, this);
|
||
},
|
||
|
||
_generateMessageId: function() {
|
||
this._messageId += 1;
|
||
if (this._messageId >= Math.pow(2,32)) this._messageId = 0;
|
||
return this._messageId.toString(36);
|
||
},
|
||
|
||
_receiveMessage: function(message) {
|
||
var id = message.id, callback;
|
||
|
||
if (message.successful !== undefined) {
|
||
callback = this._responseCallbacks[id];
|
||
delete this._responseCallbacks[id];
|
||
}
|
||
|
||
this.pipeThroughExtensions('incoming', message, null, function(message) {
|
||
if (!message) return;
|
||
if (message.advice) this._handleAdvice(message.advice);
|
||
this._deliverMessage(message);
|
||
if (callback) callback[0].call(callback[1], message);
|
||
}, this);
|
||
},
|
||
|
||
_handleAdvice: function(advice) {
|
||
assign(this._advice, advice);
|
||
this._dispatcher.timeout = this._advice.timeout / 1000;
|
||
|
||
if (this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED) {
|
||
this._state = this.UNCONNECTED;
|
||
this._dispatcher.clientId = null;
|
||
this._cycleConnection();
|
||
}
|
||
},
|
||
|
||
_deliverMessage: function(message) {
|
||
if (!message.channel || message.data === undefined) return;
|
||
this.info('Client ? calling listeners for ? with ?', this._dispatcher.clientId, message.channel, message.data);
|
||
this._channels.distributeMessage(message);
|
||
},
|
||
|
||
_cycleConnection: function() {
|
||
if (this._connectRequest) {
|
||
this._connectRequest = null;
|
||
this.info('Closed connection for ?', this._dispatcher.clientId);
|
||
}
|
||
var self = this;
|
||
global.setTimeout(function() { self.connect() }, this._advice.interval);
|
||
}
|
||
});
|
||
|
||
assign(Client.prototype, Deferrable);
|
||
assign(Client.prototype, Publisher);
|
||
assign(Client.prototype, Logging);
|
||
assign(Client.prototype, Extensible);
|
||
|
||
module.exports = Client;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/dispatcher.js":
|
||
/*!************************************!*\
|
||
!*** ./src/protocol/dispatcher.js ***!
|
||
\************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
|
||
cookies = __webpack_require__(/*! ../util/cookies */ "./src/util/cookies/browser_cookies.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js"),
|
||
Publisher = __webpack_require__(/*! ../mixins/publisher */ "./src/mixins/publisher.js"),
|
||
Transport = __webpack_require__(/*! ../transport */ "./src/transport/browser_transports.js"),
|
||
Scheduler = __webpack_require__(/*! ./scheduler */ "./src/protocol/scheduler.js");
|
||
|
||
var Dispatcher = Class({ className: 'Dispatcher',
|
||
MAX_REQUEST_SIZE: 2048,
|
||
DEFAULT_RETRY: 5,
|
||
|
||
UP: 1,
|
||
DOWN: 2,
|
||
|
||
initialize: function(client, endpoint, options) {
|
||
this._client = client;
|
||
this.endpoint = URI.parse(endpoint);
|
||
this._alternates = options.endpoints || {};
|
||
|
||
this.cookies = cookies.CookieJar && new cookies.CookieJar();
|
||
this._disabled = [];
|
||
this._envelopes = {};
|
||
this.headers = {};
|
||
this.retry = options.retry || this.DEFAULT_RETRY;
|
||
this._scheduler = options.scheduler || Scheduler;
|
||
this._state = 0;
|
||
this.transports = {};
|
||
this.wsExtensions = [];
|
||
|
||
this.proxy = options.proxy || {};
|
||
if (typeof this._proxy === 'string') this._proxy = { origin: this._proxy };
|
||
|
||
var exts = options.websocketExtensions;
|
||
if (exts) {
|
||
exts = [].concat(exts);
|
||
for (var i = 0, n = exts.length; i < n; i++)
|
||
this.addWebsocketExtension(exts[i]);
|
||
}
|
||
|
||
this.tls = options.tls || {};
|
||
this.tls.ca = this.tls.ca || options.ca;
|
||
|
||
for (var type in this._alternates)
|
||
this._alternates[type] = URI.parse(this._alternates[type]);
|
||
|
||
this.maxRequestSize = this.MAX_REQUEST_SIZE;
|
||
},
|
||
|
||
endpointFor: function(connectionType) {
|
||
return this._alternates[connectionType] || this.endpoint;
|
||
},
|
||
|
||
addWebsocketExtension: function(extension) {
|
||
this.wsExtensions.push(extension);
|
||
},
|
||
|
||
disable: function(feature) {
|
||
this._disabled.push(feature);
|
||
Transport.disable(feature);
|
||
},
|
||
|
||
setHeader: function(name, value) {
|
||
this.headers[name] = value;
|
||
},
|
||
|
||
close: function() {
|
||
var transport = this._transport;
|
||
delete this._transport;
|
||
if (transport) transport.close();
|
||
},
|
||
|
||
getConnectionTypes: function() {
|
||
return Transport.getConnectionTypes();
|
||
},
|
||
|
||
selectTransport: function(transportTypes) {
|
||
Transport.get(this, transportTypes, this._disabled, function(transport) {
|
||
this.debug('Selected ? transport for ?', transport.connectionType, transport.endpoint.href);
|
||
|
||
if (transport === this._transport) return;
|
||
if (this._transport) this._transport.close();
|
||
|
||
this._transport = transport;
|
||
this.connectionType = transport.connectionType;
|
||
}, this);
|
||
},
|
||
|
||
sendMessage: function(message, timeout, options) {
|
||
options = options || {};
|
||
|
||
var id = message.id,
|
||
attempts = options.attempts,
|
||
deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),
|
||
envelope = this._envelopes[id],
|
||
scheduler;
|
||
|
||
if (!envelope) {
|
||
scheduler = new this._scheduler(message, { timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline });
|
||
envelope = this._envelopes[id] = { message: message, scheduler: scheduler };
|
||
}
|
||
|
||
this._sendEnvelope(envelope);
|
||
},
|
||
|
||
_sendEnvelope: function(envelope) {
|
||
if (!this._transport) return;
|
||
if (envelope.request || envelope.timer) return;
|
||
|
||
var message = envelope.message,
|
||
scheduler = envelope.scheduler,
|
||
self = this;
|
||
|
||
if (!scheduler.isDeliverable()) {
|
||
scheduler.abort();
|
||
delete this._envelopes[message.id];
|
||
return;
|
||
}
|
||
|
||
envelope.timer = global.setTimeout(function() {
|
||
self.handleError(message);
|
||
}, scheduler.getTimeout() * 1000);
|
||
|
||
scheduler.send();
|
||
envelope.request = this._transport.sendMessage(message);
|
||
},
|
||
|
||
handleResponse: function(reply) {
|
||
var envelope = this._envelopes[reply.id];
|
||
|
||
if (reply.successful !== undefined && envelope) {
|
||
envelope.scheduler.succeed();
|
||
delete this._envelopes[reply.id];
|
||
global.clearTimeout(envelope.timer);
|
||
}
|
||
|
||
this.trigger('message', reply);
|
||
|
||
if (this._state === this.UP) return;
|
||
this._state = this.UP;
|
||
this._client.trigger('transport:up');
|
||
},
|
||
|
||
handleError: function(message, immediate) {
|
||
var envelope = this._envelopes[message.id],
|
||
request = envelope && envelope.request,
|
||
self = this;
|
||
|
||
if (!request) return;
|
||
|
||
request.then(function(req) {
|
||
if (req && req.abort) req.abort();
|
||
});
|
||
|
||
var scheduler = envelope.scheduler;
|
||
scheduler.fail();
|
||
|
||
global.clearTimeout(envelope.timer);
|
||
envelope.request = envelope.timer = null;
|
||
|
||
if (immediate) {
|
||
this._sendEnvelope(envelope);
|
||
} else {
|
||
envelope.timer = global.setTimeout(function() {
|
||
envelope.timer = null;
|
||
self._sendEnvelope(envelope);
|
||
}, scheduler.getInterval() * 1000);
|
||
}
|
||
|
||
if (this._state === this.DOWN) return;
|
||
this._state = this.DOWN;
|
||
this._client.trigger('transport:down');
|
||
}
|
||
});
|
||
|
||
Dispatcher.create = function(client, endpoint, options) {
|
||
return new Dispatcher(client, endpoint, options);
|
||
};
|
||
|
||
assign(Dispatcher.prototype, Publisher);
|
||
assign(Dispatcher.prototype, Logging);
|
||
|
||
module.exports = Dispatcher;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/error.js":
|
||
/*!*******************************!*\
|
||
!*** ./src/protocol/error.js ***!
|
||
\*******************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
Grammar = __webpack_require__(/*! ./grammar */ "./src/protocol/grammar.js");
|
||
|
||
var Error = Class({
|
||
initialize: function(code, params, message) {
|
||
this.code = code;
|
||
this.params = Array.prototype.slice.call(params);
|
||
this.message = message;
|
||
},
|
||
|
||
toString: function() {
|
||
return this.code + ':' +
|
||
this.params.join(',') + ':' +
|
||
this.message;
|
||
}
|
||
});
|
||
|
||
Error.parse = function(message) {
|
||
message = message || '';
|
||
if (!Grammar.ERROR.test(message)) return new Error(null, [], message);
|
||
|
||
var parts = message.split(':'),
|
||
code = parseInt(parts[0]),
|
||
params = parts[1].split(','),
|
||
message = parts[2];
|
||
|
||
return new Error(code, params, message);
|
||
};
|
||
|
||
// http://code.google.com/p/cometd/wiki/BayeuxCodes
|
||
var errors = {
|
||
versionMismatch: [300, 'Version mismatch'],
|
||
conntypeMismatch: [301, 'Connection types not supported'],
|
||
extMismatch: [302, 'Extension mismatch'],
|
||
badRequest: [400, 'Bad request'],
|
||
clientUnknown: [401, 'Unknown client'],
|
||
parameterMissing: [402, 'Missing required parameter'],
|
||
channelForbidden: [403, 'Forbidden channel'],
|
||
channelUnknown: [404, 'Unknown channel'],
|
||
channelInvalid: [405, 'Invalid channel'],
|
||
extUnknown: [406, 'Unknown extension'],
|
||
publishFailed: [407, 'Failed to publish'],
|
||
serverError: [500, 'Internal server error']
|
||
};
|
||
|
||
for (var name in errors)
|
||
(function(name) {
|
||
Error[name] = function() {
|
||
return new Error(errors[name][0], arguments, errors[name][1]).toString();
|
||
};
|
||
})(name);
|
||
|
||
module.exports = Error;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/extensible.js":
|
||
/*!************************************!*\
|
||
!*** ./src/protocol/extensible.js ***!
|
||
\************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js");
|
||
|
||
var Extensible = {
|
||
addExtension: function(extension) {
|
||
this._extensions = this._extensions || [];
|
||
this._extensions.push(extension);
|
||
if (extension.added) extension.added(this);
|
||
},
|
||
|
||
removeExtension: function(extension) {
|
||
if (!this._extensions) return;
|
||
var i = this._extensions.length;
|
||
while (i--) {
|
||
if (this._extensions[i] !== extension) continue;
|
||
this._extensions.splice(i,1);
|
||
if (extension.removed) extension.removed(this);
|
||
}
|
||
},
|
||
|
||
pipeThroughExtensions: function(stage, message, request, callback, context) {
|
||
this.debug('Passing through ? extensions: ?', stage, message);
|
||
|
||
if (!this._extensions) return callback.call(context, message);
|
||
var extensions = this._extensions.slice();
|
||
|
||
var pipe = function(message) {
|
||
if (!message) return callback.call(context, message);
|
||
|
||
var extension = extensions.shift();
|
||
if (!extension) return callback.call(context, message);
|
||
|
||
var fn = extension[stage];
|
||
if (!fn) return pipe(message);
|
||
|
||
if (fn.length >= 3) extension[stage](message, request, pipe);
|
||
else extension[stage](message, pipe);
|
||
};
|
||
pipe(message);
|
||
}
|
||
};
|
||
|
||
assign(Extensible, Logging);
|
||
|
||
module.exports = Extensible;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/grammar.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/protocol/grammar.js ***!
|
||
\*********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = {
|
||
CHANNEL_NAME: /^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,
|
||
CHANNEL_PATTERN: /^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,
|
||
ERROR: /^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,
|
||
VERSION: /^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/publication.js":
|
||
/*!*************************************!*\
|
||
!*** ./src/protocol/publication.js ***!
|
||
\*************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js");
|
||
|
||
module.exports = Class(Deferrable);
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/scheduler.js":
|
||
/*!***********************************!*\
|
||
!*** ./src/protocol/scheduler.js ***!
|
||
\***********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js");
|
||
|
||
var Scheduler = function(message, options) {
|
||
this.message = message;
|
||
this.options = options;
|
||
this.attempts = 0;
|
||
};
|
||
|
||
assign(Scheduler.prototype, {
|
||
getTimeout: function() {
|
||
return this.options.timeout;
|
||
},
|
||
|
||
getInterval: function() {
|
||
return this.options.interval;
|
||
},
|
||
|
||
isDeliverable: function() {
|
||
var attempts = this.options.attempts,
|
||
made = this.attempts,
|
||
deadline = this.options.deadline,
|
||
now = new Date().getTime();
|
||
|
||
if (attempts !== undefined && made >= attempts)
|
||
return false;
|
||
|
||
if (deadline !== undefined && now > deadline)
|
||
return false;
|
||
|
||
return true;
|
||
},
|
||
|
||
send: function() {
|
||
this.attempts += 1;
|
||
},
|
||
|
||
succeed: function() {},
|
||
|
||
fail: function() {},
|
||
|
||
abort: function() {}
|
||
});
|
||
|
||
module.exports = Scheduler;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/protocol/subscription.js":
|
||
/*!**************************************!*\
|
||
!*** ./src/protocol/subscription.js ***!
|
||
\**************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js");
|
||
|
||
var Subscription = Class({
|
||
initialize: function(client, channels, callback, context) {
|
||
this._client = client;
|
||
this._channels = channels;
|
||
this._callback = callback;
|
||
this._context = context;
|
||
this._cancelled = false;
|
||
},
|
||
|
||
withChannel: function(callback, context) {
|
||
this._withChannel = [callback, context];
|
||
return this;
|
||
},
|
||
|
||
apply: function(context, args) {
|
||
var message = args[0];
|
||
|
||
if (this._callback)
|
||
this._callback.call(this._context, message.data);
|
||
|
||
if (this._withChannel)
|
||
this._withChannel[0].call(this._withChannel[1], message.channel, message.data);
|
||
},
|
||
|
||
cancel: function() {
|
||
if (this._cancelled) return;
|
||
this._client.unsubscribe(this._channels, this);
|
||
this._cancelled = true;
|
||
},
|
||
|
||
unsubscribe: function() {
|
||
this.cancel();
|
||
}
|
||
});
|
||
|
||
assign(Subscription.prototype, Deferrable);
|
||
|
||
module.exports = Subscription;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/browser_transports.js":
|
||
/*!*********************************************!*\
|
||
!*** ./src/transport/browser_transports.js ***!
|
||
\*********************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
|
||
|
||
Transport.register('websocket', __webpack_require__(/*! ./web_socket */ "./src/transport/web_socket.js"));
|
||
Transport.register('eventsource', __webpack_require__(/*! ./event_source */ "./src/transport/event_source.js"));
|
||
Transport.register('long-polling', __webpack_require__(/*! ./xhr */ "./src/transport/xhr.js"));
|
||
Transport.register('cross-origin-long-polling', __webpack_require__(/*! ./cors */ "./src/transport/cors.js"));
|
||
Transport.register('callback-polling', __webpack_require__(/*! ./jsonp */ "./src/transport/jsonp.js"));
|
||
|
||
module.exports = Transport;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/cors.js":
|
||
/*!*******************************!*\
|
||
!*** ./src/transport/cors.js ***!
|
||
\*******************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
Set = __webpack_require__(/*! ../util/set */ "./src/util/set.js"),
|
||
URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
|
||
Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
|
||
|
||
var CORS = assign(Class(Transport, {
|
||
encode: function(messages) {
|
||
return 'message=' + encodeURIComponent(toJSON(messages));
|
||
},
|
||
|
||
request: function(messages) {
|
||
var xhrClass = global.XDomainRequest ? XDomainRequest : XMLHttpRequest,
|
||
xhr = new xhrClass(),
|
||
id = ++CORS._id,
|
||
headers = this._dispatcher.headers,
|
||
self = this,
|
||
key;
|
||
|
||
xhr.open('POST', this.endpoint.href, true);
|
||
xhr.withCredentials = true;
|
||
|
||
if (xhr.setRequestHeader) {
|
||
xhr.setRequestHeader('Pragma', 'no-cache');
|
||
for (key in headers) {
|
||
if (!headers.hasOwnProperty(key)) continue;
|
||
xhr.setRequestHeader(key, headers[key]);
|
||
}
|
||
}
|
||
|
||
var cleanUp = function() {
|
||
if (!xhr) return false;
|
||
CORS._pending.remove(id);
|
||
xhr.onload = xhr.onerror = xhr.ontimeout = xhr.onprogress = null;
|
||
xhr = null;
|
||
};
|
||
|
||
xhr.onload = function() {
|
||
var replies;
|
||
try { replies = JSON.parse(xhr.responseText) } catch (error) {}
|
||
|
||
cleanUp();
|
||
|
||
if (replies)
|
||
self._receive(replies);
|
||
else
|
||
self._handleError(messages);
|
||
};
|
||
|
||
xhr.onerror = xhr.ontimeout = function() {
|
||
cleanUp();
|
||
self._handleError(messages);
|
||
};
|
||
|
||
xhr.onprogress = function() {};
|
||
|
||
if (xhrClass === global.XDomainRequest)
|
||
CORS._pending.add({ id: id, xhr: xhr });
|
||
|
||
xhr.send(this.encode(messages));
|
||
return xhr;
|
||
}
|
||
}), {
|
||
_id: 0,
|
||
_pending: new Set(),
|
||
|
||
isUsable: function(dispatcher, endpoint, callback, context) {
|
||
if (URI.isSameOrigin(endpoint))
|
||
return callback.call(context, false);
|
||
|
||
if (global.XDomainRequest)
|
||
return callback.call(context, endpoint.protocol === location.protocol);
|
||
|
||
if (global.XMLHttpRequest) {
|
||
var xhr = new XMLHttpRequest();
|
||
return callback.call(context, xhr.withCredentials !== undefined);
|
||
}
|
||
return callback.call(context, false);
|
||
}
|
||
});
|
||
|
||
module.exports = CORS;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/event_source.js":
|
||
/*!***************************************!*\
|
||
!*** ./src/transport/event_source.js ***!
|
||
\***************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
|
||
copyObject = __webpack_require__(/*! ../util/copy_object */ "./src/util/copy_object.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js"),
|
||
Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js"),
|
||
XHR = __webpack_require__(/*! ./xhr */ "./src/transport/xhr.js");
|
||
|
||
var EventSource = assign(Class(Transport, {
|
||
initialize: function(dispatcher, endpoint) {
|
||
Transport.prototype.initialize.call(this, dispatcher, endpoint);
|
||
if (!global.EventSource) return this.setDeferredStatus('failed');
|
||
|
||
this._xhr = new XHR(dispatcher, endpoint);
|
||
|
||
endpoint = copyObject(endpoint);
|
||
endpoint.pathname += '/' + dispatcher.clientId;
|
||
|
||
var socket = new global.EventSource(URI.stringify(endpoint)),
|
||
self = this;
|
||
|
||
socket.onopen = function() {
|
||
self._everConnected = true;
|
||
self.setDeferredStatus('succeeded');
|
||
};
|
||
|
||
socket.onerror = function() {
|
||
if (self._everConnected) {
|
||
self._handleError([]);
|
||
} else {
|
||
self.setDeferredStatus('failed');
|
||
socket.close();
|
||
}
|
||
};
|
||
|
||
socket.onmessage = function(event) {
|
||
var replies;
|
||
try { replies = JSON.parse(event.data) } catch (error) {}
|
||
|
||
if (replies)
|
||
self._receive(replies);
|
||
else
|
||
self._handleError([]);
|
||
};
|
||
|
||
this._socket = socket;
|
||
},
|
||
|
||
close: function() {
|
||
if (!this._socket) return;
|
||
this._socket.onopen = this._socket.onerror = this._socket.onmessage = null;
|
||
this._socket.close();
|
||
delete this._socket;
|
||
},
|
||
|
||
isUsable: function(callback, context) {
|
||
this.callback(function() { callback.call(context, true) });
|
||
this.errback(function() { callback.call(context, false) });
|
||
},
|
||
|
||
encode: function(messages) {
|
||
return this._xhr.encode(messages);
|
||
},
|
||
|
||
request: function(messages) {
|
||
return this._xhr.request(messages);
|
||
}
|
||
|
||
}), {
|
||
isUsable: function(dispatcher, endpoint, callback, context) {
|
||
var id = dispatcher.clientId;
|
||
if (!id) return callback.call(context, false);
|
||
|
||
XHR.isUsable(dispatcher, endpoint, function(usable) {
|
||
if (!usable) return callback.call(context, false);
|
||
this.create(dispatcher, endpoint).isUsable(callback, context);
|
||
}, this);
|
||
},
|
||
|
||
create: function(dispatcher, endpoint) {
|
||
var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},
|
||
id = dispatcher.clientId;
|
||
|
||
var url = copyObject(endpoint);
|
||
url.pathname += '/' + (id || '');
|
||
url = URI.stringify(url);
|
||
|
||
sockets[url] = sockets[url] || new this(dispatcher, endpoint);
|
||
return sockets[url];
|
||
}
|
||
});
|
||
|
||
assign(EventSource.prototype, Deferrable);
|
||
|
||
module.exports = EventSource;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/jsonp.js":
|
||
/*!********************************!*\
|
||
!*** ./src/transport/jsonp.js ***!
|
||
\********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
|
||
copyObject = __webpack_require__(/*! ../util/copy_object */ "./src/util/copy_object.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
|
||
Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
|
||
|
||
var JSONP = assign(Class(Transport, {
|
||
encode: function(messages) {
|
||
var url = copyObject(this.endpoint);
|
||
url.query.message = toJSON(messages);
|
||
url.query.jsonp = '__jsonp' + JSONP._cbCount + '__';
|
||
return URI.stringify(url);
|
||
},
|
||
|
||
request: function(messages) {
|
||
var head = document.getElementsByTagName('head')[0],
|
||
script = document.createElement('script'),
|
||
callbackName = JSONP.getCallbackName(),
|
||
endpoint = copyObject(this.endpoint),
|
||
self = this;
|
||
|
||
endpoint.query.message = toJSON(messages);
|
||
endpoint.query.jsonp = callbackName;
|
||
|
||
var cleanup = function() {
|
||
if (!global[callbackName]) return false;
|
||
global[callbackName] = undefined;
|
||
try { delete global[callbackName] } catch (error) {}
|
||
script.parentNode.removeChild(script);
|
||
};
|
||
|
||
global[callbackName] = function(replies) {
|
||
cleanup();
|
||
self._receive(replies);
|
||
};
|
||
|
||
script.type = 'text/javascript';
|
||
script.src = URI.stringify(endpoint);
|
||
head.appendChild(script);
|
||
|
||
script.onerror = function() {
|
||
cleanup();
|
||
self._handleError(messages);
|
||
};
|
||
|
||
return { abort: cleanup };
|
||
}
|
||
}), {
|
||
_cbCount: 0,
|
||
|
||
getCallbackName: function() {
|
||
this._cbCount += 1;
|
||
return '__jsonp' + this._cbCount + '__';
|
||
},
|
||
|
||
isUsable: function(dispatcher, endpoint, callback, context) {
|
||
callback.call(context, true);
|
||
}
|
||
});
|
||
|
||
module.exports = JSONP;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/transport.js":
|
||
/*!************************************!*\
|
||
!*** ./src/transport/transport.js ***!
|
||
\************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
Cookie = __webpack_require__(/*! ../util/cookies */ "./src/util/cookies/browser_cookies.js").Cookie,
|
||
Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js"),
|
||
array = __webpack_require__(/*! ../util/array */ "./src/util/array.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
Logging = __webpack_require__(/*! ../mixins/logging */ "./src/mixins/logging.js"),
|
||
Timeouts = __webpack_require__(/*! ../mixins/timeouts */ "./src/mixins/timeouts.js"),
|
||
Channel = __webpack_require__(/*! ../protocol/channel */ "./src/protocol/channel.js");
|
||
|
||
var Transport = assign(Class({ className: 'Transport',
|
||
DEFAULT_PORTS: { 'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443 },
|
||
MAX_DELAY: 0,
|
||
|
||
batching: true,
|
||
|
||
initialize: function(dispatcher, endpoint) {
|
||
this._dispatcher = dispatcher;
|
||
this.endpoint = endpoint;
|
||
this._outbox = [];
|
||
this._proxy = assign({}, this._dispatcher.proxy);
|
||
|
||
if (!this._proxy.origin)
|
||
this._proxy.origin = this._findProxy();
|
||
},
|
||
|
||
close: function() {},
|
||
|
||
encode: function(messages) {
|
||
return '';
|
||
},
|
||
|
||
sendMessage: function(message) {
|
||
this.debug('Client ? sending message to ?: ?',
|
||
this._dispatcher.clientId, this.endpoint.href, message);
|
||
|
||
if (!this.batching) return Promise.resolve(this.request([message]));
|
||
|
||
this._outbox.push(message);
|
||
this._flushLargeBatch();
|
||
|
||
if (message.channel === Channel.HANDSHAKE)
|
||
return this._publish(0.01);
|
||
|
||
if (message.channel === Channel.CONNECT)
|
||
this._connectMessage = message;
|
||
|
||
return this._publish(this.MAX_DELAY);
|
||
},
|
||
|
||
_makePromise: function() {
|
||
var self = this;
|
||
|
||
this._requestPromise = this._requestPromise || new Promise(function(resolve) {
|
||
self._resolvePromise = resolve;
|
||
});
|
||
},
|
||
|
||
_publish: function(delay) {
|
||
this._makePromise();
|
||
|
||
this.addTimeout('publish', delay, function() {
|
||
this._flush();
|
||
delete this._requestPromise;
|
||
}, this);
|
||
|
||
return this._requestPromise;
|
||
},
|
||
|
||
_flush: function() {
|
||
this.removeTimeout('publish');
|
||
|
||
if (this._outbox.length > 1 && this._connectMessage)
|
||
this._connectMessage.advice = { timeout: 0 };
|
||
|
||
this._resolvePromise(this.request(this._outbox));
|
||
|
||
this._connectMessage = null;
|
||
this._outbox = [];
|
||
},
|
||
|
||
_flushLargeBatch: function() {
|
||
var string = this.encode(this._outbox);
|
||
if (string.length < this._dispatcher.maxRequestSize) return;
|
||
var last = this._outbox.pop();
|
||
|
||
this._makePromise();
|
||
this._flush();
|
||
|
||
if (last) this._outbox.push(last);
|
||
},
|
||
|
||
_receive: function(replies) {
|
||
if (!replies) return;
|
||
replies = [].concat(replies);
|
||
|
||
this.debug('Client ? received from ? via ?: ?',
|
||
this._dispatcher.clientId, this.endpoint.href, this.connectionType, replies);
|
||
|
||
for (var i = 0, n = replies.length; i < n; i++)
|
||
this._dispatcher.handleResponse(replies[i]);
|
||
},
|
||
|
||
_handleError: function(messages, immediate) {
|
||
messages = [].concat(messages);
|
||
|
||
this.debug('Client ? failed to send to ? via ?: ?',
|
||
this._dispatcher.clientId, this.endpoint.href, this.connectionType, messages);
|
||
|
||
for (var i = 0, n = messages.length; i < n; i++)
|
||
this._dispatcher.handleError(messages[i]);
|
||
},
|
||
|
||
_getCookies: function() {
|
||
var cookies = this._dispatcher.cookies,
|
||
url = this.endpoint.href;
|
||
|
||
if (!cookies) return '';
|
||
|
||
return array.map(cookies.getCookiesSync(url), function(cookie) {
|
||
return cookie.cookieString();
|
||
}).join('; ');
|
||
},
|
||
|
||
_storeCookies: function(setCookie) {
|
||
var cookies = this._dispatcher.cookies,
|
||
url = this.endpoint.href,
|
||
cookie;
|
||
|
||
if (!setCookie || !cookies) return;
|
||
setCookie = [].concat(setCookie);
|
||
|
||
for (var i = 0, n = setCookie.length; i < n; i++) {
|
||
cookie = Cookie.parse(setCookie[i]);
|
||
cookies.setCookieSync(cookie, url);
|
||
}
|
||
},
|
||
|
||
_findProxy: function() {
|
||
if (typeof process === 'undefined') return undefined;
|
||
|
||
var protocol = this.endpoint.protocol;
|
||
if (!protocol) return undefined;
|
||
|
||
var name = protocol.replace(/:$/, '').toLowerCase() + '_proxy',
|
||
upcase = name.toUpperCase(),
|
||
env = process.env,
|
||
keys, proxy;
|
||
|
||
if (name === 'http_proxy' && env.REQUEST_METHOD) {
|
||
keys = Object.keys(env).filter(function(k) { return /^http_proxy$/i.test(k) });
|
||
if (keys.length === 1) {
|
||
if (keys[0] === name && env[upcase] === undefined)
|
||
proxy = env[name];
|
||
} else if (keys.length > 1) {
|
||
proxy = env[name];
|
||
}
|
||
proxy = proxy || env['CGI_' + upcase];
|
||
} else {
|
||
proxy = env[name] || env[upcase];
|
||
if (proxy && !env[name])
|
||
console.warn('The environment variable ' + upcase +
|
||
' is discouraged. Use ' + name + '.');
|
||
}
|
||
return proxy;
|
||
}
|
||
|
||
}), {
|
||
get: function(dispatcher, allowed, disabled, callback, context) {
|
||
var endpoint = dispatcher.endpoint;
|
||
|
||
array.asyncEach(this._transports, function(pair, resume) {
|
||
var connType = pair[0], klass = pair[1],
|
||
connEndpoint = dispatcher.endpointFor(connType);
|
||
|
||
if (array.indexOf(disabled, connType) >= 0)
|
||
return resume();
|
||
|
||
if (array.indexOf(allowed, connType) < 0) {
|
||
klass.isUsable(dispatcher, connEndpoint, function() {});
|
||
return resume();
|
||
}
|
||
|
||
klass.isUsable(dispatcher, connEndpoint, function(isUsable) {
|
||
if (!isUsable) return resume();
|
||
var transport = klass.hasOwnProperty('create') ? klass.create(dispatcher, connEndpoint) : new klass(dispatcher, connEndpoint);
|
||
callback.call(context, transport);
|
||
});
|
||
}, function() {
|
||
throw new Error('Could not find a usable connection type for ' + endpoint.href);
|
||
});
|
||
},
|
||
|
||
register: function(type, klass) {
|
||
this._transports.push([type, klass]);
|
||
klass.prototype.connectionType = type;
|
||
},
|
||
|
||
getConnectionTypes: function() {
|
||
return array.map(this._transports, function(t) { return t[0] });
|
||
},
|
||
|
||
disable: function(feature) {
|
||
if (feature !== 'autodisconnect') return;
|
||
|
||
for (var i = 0; i < this._transports.length; i++)
|
||
this._transports[i][1]._unloaded = false;
|
||
},
|
||
|
||
_transports: []
|
||
});
|
||
|
||
assign(Transport.prototype, Logging);
|
||
assign(Transport.prototype, Timeouts);
|
||
|
||
module.exports = Transport;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/web_socket.js":
|
||
/*!*************************************!*\
|
||
!*** ./src/transport/web_socket.js ***!
|
||
\*************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
Promise = __webpack_require__(/*! ../util/promise */ "./src/util/promise.js"),
|
||
Set = __webpack_require__(/*! ../util/set */ "./src/util/set.js"),
|
||
URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
|
||
browser = __webpack_require__(/*! ../util/browser */ "./src/util/browser/event.js"),
|
||
copyObject = __webpack_require__(/*! ../util/copy_object */ "./src/util/copy_object.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
|
||
ws = __webpack_require__(/*! ../util/websocket */ "./src/util/websocket/browser_websocket.js"),
|
||
Deferrable = __webpack_require__(/*! ../mixins/deferrable */ "./src/mixins/deferrable.js"),
|
||
Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
|
||
|
||
var WebSocket = assign(Class(Transport, {
|
||
UNCONNECTED: 1,
|
||
CONNECTING: 2,
|
||
CONNECTED: 3,
|
||
|
||
batching: false,
|
||
|
||
isUsable: function(callback, context) {
|
||
this.callback(function() { callback.call(context, true) });
|
||
this.errback(function() { callback.call(context, false) });
|
||
this.connect();
|
||
},
|
||
|
||
request: function(messages) {
|
||
this._pending = this._pending || new Set();
|
||
for (var i = 0, n = messages.length; i < n; i++) this._pending.add(messages[i]);
|
||
|
||
var self = this;
|
||
|
||
var promise = new Promise(function(resolve, reject) {
|
||
self.callback(function(socket) {
|
||
if (!socket || socket.readyState !== 1) return;
|
||
socket.send(toJSON(messages));
|
||
resolve(socket);
|
||
});
|
||
|
||
self.connect();
|
||
});
|
||
|
||
return {
|
||
abort: function() { promise.then(function(ws) { ws.close() }) }
|
||
};
|
||
},
|
||
|
||
connect: function() {
|
||
if (WebSocket._unloaded) return;
|
||
|
||
this._state = this._state || this.UNCONNECTED;
|
||
if (this._state !== this.UNCONNECTED) return;
|
||
this._state = this.CONNECTING;
|
||
|
||
var socket = this._createSocket();
|
||
if (!socket) return this.setDeferredStatus('failed');
|
||
|
||
var self = this;
|
||
|
||
socket.onopen = function() {
|
||
if (socket.headers) self._storeCookies(socket.headers['set-cookie']);
|
||
self._socket = socket;
|
||
self._state = self.CONNECTED;
|
||
self._everConnected = true;
|
||
self.setDeferredStatus('succeeded', socket);
|
||
};
|
||
|
||
var closed = false;
|
||
socket.onclose = socket.onerror = function() {
|
||
if (closed) return;
|
||
closed = true;
|
||
|
||
var wasConnected = (self._state === self.CONNECTED);
|
||
socket.onopen = socket.onclose = socket.onerror = socket.onmessage = null;
|
||
|
||
delete self._socket;
|
||
self._state = self.UNCONNECTED;
|
||
|
||
var pending = self._pending ? self._pending.toArray() : [];
|
||
delete self._pending;
|
||
|
||
if (wasConnected || self._everConnected) {
|
||
self.setDeferredStatus('unknown');
|
||
self._handleError(pending, wasConnected);
|
||
} else {
|
||
self.setDeferredStatus('failed');
|
||
}
|
||
};
|
||
|
||
socket.onmessage = function(event) {
|
||
var replies;
|
||
try { replies = JSON.parse(event.data) } catch (error) {}
|
||
|
||
if (!replies) return;
|
||
|
||
replies = [].concat(replies);
|
||
|
||
for (var i = 0, n = replies.length; i < n; i++) {
|
||
if (replies[i].successful === undefined) continue;
|
||
self._pending.remove(replies[i]);
|
||
}
|
||
self._receive(replies);
|
||
};
|
||
},
|
||
|
||
close: function() {
|
||
if (!this._socket) return;
|
||
this._socket.close();
|
||
},
|
||
|
||
_createSocket: function() {
|
||
var url = WebSocket.getSocketUrl(this.endpoint),
|
||
headers = this._dispatcher.headers,
|
||
extensions = this._dispatcher.wsExtensions,
|
||
cookie = this._getCookies(),
|
||
tls = this._dispatcher.tls,
|
||
options = { extensions: extensions, headers: headers, proxy: this._proxy, tls: tls };
|
||
|
||
if (cookie !== '') options.headers['Cookie'] = cookie;
|
||
|
||
try {
|
||
return ws.create(url, [], options);
|
||
} catch (e) {
|
||
// catch CSP error to allow transport to fallback to next connType
|
||
}
|
||
}
|
||
|
||
}), {
|
||
PROTOCOLS: {
|
||
'http:': 'ws:',
|
||
'https:': 'wss:'
|
||
},
|
||
|
||
create: function(dispatcher, endpoint) {
|
||
var sockets = dispatcher.transports.websocket = dispatcher.transports.websocket || {};
|
||
sockets[endpoint.href] = sockets[endpoint.href] || new this(dispatcher, endpoint);
|
||
return sockets[endpoint.href];
|
||
},
|
||
|
||
getSocketUrl: function(endpoint) {
|
||
endpoint = copyObject(endpoint);
|
||
endpoint.protocol = this.PROTOCOLS[endpoint.protocol];
|
||
return URI.stringify(endpoint);
|
||
},
|
||
|
||
isUsable: function(dispatcher, endpoint, callback, context) {
|
||
this.create(dispatcher, endpoint).isUsable(callback, context);
|
||
}
|
||
});
|
||
|
||
assign(WebSocket.prototype, Deferrable);
|
||
|
||
if (browser.Event && global.onbeforeunload !== undefined) {
|
||
browser.Event.on(global, 'beforeunload', function() {
|
||
if (WebSocket._unloaded === undefined)
|
||
WebSocket._unloaded = true;
|
||
});
|
||
}
|
||
|
||
module.exports = WebSocket;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/transport/xhr.js":
|
||
/*!******************************!*\
|
||
!*** ./src/transport/xhr.js ***!
|
||
\******************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var Class = __webpack_require__(/*! ../util/class */ "./src/util/class.js"),
|
||
URI = __webpack_require__(/*! ../util/uri */ "./src/util/uri.js"),
|
||
browser = __webpack_require__(/*! ../util/browser */ "./src/util/browser/event.js"),
|
||
assign = __webpack_require__(/*! ../util/assign */ "./src/util/assign.js"),
|
||
toJSON = __webpack_require__(/*! ../util/to_json */ "./src/util/to_json.js"),
|
||
Transport = __webpack_require__(/*! ./transport */ "./src/transport/transport.js");
|
||
|
||
var XHR = assign(Class(Transport, {
|
||
encode: function(messages) {
|
||
return toJSON(messages);
|
||
},
|
||
|
||
request: function(messages) {
|
||
var href = this.endpoint.href,
|
||
self = this,
|
||
xhr;
|
||
|
||
// Prefer XMLHttpRequest over ActiveXObject if they both exist
|
||
if (global.XMLHttpRequest) {
|
||
xhr = new XMLHttpRequest();
|
||
} else if (global.ActiveXObject) {
|
||
xhr = new ActiveXObject('Microsoft.XMLHTTP');
|
||
} else {
|
||
return this._handleError(messages);
|
||
}
|
||
|
||
xhr.open('POST', href, true);
|
||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||
xhr.setRequestHeader('Pragma', 'no-cache');
|
||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||
|
||
var headers = this._dispatcher.headers;
|
||
for (var key in headers) {
|
||
if (!headers.hasOwnProperty(key)) continue;
|
||
xhr.setRequestHeader(key, headers[key]);
|
||
}
|
||
|
||
var abort = function() { xhr.abort() };
|
||
if (global.onbeforeunload !== undefined)
|
||
browser.Event.on(global, 'beforeunload', abort);
|
||
|
||
xhr.onreadystatechange = function() {
|
||
if (!xhr || xhr.readyState !== 4) return;
|
||
|
||
var replies = null,
|
||
status = xhr.status,
|
||
text = xhr.responseText,
|
||
successful = (status >= 200 && status < 300) || status === 304 || status === 1223;
|
||
|
||
if (global.onbeforeunload !== undefined)
|
||
browser.Event.detach(global, 'beforeunload', abort);
|
||
|
||
xhr.onreadystatechange = function() {};
|
||
xhr = null;
|
||
|
||
if (!successful) return self._handleError(messages);
|
||
|
||
try {
|
||
replies = JSON.parse(text);
|
||
} catch (error) {}
|
||
|
||
if (replies)
|
||
self._receive(replies);
|
||
else
|
||
self._handleError(messages);
|
||
};
|
||
|
||
xhr.send(this.encode(messages));
|
||
return xhr;
|
||
}
|
||
}), {
|
||
isUsable: function(dispatcher, endpoint, callback, context) {
|
||
var usable = (navigator.product === 'ReactNative')
|
||
|| URI.isSameOrigin(endpoint);
|
||
|
||
callback.call(context, usable);
|
||
}
|
||
});
|
||
|
||
module.exports = XHR;
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/array.js":
|
||
/*!***************************!*\
|
||
!*** ./src/util/array.js ***!
|
||
\***************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = {
|
||
commonElement: function(lista, listb) {
|
||
for (var i = 0, n = lista.length; i < n; i++) {
|
||
if (this.indexOf(listb, lista[i]) !== -1)
|
||
return lista[i];
|
||
}
|
||
return null;
|
||
},
|
||
|
||
indexOf: function(list, needle) {
|
||
if (list.indexOf) return list.indexOf(needle);
|
||
|
||
for (var i = 0, n = list.length; i < n; i++) {
|
||
if (list[i] === needle) return i;
|
||
}
|
||
return -1;
|
||
},
|
||
|
||
map: function(object, callback, context) {
|
||
if (object.map) return object.map(callback, context);
|
||
var result = [];
|
||
|
||
if (object instanceof Array) {
|
||
for (var i = 0, n = object.length; i < n; i++) {
|
||
result.push(callback.call(context || null, object[i], i));
|
||
}
|
||
} else {
|
||
for (var key in object) {
|
||
if (!object.hasOwnProperty(key)) continue;
|
||
result.push(callback.call(context || null, key, object[key]));
|
||
}
|
||
}
|
||
return result;
|
||
},
|
||
|
||
filter: function(array, callback, context) {
|
||
if (array.filter) return array.filter(callback, context);
|
||
var result = [];
|
||
for (var i = 0, n = array.length; i < n; i++) {
|
||
if (callback.call(context || null, array[i], i))
|
||
result.push(array[i]);
|
||
}
|
||
return result;
|
||
},
|
||
|
||
asyncEach: function(list, iterator, callback, context) {
|
||
var n = list.length,
|
||
i = -1,
|
||
calls = 0,
|
||
looping = false;
|
||
|
||
var iterate = function() {
|
||
calls -= 1;
|
||
i += 1;
|
||
if (i === n) return callback && callback.call(context);
|
||
iterator(list[i], resume);
|
||
};
|
||
|
||
var loop = function() {
|
||
if (looping) return;
|
||
looping = true;
|
||
while (calls > 0) iterate();
|
||
looping = false;
|
||
};
|
||
|
||
var resume = function() {
|
||
calls += 1;
|
||
loop();
|
||
};
|
||
resume();
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/assign.js":
|
||
/*!****************************!*\
|
||
!*** ./src/util/assign.js ***!
|
||
\****************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var forEach = Array.prototype.forEach,
|
||
hasOwn = Object.prototype.hasOwnProperty;
|
||
|
||
module.exports = function(target) {
|
||
forEach.call(arguments, function(source, i) {
|
||
if (i === 0) return;
|
||
|
||
for (var key in source) {
|
||
if (hasOwn.call(source, key)) target[key] = source[key];
|
||
}
|
||
});
|
||
|
||
return target;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/browser/event.js":
|
||
/*!***********************************!*\
|
||
!*** ./src/util/browser/event.js ***!
|
||
\***********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Event = {
|
||
_registry: [],
|
||
|
||
on: function(element, eventName, callback, context) {
|
||
var wrapped = function() { callback.call(context) };
|
||
|
||
if (element.addEventListener)
|
||
element.addEventListener(eventName, wrapped, false);
|
||
else
|
||
element.attachEvent('on' + eventName, wrapped);
|
||
|
||
this._registry.push({
|
||
_element: element,
|
||
_type: eventName,
|
||
_callback: callback,
|
||
_context: context,
|
||
_handler: wrapped
|
||
});
|
||
},
|
||
|
||
detach: function(element, eventName, callback, context) {
|
||
var i = this._registry.length, register;
|
||
while (i--) {
|
||
register = this._registry[i];
|
||
|
||
if ((element && element !== register._element) ||
|
||
(eventName && eventName !== register._type) ||
|
||
(callback && callback !== register._callback) ||
|
||
(context && context !== register._context))
|
||
continue;
|
||
|
||
if (register._element.removeEventListener)
|
||
register._element.removeEventListener(register._type, register._handler, false);
|
||
else
|
||
register._element.detachEvent('on' + register._type, register._handler);
|
||
|
||
this._registry.splice(i,1);
|
||
register = null;
|
||
}
|
||
}
|
||
};
|
||
|
||
module.exports = {
|
||
Event: Event
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/class.js":
|
||
/*!***************************!*\
|
||
!*** ./src/util/class.js ***!
|
||
\***************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var assign = __webpack_require__(/*! ./assign */ "./src/util/assign.js");
|
||
|
||
module.exports = function(parent, methods) {
|
||
if (typeof parent !== 'function') {
|
||
methods = parent;
|
||
parent = Object;
|
||
}
|
||
|
||
var klass = function() {
|
||
if (!this.initialize) return this;
|
||
return this.initialize.apply(this, arguments) || this;
|
||
};
|
||
|
||
var bridge = function() {};
|
||
bridge.prototype = parent.prototype;
|
||
|
||
klass.prototype = new bridge();
|
||
assign(klass.prototype, methods);
|
||
|
||
return klass;
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/constants.js":
|
||
/*!*******************************!*\
|
||
!*** ./src/util/constants.js ***!
|
||
\*******************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports) {
|
||
|
||
module.exports = {
|
||
VERSION: '1.4.1',
|
||
|
||
BAYEUX_VERSION: '1.0',
|
||
ID_LENGTH: 160,
|
||
JSONP_CALLBACK: 'jsonpcallback',
|
||
CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],
|
||
|
||
MANDATORY_CONNECTION_TYPES: ['long-polling', 'callback-polling', 'in-process']
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/cookies/browser_cookies.js":
|
||
/*!*********************************************!*\
|
||
!*** ./src/util/cookies/browser_cookies.js ***!
|
||
\*********************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = {};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/copy_object.js":
|
||
/*!*********************************!*\
|
||
!*** ./src/util/copy_object.js ***!
|
||
\*********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var copyObject = function(object) {
|
||
var clone, i, key;
|
||
if (object instanceof Array) {
|
||
clone = [];
|
||
i = object.length;
|
||
while (i--) clone[i] = copyObject(object[i]);
|
||
return clone;
|
||
} else if (typeof object === 'object') {
|
||
clone = (object === null) ? null : {};
|
||
for (key in object) clone[key] = copyObject(object[key]);
|
||
return clone;
|
||
} else {
|
||
return object;
|
||
}
|
||
};
|
||
|
||
module.exports = copyObject;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/event_emitter.js":
|
||
/*!***********************************!*\
|
||
!*** ./src/util/event_emitter.js ***!
|
||
\***********************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*
|
||
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||
this software and associated documentation files (the "Software"), to deal in
|
||
the Software without restriction, including without limitation the rights to
|
||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||
of the Software, and to permit persons to whom the Software is furnished to do
|
||
so, subject to the following conditions:
|
||
|
||
The above copyright notice and this permission notice shall be included in all
|
||
copies or substantial portions of the Software.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
SOFTWARE.
|
||
*/
|
||
|
||
var isArray = typeof Array.isArray === 'function'
|
||
? Array.isArray
|
||
: function (xs) {
|
||
return Object.prototype.toString.call(xs) === '[object Array]'
|
||
}
|
||
;
|
||
function indexOf (xs, x) {
|
||
if (xs.indexOf) return xs.indexOf(x);
|
||
for (var i = 0; i < xs.length; i++) {
|
||
if (x === xs[i]) return i;
|
||
}
|
||
return -1;
|
||
}
|
||
|
||
function EventEmitter() {}
|
||
module.exports = EventEmitter;
|
||
|
||
EventEmitter.prototype.emit = function(type) {
|
||
// If there is no 'error' event listener then throw.
|
||
if (type === 'error') {
|
||
if (!this._events || !this._events.error ||
|
||
(isArray(this._events.error) && !this._events.error.length))
|
||
{
|
||
if (arguments[1] instanceof Error) {
|
||
throw arguments[1]; // Unhandled 'error' event
|
||
} else {
|
||
throw new Error("Uncaught, unspecified 'error' event.");
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
|
||
if (!this._events) return false;
|
||
var handler = this._events[type];
|
||
if (!handler) return false;
|
||
|
||
if (typeof handler == 'function') {
|
||
switch (arguments.length) {
|
||
// fast cases
|
||
case 1:
|
||
handler.call(this);
|
||
break;
|
||
case 2:
|
||
handler.call(this, arguments[1]);
|
||
break;
|
||
case 3:
|
||
handler.call(this, arguments[1], arguments[2]);
|
||
break;
|
||
// slower
|
||
default:
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
handler.apply(this, args);
|
||
}
|
||
return true;
|
||
|
||
} else if (isArray(handler)) {
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
|
||
var listeners = handler.slice();
|
||
for (var i = 0, l = listeners.length; i < l; i++) {
|
||
listeners[i].apply(this, args);
|
||
}
|
||
return true;
|
||
|
||
} else {
|
||
return false;
|
||
}
|
||
};
|
||
|
||
// EventEmitter is defined in src/node_events.cc
|
||
// EventEmitter.prototype.emit() is also defined there.
|
||
EventEmitter.prototype.addListener = function(type, listener) {
|
||
if ('function' !== typeof listener) {
|
||
throw new Error('addListener only takes instances of Function');
|
||
}
|
||
|
||
if (!this._events) this._events = {};
|
||
|
||
// To avoid recursion in the case that type == "newListeners"! Before
|
||
// adding it to the listeners, first emit "newListeners".
|
||
this.emit('newListener', type, listener);
|
||
|
||
if (!this._events[type]) {
|
||
// Optimize the case of one listener. Don't need the extra array object.
|
||
this._events[type] = listener;
|
||
} else if (isArray(this._events[type])) {
|
||
// If we've already got an array, just append.
|
||
this._events[type].push(listener);
|
||
} else {
|
||
// Adding the second element, need to change to array.
|
||
this._events[type] = [this._events[type], listener];
|
||
}
|
||
|
||
return this;
|
||
};
|
||
|
||
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
||
|
||
EventEmitter.prototype.once = function(type, listener) {
|
||
var self = this;
|
||
self.on(type, function g() {
|
||
self.removeListener(type, g);
|
||
listener.apply(this, arguments);
|
||
});
|
||
|
||
return this;
|
||
};
|
||
|
||
EventEmitter.prototype.removeListener = function(type, listener) {
|
||
if ('function' !== typeof listener) {
|
||
throw new Error('removeListener only takes instances of Function');
|
||
}
|
||
|
||
// does not use listeners(), so no side effect of creating _events[type]
|
||
if (!this._events || !this._events[type]) return this;
|
||
|
||
var list = this._events[type];
|
||
|
||
if (isArray(list)) {
|
||
var i = indexOf(list, listener);
|
||
if (i < 0) return this;
|
||
list.splice(i, 1);
|
||
if (list.length == 0)
|
||
delete this._events[type];
|
||
} else if (this._events[type] === listener) {
|
||
delete this._events[type];
|
||
}
|
||
|
||
return this;
|
||
};
|
||
|
||
EventEmitter.prototype.removeAllListeners = function(type) {
|
||
if (arguments.length === 0) {
|
||
this._events = {};
|
||
return this;
|
||
}
|
||
|
||
// does not use listeners(), so no side effect of creating _events[type]
|
||
if (type && this._events && this._events[type]) this._events[type] = null;
|
||
return this;
|
||
};
|
||
|
||
EventEmitter.prototype.listeners = function(type) {
|
||
if (!this._events) this._events = {};
|
||
if (!this._events[type]) this._events[type] = [];
|
||
if (!isArray(this._events[type])) {
|
||
this._events[type] = [this._events[type]];
|
||
}
|
||
return this._events[type];
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/promise.js":
|
||
/*!*****************************!*\
|
||
!*** ./src/util/promise.js ***!
|
||
\*****************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var asap = __webpack_require__(/*! asap */ "./node_modules/asap/browser-asap.js");
|
||
|
||
var PENDING = -1,
|
||
FULFILLED = 0,
|
||
REJECTED = 1;
|
||
|
||
var Promise = function(task) {
|
||
this._state = PENDING;
|
||
this._value = null;
|
||
this._defer = [];
|
||
|
||
execute(this, task);
|
||
};
|
||
|
||
Promise.prototype.then = function(onFulfilled, onRejected) {
|
||
var promise = new Promise();
|
||
|
||
var deferred = {
|
||
promise: promise,
|
||
onFulfilled: onFulfilled,
|
||
onRejected: onRejected
|
||
};
|
||
|
||
if (this._state === PENDING)
|
||
this._defer.push(deferred);
|
||
else
|
||
propagate(this, deferred);
|
||
|
||
return promise;
|
||
};
|
||
|
||
Promise.prototype['catch'] = function(onRejected) {
|
||
return this.then(null, onRejected);
|
||
};
|
||
|
||
var execute = function(promise, task) {
|
||
if (typeof task !== 'function') return;
|
||
|
||
var calls = 0;
|
||
|
||
var resolvePromise = function(value) {
|
||
if (calls++ === 0) resolve(promise, value);
|
||
};
|
||
|
||
var rejectPromise = function(reason) {
|
||
if (calls++ === 0) reject(promise, reason);
|
||
};
|
||
|
||
try {
|
||
task(resolvePromise, rejectPromise);
|
||
} catch (error) {
|
||
rejectPromise(error);
|
||
}
|
||
};
|
||
|
||
var propagate = function(promise, deferred) {
|
||
var state = promise._state,
|
||
value = promise._value,
|
||
next = deferred.promise,
|
||
handler = [deferred.onFulfilled, deferred.onRejected][state],
|
||
pass = [resolve, reject][state];
|
||
|
||
if (typeof handler !== 'function')
|
||
return pass(next, value);
|
||
|
||
asap(function() {
|
||
try {
|
||
resolve(next, handler(value));
|
||
} catch (error) {
|
||
reject(next, error);
|
||
}
|
||
});
|
||
};
|
||
|
||
var resolve = function(promise, value) {
|
||
if (promise === value)
|
||
return reject(promise, new TypeError('Recursive promise chain detected'));
|
||
|
||
var then;
|
||
|
||
try {
|
||
then = getThen(value);
|
||
} catch (error) {
|
||
return reject(promise, error);
|
||
}
|
||
|
||
if (!then) return fulfill(promise, value);
|
||
|
||
execute(promise, function(resolvePromise, rejectPromise) {
|
||
then.call(value, resolvePromise, rejectPromise);
|
||
});
|
||
};
|
||
|
||
var getThen = function(value) {
|
||
var type = typeof value,
|
||
then = (type === 'object' || type === 'function') && value && value.then;
|
||
|
||
return (typeof then === 'function')
|
||
? then
|
||
: null;
|
||
};
|
||
|
||
var fulfill = function(promise, value) {
|
||
settle(promise, FULFILLED, value);
|
||
};
|
||
|
||
var reject = function(promise, reason) {
|
||
settle(promise, REJECTED, reason);
|
||
};
|
||
|
||
var settle = function(promise, state, value) {
|
||
var defer = promise._defer, i = 0;
|
||
|
||
promise._state = state;
|
||
promise._value = value;
|
||
promise._defer = null;
|
||
|
||
if (defer.length === 0) return;
|
||
while (i < defer.length) propagate(promise, defer[i++]);
|
||
};
|
||
|
||
Promise.resolve = function(value) {
|
||
try {
|
||
if (getThen(value)) return value;
|
||
} catch (error) {
|
||
return Promise.reject(error);
|
||
}
|
||
|
||
return new Promise(function(resolve, reject) { resolve(value) });
|
||
};
|
||
|
||
Promise.reject = function(reason) {
|
||
return new Promise(function(resolve, reject) { reject(reason) });
|
||
};
|
||
|
||
Promise.all = function(promises) {
|
||
return new Promise(function(resolve, reject) {
|
||
var list = [], n = promises.length, i;
|
||
|
||
if (n === 0) return resolve(list);
|
||
|
||
var push = function(promise, i) {
|
||
Promise.resolve(promise).then(function(value) {
|
||
list[i] = value;
|
||
if (--n === 0) resolve(list);
|
||
}, reject);
|
||
};
|
||
|
||
for (i = 0; i < n; i++) push(promises[i], i);
|
||
});
|
||
};
|
||
|
||
Promise.race = function(promises) {
|
||
return new Promise(function(resolve, reject) {
|
||
for (var i = 0, n = promises.length; i < n; i++)
|
||
Promise.resolve(promises[i]).then(resolve, reject);
|
||
});
|
||
};
|
||
|
||
Promise.deferred = function() {
|
||
var tuple = {};
|
||
|
||
tuple.promise = new Promise(function(resolve, reject) {
|
||
tuple.resolve = resolve;
|
||
tuple.reject = reject;
|
||
});
|
||
return tuple;
|
||
};
|
||
|
||
module.exports = Promise;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/set.js":
|
||
/*!*************************!*\
|
||
!*** ./src/util/set.js ***!
|
||
\*************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Class = __webpack_require__(/*! ./class */ "./src/util/class.js");
|
||
|
||
module.exports = Class({
|
||
initialize: function() {
|
||
this._index = {};
|
||
},
|
||
|
||
add: function(item) {
|
||
var key = (item.id !== undefined) ? item.id : item;
|
||
if (this._index.hasOwnProperty(key)) return false;
|
||
this._index[key] = item;
|
||
return true;
|
||
},
|
||
|
||
forEach: function(block, context) {
|
||
for (var key in this._index) {
|
||
if (this._index.hasOwnProperty(key))
|
||
block.call(context, this._index[key]);
|
||
}
|
||
},
|
||
|
||
isEmpty: function() {
|
||
for (var key in this._index) {
|
||
if (this._index.hasOwnProperty(key)) return false;
|
||
}
|
||
return true;
|
||
},
|
||
|
||
member: function(item) {
|
||
for (var key in this._index) {
|
||
if (this._index[key] === item) return true;
|
||
}
|
||
return false;
|
||
},
|
||
|
||
remove: function(item) {
|
||
var key = (item.id !== undefined) ? item.id : item;
|
||
var removed = this._index[key];
|
||
delete this._index[key];
|
||
return removed;
|
||
},
|
||
|
||
toArray: function() {
|
||
var array = [];
|
||
this.forEach(function(item) { array.push(item) });
|
||
return array;
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/to_json.js":
|
||
/*!*****************************!*\
|
||
!*** ./src/util/to_json.js ***!
|
||
\*****************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
// http://assanka.net/content/tech/2009/09/02/json2-js-vs-prototype/
|
||
|
||
module.exports = function(object) {
|
||
return JSON.stringify(object, function(key, value) {
|
||
return (this[key] instanceof Array) ? this[key] : value;
|
||
});
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/uri.js":
|
||
/*!*************************!*\
|
||
!*** ./src/util/uri.js ***!
|
||
\*************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = {
|
||
isURI: function(uri) {
|
||
return uri && uri.protocol && uri.host && uri.path;
|
||
},
|
||
|
||
isSameOrigin: function(uri) {
|
||
return uri.protocol === location.protocol &&
|
||
uri.hostname === location.hostname &&
|
||
uri.port === location.port;
|
||
},
|
||
|
||
parse: function(url) {
|
||
if (typeof url !== 'string') return url;
|
||
var uri = {}, parts, query, pairs, i, n, data;
|
||
|
||
var consume = function(name, pattern) {
|
||
url = url.replace(pattern, function(match) {
|
||
uri[name] = match;
|
||
return '';
|
||
});
|
||
uri[name] = uri[name] || '';
|
||
};
|
||
|
||
consume('protocol', /^[a-z]+\:/i);
|
||
consume('host', /^\/\/[^\/\?#]+/);
|
||
|
||
if (!/^\//.test(url) && !uri.host)
|
||
url = location.pathname.replace(/[^\/]*$/, '') + url;
|
||
|
||
consume('pathname', /^[^\?#]*/);
|
||
consume('search', /^\?[^#]*/);
|
||
consume('hash', /^#.*/);
|
||
|
||
uri.protocol = uri.protocol || location.protocol;
|
||
|
||
if (uri.host) {
|
||
uri.host = uri.host.substr(2);
|
||
|
||
if (/@/.test(uri.host)) {
|
||
uri.auth = uri.host.split('@')[0];
|
||
uri.host = uri.host.split('@')[1];
|
||
}
|
||
parts = uri.host.match(/^\[([^\]]+)\]|^[^:]+/);
|
||
uri.hostname = parts[1] || parts[0];
|
||
uri.port = (uri.host.match(/:(\d+)$/) || [])[1] || '';
|
||
} else {
|
||
uri.host = location.host;
|
||
uri.hostname = location.hostname;
|
||
uri.port = location.port;
|
||
}
|
||
|
||
uri.pathname = uri.pathname || '/';
|
||
uri.path = uri.pathname + uri.search;
|
||
|
||
query = uri.search.replace(/^\?/, '');
|
||
pairs = query ? query.split('&') : [];
|
||
data = {};
|
||
|
||
for (i = 0, n = pairs.length; i < n; i++) {
|
||
parts = pairs[i].split('=');
|
||
data[decodeURIComponent(parts[0] || '')] = decodeURIComponent(parts[1] || '');
|
||
}
|
||
|
||
uri.query = data;
|
||
|
||
uri.href = this.stringify(uri);
|
||
return uri;
|
||
},
|
||
|
||
stringify: function(uri) {
|
||
var auth = uri.auth ? uri.auth + '@' : '',
|
||
string = uri.protocol + '//' + auth + uri.host;
|
||
|
||
string += uri.pathname + this.queryString(uri.query) + (uri.hash || '');
|
||
|
||
return string;
|
||
},
|
||
|
||
queryString: function(query) {
|
||
var pairs = [];
|
||
for (var key in query) {
|
||
if (!query.hasOwnProperty(key)) continue;
|
||
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(query[key]));
|
||
}
|
||
if (pairs.length === 0) return '';
|
||
return '?' + pairs.join('&');
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/validate_options.js":
|
||
/*!**************************************!*\
|
||
!*** ./src/util/validate_options.js ***!
|
||
\**************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var array = __webpack_require__(/*! ./array */ "./src/util/array.js");
|
||
|
||
module.exports = function(options, validKeys) {
|
||
for (var key in options) {
|
||
if (array.indexOf(validKeys, key) < 0)
|
||
throw new Error('Unrecognized option: ' + key);
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/util/websocket/browser_websocket.js":
|
||
/*!*************************************************!*\
|
||
!*** ./src/util/websocket/browser_websocket.js ***!
|
||
\*************************************************/
|
||
/*! no static exports found */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(global) {
|
||
|
||
var WS = global.MozWebSocket || global.WebSocket;
|
||
|
||
module.exports = {
|
||
create: function(url, protocols, options) {
|
||
if (typeof WS !== 'function') return null;
|
||
return new WS(url);
|
||
}
|
||
};
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ })
|
||
|
||
/******/ });
|
||
//# sourceMappingURL=faye-browser.js.map
|