web-manager 3.2.60 → 3.2.61

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/utilities.js +15 -0
  2. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.2.60",
3
+ "version": "3.2.61",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {