A simple and user-friendly Svelte app designed to prevent your device from sleeping. The NoSleep app uses the Wake Lock API to keep the screen awake, with notifications to alert users if the wake lock is released due to system constraints. Built with Svelte and TailwindCSS, it offers a smooth, responsive experience with dark mode support.
- Enable NoSleepβ’: Activate wake lock to prevent your device from sleeping.
- Notification Alerts: Receive alerts when wake lock is disabled, allowing you to re-enable it quickly.
- Popup Messages: Informative popups guide the user through permissions and status changes.
- Dark Mode Support: Optimized for light and dark themes with TailwindCSS.
- Progressive Enhancement: Detects and handles unsupported Wake Lock API cases gracefully.
Check out the live demo here: NoSleep Svelte App Demo
- Click "Enable NoSleepβ’" to keep the device awake.
- Allow notifications if prompted, so youβre alerted if wake lock is released.
- View status updates and popup messages as the app keeps your device awake.
Clone the Repository:
git clone https://github.com/CodeskStudio/nosleep-svelte-app.git
cd nosleep-svelte-appInstall Dependencies:
npm installRun the App:
npm run devOpen http://localhost:5173 to view the app in your browser.
Follow these steps to build and deploy this Svelte + Vite application.
-
Configure the Base Path (if needed)
If your app will be hosted on a subpath (e.g.,
https://example.com/myapp/), update thebaseproperty invite.config.js:// vite.config.js import { defineConfig } from 'vite'; import { svelte } from '@sveltejs/vite-plugin-svelte'; export default defineConfig({ plugins: [svelte()], base: '/myapp/' // Replace '/myapp/' with your subpath or '/' if hosting at root });
If hosting at the root (e.g.,
https://example.com/), you can skip this step. -
Build the Project
Run the following command to build the app:
npm run build
This will generate an optimized, production-ready version of your app in a folder called
dist.
nosleep-svelte-app/
βββ public/
β βββ favicon.ico
β βββ site.webmanifest
βββ src/
β βββ components/
β β βββ Footer.svelte
β β βββ NotificationButton.svelte
β β βββ Popup.svelte
β β βββ WakeLockButton.svelte
β βββ App.svelte
β βββ index.css
β βββ main.js
βββ .gitignore
βββ index.html
βββ package.json
βββ svelte.config.js
βββ tailwind.config.js
βββ vite.config.js
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch-name. - Make your changes and commit:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature-branch-name. - Open a pull request.
This project is licensed under the MIT License.
Special thanks to all contributors aka. ChatGPT and to Svelte & TailwindCSS for making development straightforward and enjoyable!