缓存修改
parent
4a62e87cc6
commit
ec5551f70e
10
js/handle.js
10
js/handle.js
|
@ -48,15 +48,15 @@ function getFirstEventKeyword(name) {
|
||||||
|
|
||||||
// 设置领舞 name=姓名 time=有效期 单位秒
|
// 设置领舞 name=姓名 time=有效期 单位秒
|
||||||
function setLeader(name, time) {
|
function setLeader(name, time) {
|
||||||
localStorage.setItem('leader', name)
|
sessionStorage.setItem('leader', name)
|
||||||
localStorage.setItem('leader_end_at', (new Date).getTime()/1000 + time)
|
sessionStorage.setItem('leader_end_at', (new Date).getTime()/1000 + time)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取领舞人信息
|
// 获取领舞人信息
|
||||||
function getLeader() {
|
function getLeader() {
|
||||||
let res = []
|
let res = []
|
||||||
res['name'] = localStorage.getItem('leader') ? localStorage.getItem('leader') : ''
|
res['name'] = sessionStorage.getItem('leader') ? sessionStorage.getItem('leader') : ''
|
||||||
res['time'] = localStorage.getItem('leader_end_at') ? localStorage.getItem('leader_end_at') : 0
|
res['time'] = sessionStorage.getItem('leader_end_at') ? sessionStorage.getItem('leader_end_at') : 0
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ function receiveMessage(event)
|
||||||
let random2 = Math.floor(Math.random() + 0.5)
|
let random2 = Math.floor(Math.random() + 0.5)
|
||||||
|
|
||||||
// 获取领舞信息
|
// 获取领舞信息
|
||||||
let leaderInfo = localStorage.getItem('leader')
|
let leaderInfo = sessionStorage.getItem('leader')
|
||||||
|
|
||||||
let isLeader = data.uname == leaderInfo ? 1 : 0
|
let isLeader = data.uname == leaderInfo ? 1 : 0
|
||||||
// 给弹幕加上随机事件
|
// 给弹幕加上随机事件
|
||||||
|
|
Loading…
Reference in New Issue