web-manager 3.2.60 → 3.2.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utilities.js +15 -0
- package/package.json +1 -1
package/lib/utilities.js
CHANGED
@@ -144,4 +144,19 @@ Utilities.getContext = function () {
|
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
147
|
+
// Navigate fn that takes a url and an object of query params
|
148
|
+
Utilities.navigate = function (url, params) {
|
149
|
+
// Should work if the url is a relative path too
|
150
|
+
var newUrl = new URL(url, window.location.origin);
|
151
|
+
|
152
|
+
// Add the params to the url
|
153
|
+
Object.keys(params).forEach(function (key) {
|
154
|
+
newUrl.searchParams.set(key, params[key]);
|
155
|
+
});
|
156
|
+
|
157
|
+
// Navigate to the new url
|
158
|
+
window.location.href = newUrl;
|
159
|
+
}
|
160
|
+
|
161
|
+
|
147
162
|
module.exports = Utilities;
|
package/package.json
CHANGED