Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd20e9a

Browse files
committed
chore: 移除无用文件
1 parent838679f commitdd20e9a

File tree

6 files changed

+57
-150
lines changed

6 files changed

+57
-150
lines changed

‎config/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎config/proxy.ts‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎src/utils/crypto/index.ts‎

Lines changed: 0 additions & 18 deletions
This file was deleted.

‎src/utils/format/index.ts‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎src/utils/storage/index.ts‎

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1-
export*from'./local'
1+
interfaceStorageData<T=any>{
2+
data:T
3+
expire:number|null
4+
}
5+
6+
exportfunctioncreateLocalStorage(options?:{expire?:number|null}){
7+
constDEFAULT_CACHE_TIME=60*60*24*7
8+
9+
const{ expire}=Object.assign({expire:DEFAULT_CACHE_TIME},options)
10+
11+
functionset<T=any>(key:string,data:T){
12+
conststorageData:StorageData<T>={
13+
data,
14+
expire:expire!==null ?newDate().getTime()+expire*1000 :null,
15+
}
16+
17+
constjson=JSON.stringify(storageData)
18+
window.localStorage.setItem(key,json)
19+
}
20+
21+
functionget(key:string){
22+
constjson=window.localStorage.getItem(key)
23+
if(json){
24+
letstorageData:StorageData|null=null
25+
26+
try{
27+
storageData=JSON.parse(json)
28+
}
29+
catch{
30+
// Prevent failure
31+
}
32+
33+
if(storageData){
34+
const{ data, expire}=storageData
35+
if(expire===null||expire>=Date.now())
36+
returndata
37+
}
38+
39+
remove(key)
40+
returnnull
41+
}
42+
}
43+
44+
functionremove(key:string){
45+
window.localStorage.removeItem(key)
46+
}
47+
48+
functionclear(){
49+
window.localStorage.clear()
50+
}
51+
52+
return{ set, get, remove, clear}
53+
}
54+
55+
exportconstls=createLocalStorage()
56+
57+
exportconstss=createLocalStorage({expire:null})

‎src/utils/storage/local.ts‎

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp