mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-25 21:26:12 +10:00
16 lines
574 B
JavaScript
16 lines
574 B
JavaScript
export const inBrowser = typeof window !== 'undefined'
|
||
|
||
export const isMobile = inBrowser && document.body.clientWidth <= 600
|
||
|
||
/**
|
||
* @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
|
||
*/
|
||
export const supportsPushState = inBrowser && (function () {
|
||
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
|
||
return window.history &&
|
||
window.history.pushState &&
|
||
window.history.replaceState &&
|
||
// pushState isn’t reliable on iOS until 5.
|
||
!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)
|
||
})()
|