1. Recipes
  2. Add Custom Javascript to your Desktop App

Recipes

Add Custom Javascript to your Desktop App

INFO

We use the most up to date version of Chromium so you can use the latest browser features when your app is running as a desktop app.

You can use the isDesktopApp() fucntion to add different behaviour to your app when it is running as a desktop app.

        import { isDesktopApp } from '@todesktop/client-core/platform/todesktop';

if (isDesktopApp()) {
  alert('You are running as a desktop app.');
}

      

Alternatively, We expose a window.todesktop object if you want a quick solution.

        if (window.todesktop) {
  alert('You are running as a desktop app.');
}

      

If you have a lot of javascript in your desktop app then we recommend separating all of your desktop specific logic into a separate javascript file.