Commit 92f43349 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Individualiza peticiones de queryParams

Evita cruces de petición y respuesta entre diferentes peticiones de
parámetros de URL a Router. De esta manera, cada uno recibe su respuesta
y solo la suya.
parent d0f767d9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -485,7 +485,10 @@ define([

		_subGetQueryParams: function(req) {

			this._emitEvt('GET_QUERY_PARAMS', this._currentQueryParams || {});
			this._emitEvt('GET_QUERY_PARAMS', {
				requesterId: req.requesterId,
				queryParams: this._currentQueryParams || {}
			});
		},

		_closeModule: function() {
+20 −5
Original line number Diff line number Diff line
@@ -43,7 +43,10 @@ define([

			this.subscriptionsConfig.push({
				channel: this._buildChannel(this.rootChannel, this.actions.GOT_QUERY_PARAMS),
				callback: '_subGotQueryParams'
				callback: '_subGotQueryParams',
				options: {
					predicate: lang.hitch(this, this._chkRequesterIsMe)
				}
			});
		},

@@ -51,16 +54,28 @@ define([

			this.publicationsConfig.push({
				event: 'GET_QUERY_PARAMS',
				channel: this._buildChannel(this.rootChannel, this.actions.GET_QUERY_PARAMS)
				channel: this._buildChannel(this.rootChannel, this.actions.GET_QUERY_PARAMS),
				callback: '_pubGetQueryParams'
			});
		},

		_pubGetQueryParams: function(channel, evtObj) {

			var pubObj = {
				requesterId: this.getOwnChannel()
			};

			this._publish(channel, pubObj);
		},

		_subGotQueryParams: function(res) {

			this._gotQueryParams(res);
			var params = res.queryParams;

			this._gotQueryParams(params);

			for (var param in res) {
				this._gotQueryParam(param, res[param]);
			for (var param in params) {
				this._gotQueryParam(param, params[param]);
			}
		}
	});