Onplan app codebase using svelte v3
Install dependencies with npm install (or pnpm install or yarn), start a development server:
# Uses port 5173 by default
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview.
To deploy your app, you may need to install an adapter for your target environment.
Application states that are reactive.
isOnline - True if connected to wifi/data REGARDLESS if have real internet connection. READONLY.
isActuallyOnline - True if connected to wifi/data AND have real internet connection via http checking. With reCheck() utility function for updating the latest state. READONLY.
import { isOnline, isActuallyOnline } from '$lib/stores/connectivity';
// Note: Prefix stores with $ to access their values
consosle.log($isOnline); // log true or false
consosle.log($isActuallyOnline); // log true or false
// to update the latest "isActuallyOnline" value asynchronously
isActuallyOnline.reCheck();
// to get the latest "isActuallyOnline" value synchronously.
const withRealInternet = await isActuallyOnline.reCheck();
consosle.log(withRealInternet); // log true or false
Read more on: Prefixing $ in store object to access value