3
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
Code distributed by Google as part of the polymer project is also
8
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
11
<link rel="import" href="../polymer/polymer.html">
18
is: 'iron-query-params',
23
observer: 'paramsStringChanged',
41
'paramsObjectChanged(paramsObject.*)'
43
paramsStringChanged: function() {
44
this._dontReact = true;
45
this.paramsObject = this._decodeParams(this.paramsString);
46
this._dontReact = false;
48
paramsObjectChanged: function() {
49
if (this._dontReact) {
52
this.paramsString = this._encodeParams(this.paramsObject);
54
_encodeParams: function(params) {
55
var encodedParams = [];
56
for (var key in params) {
57
var value = params[key];
59
encodedParams.push(encodeURIComponent(key));
62
encodeURIComponent(key) +
64
encodeURIComponent(value.toString())
68
return encodedParams.join('&');
70
_decodeParams: function(paramString) {
72
var paramList = (paramString || '').split('&');
73
for (var i = 0; i < paramList.length; i++) {
74
var param = paramList[i].split('=');
76
params[decodeURIComponent(param[0])] =
77
decodeURIComponent(param[1] || '');