From Wiki96
Jump to: navigation, search
(Created page with "Windows 96 includes a flexible API for developing your own applications. All applications are ran under WRT, which is a partial sandbox and runtime provided by Windows 96 for applications. Applications may be referred to as "bins", "WRT bins", or "sysbins" depending on the context. == Structure of an application == Windows 96 applications are simply JavaScript files without the .JS extension that include a WRT shebang. Here is an example of a very basic Windows 96 GUI...")
 
Line 4: Line 4:


== Structure of an application ==
== Structure of an application ==
Windows 96 applications are simply JavaScript files without the .JS extension that include a WRT shebang.
Windows 96 applications are simply JavaScript files without the .JS extension that include a WRT shebang (<code>//!wrt</code>). The shebang denotes that this regular file is a WRT bin, and must be the very first line in any WRT application. It may sometimes include a binary specification (BSPEC) suffix to describe some metadata about the application. Note that if a BSPEC is included, the cumulative line size must not exceed 256 characters.


Here is an example of a very basic Windows 96 GUI program:<syntaxhighlight lang="javascript" line="1">
Here is an example of a very basic Windows 96 GUI program:<syntaxhighlight lang="javascript" line="1">

Revision as of 19:19, 23 January 2022

Windows 96 includes a flexible API for developing your own applications. All applications are ran under WRT, which is a partial sandbox and runtime provided by Windows 96 for applications.

Applications may be referred to as "bins", "WRT bins", or "sysbins" depending on the context.

Structure of an application

Windows 96 applications are simply JavaScript files without the .JS extension that include a WRT shebang (//!wrt). The shebang denotes that this regular file is a WRT bin, and must be the very first line in any WRT application. It may sometimes include a binary specification (BSPEC) suffix to describe some metadata about the application. Note that if a BSPEC is included, the cumulative line size must not exceed 256 characters.

Here is an example of a very basic Windows 96 GUI program:

//!wrt
const { Theme } = w96.ui;

class MyApplication extends WApplication {
    /**
     * Application constructor.
     * */
    constructor() {
        super();
    }
    
    /**
     * Main entry point.
     * @param {String[]} argv The program arguments.
     * */
    async main(argv) {
        // Create the window
        const mainwnd = this.createWindow({
            title: "Sample Application",
            body: "Sample text",
            bodyClass: "sample-app",
            taskbar: true,
            resizable: true,
            initialHeight: 480,
            initialWidth: 640,
            icon: await Theme.getIconUrl("mime/executable", '16x16')
        }, true);
        
        // Show the window
        mainwnd.show();
    }
}

return await WApplication.execAsync(new MyApplication(), this.boxedEnv.args);