Desktop development

Desktop development

Desktop development

Function

bt_app is the desktop application runtime and packaging tool officially provided by BT. It can read app.json in the development directory, standalone .btr software, or embedded resources at the end of the exe, create a desktop window, and load local pages, local BT service addresses, or remote Web addresses as configured.

Developers can use HTML/CSS/JavaScript or any front-end framework to write interfaces, and BT to implement local logic, Web services, or functions callable from the front end. bt_app provides windows, resource protocols, BTR/single-executable builds, icons, metadata, and the front-end window.bt bridge. A .btr contains only application configuration and resources, allowing multiple small apps to share one installed runtime.

Applicable scenarios

- HTML front-end developers, quickly write pages.

  • BT local service plus desktop software with web front-end.
  • Package remote web applications into desktop windows with one click.
- Windows desktop application requiring single file distribution.
  • Multiple BT gadgets need to be published as lightweight .btr, launched by common toolbar or system file association.

Differences from Web projects

  • Ordinary Web projects run in the browser, and the page cannot directly call BT local functions by default.
  • bt_app runs in the desktop WebView and injects window.bt. The page can call the BT language functions in main.bt through bt.call(), and can also control windows, trays, clipboards, screen straws, frame selection screenshots, global shortcut keys, notifications and system dialog boxes through the desktop API.

Differences from ordinary desktop software

Traditional desktop software usually uses the native UI directly. bt_app uses Web technology to draw the interface, and uses BT to be responsible for local logic or services. It is suitable for developers who already have Web front-end experience.

Basic operation idea

1. Double-click to start bt_app.exe or execute the command ./bt_app.exe run.

2. bt_app run app.btr or bt_app app.btr reads resources from the specified BTR; a standalone exe with embedded resources reads from itself; otherwise, it runs the specified directory or the current directory.

3. All sources first read and verify app.json; when the development directory does not have app.json but index.html exists, the default configuration will be automatically generated and run.

4. In static mode, the window loads the HTML file specified by app.entry.

5. In server mode, execute server.bt, and the window loads the local service address specified by app.entry.

6. remote mode, directly loads the URL specified by app.entry.

Document Directory