import { recordPageView } from './api';

let succeeded = false;

/** 全站浏览 +1；成功后才记住。返回是否已成功写入（当次或以往）。 */
export async function ensurePageViewOnce(): Promise<boolean> {
  if (succeeded) return true;
  const ok = await recordPageView();
  if (ok) succeeded = true;
  return ok;
}
