more cleanup

This commit is contained in:
Christien Rioux
2023-10-21 18:51:16 -04:00
parent 48ab34f577
commit 7da6b62c52
3 changed files with 11 additions and 11 deletions

View File

@@ -18,21 +18,21 @@ extern "C" {
pub fn is_browser() -> bool {
static CACHE: AtomicI8 = AtomicI8::new(-1);
let cache = CACHE.load(Ordering::AcqRel);
let cache = CACHE.load(Ordering::Acquire);
if cache != -1 {
return cache != 0;
}
let res = Reflect::has(global().as_ref(), &"navigator".into()).unwrap_or_default();
CACHE.store(res as i8, Ordering::AcqRel);
CACHE.store(res as i8, Ordering::Release);
res
}
pub fn is_browser_https() -> bool {
static CACHE: AtomicI8 = AtomicI8::new(-1);
let cache = CACHE.load(Ordering::AcqRel);
let cache = CACHE.load(Ordering::Acquire);
if cache != -1 {
return cache != 0;
}
@@ -41,7 +41,7 @@ pub fn is_browser_https() -> bool {
.map(|res| res.is_truthy())
.unwrap_or_default();
CACHE.store(res as i8, Ordering::AcqRel);
CACHE.store(res as i8, Ordering::Release);
res
}