Sha256: e4396e7b029b5793b8305a717de03cbccb0c8708dd269e7433a48671155d6089

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

import query_string from "~vendor/query_string";

var QueryString, location, query;

location = () => { return window.location; };
query = () => { return query_string.parse(location().search); };

QueryString = {
  get(key) {
    return query()[key];
  },

  set(key, value) {
    var current_query = query(),
        new_url;

    current_query[key] = value;
    new_url = `${location.protocol}//${location.host}${location.pathname}?${query_string.stringify(query)}`;
    window.history.replaceState({ path: new_url }, document.title, new_url);
    return current_query;
  }
};

export default QueryString;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docks_theme_api-1.0.3 source/utilities/query_string/query_string.js
docks_theme_api-1.0.2 source/utilities/query_string/query_string.js