PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / assets / js / hooks / use-query-params.js

use-query-params.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/assets/js/hooks/use-query-params.js

25 lines 562 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 export default function useQueryParams() {
2 const urlSearchParams = new URLSearchParams( window.location.search ),
3 urlParams = Object.fromEntries( urlSearchParams.entries() ),
4 hashValue = location.hash.match( /\?(.+)/ )?.[ 1 ],
5 hashParams = {};
6
7 if ( hashValue ) {
8 hashValue.split( '&' ).forEach( ( pair ) => {
9 const [ key, value ] = pair.split( '=' );
10
11 hashParams[ key ] = value;
12 } );
13 }
14
15 // Merging the URL params with the hash params.
16 const queryParams = {
17 ...urlParams,
18 ...hashParams,
19 };
20
21 return {
22 getAll: () => queryParams,
23 };
24 }
25