///<reference path="Direct.ts" /> var econda; (function (econda) { var media; (function (media) { var transport; (function (transport) { var Direct = econda.media.transport.Direct; /** * A proxy is responsible for transfering data to the econda tracking server. * Use {@link econda.media.transport.Direct} proxy to send all request immediately. Currently, this is the only supported * proxy. * * You can configure the proxy manually: * * // at the beginning of your page/app startup * econda.media.transport.Proxy.configure({ * type: "direct", * keepalive: 30 * }); * * If there's no manual configuration, we'll create a default instance with default settings. * * @class econda.media.transport.Proxy */ var Proxy = (function () { function Proxy() { } /** * Get singleton instance of current proxy. You should not use this method directly. * @method */ Proxy.getInstance = function () { if (Proxy.__instance == null) { Proxy.createDefaultInstance(); } return Proxy.__instance; }; /** * Set proxy configuration * @method * @param cfg */ Proxy.configure = function (cfg) { if (typeof cfg.type != 'string') { econda.debug.error("Error in proxy.configure: You must set a proxy type."); return; } var type = cfg.type.toLowerCase(); var proxy = null; switch (type) { case "direct": proxy = new Direct(cfg); break; default: econda.debug.error("To proxy found for type: " + type); } Proxy.__instance = proxy; }; /** * Used to create a default instance if we get no user defined configuration * @method * @private */ Proxy.createDefaultInstance = function () { Proxy.configure({ type: "direct" }); }; /** * Timestamp when page was loaded * @static * @private * @property {Date} __pageInitDate */ Proxy.__pageInitDate = new Date(); /** * Proxy instance * @property {econda.media.transport.Direct} __instance * @private */ Proxy.__instance = null; return Proxy; }()); transport.Proxy = Proxy; })(transport = media.transport || (media.transport = {})); })(media = econda.media || (econda.media = {})); })(econda || (econda = {}));