feat: 添加 FingerprintJS 依赖,集成访客 ID 和指纹数据功能
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import FingerprintJS from '@fingerprintjs/fingerprintjs'
|
||||
|
||||
let fpPromise
|
||||
|
||||
export const loadFingerprint = () => {
|
||||
if (!fpPromise) {
|
||||
fpPromise = FingerprintJS.load()
|
||||
}
|
||||
return fpPromise
|
||||
}
|
||||
|
||||
export const getVisitorId = async () => {
|
||||
const fp = await loadFingerprint()
|
||||
const result = await fp.get()
|
||||
return result.visitorId
|
||||
}
|
||||
|
||||
export const getFingerprintData = async () => {
|
||||
const fp = await loadFingerprint()
|
||||
const result = await fp.get()
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user