<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
import { startPolling, stopPolling } from "@/utils/messageManager"

onLaunch(() => {
  console.log("App Launch")
  // 启动消息轮询（30秒一次）
  startPolling(30000)
})

onShow(() => {
  console.log("App Show")
  // 应用从后台切换到前台时，重新启动轮询
  startPolling(30000)
})

onHide(() => {
  console.log("App Hide")
  // 应用切换到后台时，停止轮询以节省资源
  stopPolling()
})
</script>
<style>
/* 全局盒模型设置 */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 全局字体设置 */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* uni-app 组件也应用 border-box */
page, view, text, image, button, input, textarea, scroll-view, swiper, picker {
  box-sizing: border-box;
}
</style>
