@thepassle/app-tools
Version:
Collection of tools I regularly use to build apps. Maybe they're useful to somebody else. Maybe not. Most of these are thin wrappers around native API's, like the native `<dialog>` element, `fetch` API, and `URLPattern`.
17 lines (15 loc) • 374 B
JavaScript
/**
* @example offlinePlugin('/my-offline-page')
* @param {string} offlineRoute
* @returns {import('../index.js').Plugin}
*/
export function offlinePlugin(offlineRoute = '/offline') {
return {
name: 'offline',
shouldNavigate: () => ({
condition: () => navigator.onLine,
redirect: offlineRoute,
})
}
}
export const offline = offlinePlugin();