34 lines
901 B
JavaScript
34 lines
901 B
JavaScript
|
//<2F>洢<EFBFBD><E6B4A2>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|||
|
function createSetStaticData() {
|
|||
|
if (window.sessionStorage) {
|
|||
|
return (k, v) => window.sessionStorage.setItem(k, v);
|
|||
|
} else if ($ && $.cookie) {
|
|||
|
return (k, v) => $.cookie(k, v);
|
|||
|
} else {
|
|||
|
throw new Error("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵĴ洢<C4B4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
}
|
|||
|
var setStaticData = createSetStaticData();
|
|||
|
//<2F><>ȡ<EFBFBD>洢<EFBFBD>ľ<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|||
|
function CreateGetStaticData() {
|
|||
|
if (window.sessionStorage) {
|
|||
|
return (k) => window.sessionStorage.getItem(k);
|
|||
|
} else if ($ && $.cookie) {
|
|||
|
return (k) => $.cookie(k);
|
|||
|
} else {
|
|||
|
throw new Error("û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵĴ洢<C4B4><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
}
|
|||
|
var getStaticData = CreateGetStaticData();
|
|||
|
//<2F><>̬<EFBFBD><CCAC><EFBFBD>ݴ<EFBFBD>ȡ<EFBFBD><C8A1>
|
|||
|
class StaticData {
|
|||
|
constructor(k, v) {
|
|||
|
this.key = k;
|
|||
|
this.value = v;
|
|||
|
if (v) {
|
|||
|
setStaticData(k, v);
|
|||
|
} else {
|
|||
|
this.value = getStaticData(k);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|