未验证 提交 c88bc178 编写于 作者: J Jamie Kyle 提交者: GitHub

Use an if statement instead of expression statement (#12747)

上级 87e096eb
......@@ -144,8 +144,11 @@ export function reportWebVitals(metric) {
const url = 'https://example.com/analytics'
// Use `navigator.sendBeacon()` if available, falling back to `fetch()`.
;(navigator.sendBeacon && navigator.sendBeacon(url, body)) ||
if (navigator.sendBeacon) {
navigator.sendBeacon(url, body)
} else {
fetch(url, { body, method: 'POST', keepalive: true })
}
}
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册