MCPcopy
hub / github.com/theajack/disable-devtool / getUrlParam

Function getUrlParam

src/utils/util.ts:13–29  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

11}
12
13export function getUrlParam (name: string) {
14 let {search} = window.location;
15 const {hash} = window.location;
16 // # 在 ? 之前,即 http://localhost/#file?key=value,会导致 search 为空。
17 if (search === '' && hash !== '') {
18 // 为 search 补上前缀'?',以便后面的逻辑处理不变。
19 search = `?${hash.split('?')[1]}`;
20 }
21 if (search !== '' && search !== undefined) {
22 const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
23 const r = search.substr(1).match(reg);
24 if (r != null) {
25 return unescape(r[2]);
26 }
27 }
28 return '';
29}
30
31export function onPageShowHide (
32 onshow: ()=>void,

Callers 1

checkTkFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected