src/lib/url-sync.js
/**
 * Instanciate a url sync widget. This widget let you synchronize the search
 * parameters with the URL. It can operate with legacy API and hash or it can use
 * the modern history API. By default, it will use the modern API, but if you are
 * looking for compatibility with IE8 and IE9, then you should set 'useHash' to
 * true.
 * @param {object} options all the parameters to configure the URL synchronization. It
 * may contain the following keys :
 *  - threshold:number time in ms after which a new state is created in the browser
 * history. The default value is 700.
 *  - trackedParameters:string[] parameters that will be synchronized in the
 * URL. By default, it will track the query, all the refinable attribute (facets and numeric
 * filters), the index and the page.
 *  - useHash:boolean if set to true, the url will be hash based. Otherwise,
 * it'll use the query parameters using the modern history API.
 * @return {object} the widget instance
 */
Instanciate a url sync widget. This widget let you synchronize the search
parameters with the URL. It can operate with legacy API and hash or it can use
the modern history API. By default, it will use the modern API, but if you are
looking for compatibility with IE8 and IE9, then you should set 'useHash' to
true.
@param {object} options all the parameters to configure the URL synchronization. It
may contain the following keys :
- threshold:number time in ms after which a new state is created in the browser
history. The default value is 700.
- trackedParameters:string[] parameters that will be synchronized in the
URL. By default, it will track the query, all the refinable attribute (facets and numeric
filters), the index and the page.
- useHash:boolean if set to true, the url will be hash based. Otherwise,
it'll use the query parameters using the modern history API.
@return {object} the widget instance
Instanciate a url sync widget . This widget let you synchronize the search parameters with the URL . It can operate with legacy API and hash or it can use the modern history API . By default it will use the modern API but if you are looking for compatibility with IE8 and IE9 then you should set ' useHash ' to true . @param { object } options all the parameters to configure the URL synchronization . It may contain the following keys : - threshold : number time in ms after which a new state is created in the browser history . The default value is 700 . - trackedParameters : string [] parameters that will be synchronized in the URL . By default it will track the query all the refinable attribute ( facets and numeric filters ) the index and the page . - useHash : boolean if set to true the url will be hash based . Otherwise it ' ll use the query parameters using the modern history API . @return { object } the widget instance
function urlSync(options = {}) {
  const useHash = options.useHash || false;
  const urlUtils = useHash ? hashUrlUtils : modernUrlUtils;
  return new URLSync(urlUtils, options);
}
function urlSync ( options = { } ) { const useHash = options . useHash || false ; const urlUtils = useHash ? hashUrlUtils : modernUrlUtils ; return new URLSync ( urlUtils , options ) ; }
Instanciate a url sync widget.
Instanciate a url sync widget .