mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
firefox private mode check
This commit is contained in:
parent
d0dbd5312a
commit
aed95236be
@ -21,11 +21,17 @@ import "./js/background.js" // zeroBackground
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
const isFirefox = !!globalThis.localStorage
|
const isFirefox = !!globalThis.localStorage
|
||||||
|
const zcb = globalThis.zeroDetectModeCB
|
||||||
|
|
||||||
function detectPrivateMode(cb) {
|
function detectPrivateMode(cb) {
|
||||||
var db, tempMode,
|
var db, tempMode,on, off;
|
||||||
on = cb.bind(null, true),
|
if (zcb) {
|
||||||
off = cb.bind(null, false)
|
on = zcb(cb, true);
|
||||||
|
off = zcb(cb, false);
|
||||||
|
} else {
|
||||||
|
on = ()=> {setTimeout(cb.bind(null, true), 1)};
|
||||||
|
off = ()=> {setTimeout(cb.bind(null, false), 1)};
|
||||||
|
}
|
||||||
if (isFirefox) {
|
if (isFirefox) {
|
||||||
// in private mode, localStorage will be erased when browser restart
|
// in private mode, localStorage will be erased when browser restart
|
||||||
tempMode = localStorage.getItem('zeroOmega.isPrivateMode')
|
tempMode = localStorage.getItem('zeroOmega.isPrivateMode')
|
||||||
|
Loading…
Reference in New Issue
Block a user